Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Jul : ShellExecute(Handle, 'open', PChar(ExecuteThis), '', '', sw_show)
| Subject: | ShellExecute(Handle, 'open', PChar(ExecuteThis), '', '', sw_show) |
| Posted by: | "vmars" (..@verizon.net) |
| Date: | Thu, 7 Jul 2005 17:04:33 |
This is a simple two button Accessiblilty-Helps pgm that stays onTop
and just Starts and Closes two pgms (Magnify.exe, myHelp.exe (my D5 pgm)) :
It works fine on my winXP but not on my friends winXP computer.
Both pgms (myButton(ssLnk1=Magnifier.lnk) and myHelp(ssLnk2=myHelp.lnk))
and the *.lnk(s) reside in the same Directory.
Can anyone see a reason why MagnifierBtnClick always works,
but myHelpBtnClick only Closes the myHelp pgm, can't open it.
Else what's the best way to debug this.
He does have administrator priviledges.
& when i look in his Registry, both pgms look ok in MUIcache.
& i'd rather not install D5 on his computer to debug pgm.
Thank in advance!
Unit myButton;
...
procedure TForm1.MagnifierBtnClick(Sender: TObject);
var AppHandle:THandle; Result : Boolean;
begin
AppHandle:=FindWindow(Nil, PCHAR(ssName1));
if (AppHandle <> 0) Then
Result:=PostMessage(AppHandle, WM_QUIT, 0, 0)
ELSE
Begin
IF ssLnk1 <> UnAssigned Then
Begin
ExecuteThis := (AppPath + ssLnk1);
ShellExecuteThis(ExecuteThis);
end;
end;
end;
procedure TForm1.myHelpBtnClick(Sender: TObject);
var AppHandle:THandle; Result : Boolean;
begin
AppHandle:=FindWindow(Nil, PCHAR(ssName2));
if (AppHandle <> 0) Then
Result:=PostMessage(AppHandle, WM_QUIT, 0, 0)
ELSE
Begin
IF ssLnk2 <> UnAssigned Then
Begin
ExecuteThis := (AppPath + ssLnk2);
ShellExecuteThis(ExecuteThis);
end;
end;
ReadIniFile;
end;
procedure TMyHelpForm1.ShellExecuteThis(ExecuteThis: STRING);
BEGIN //Example ExecuteThis := 'C:\Windows\Calc.exe';
IF ShellExecute(Handle, 'open', PChar(ExecuteThis), '', '', sw_show)
<= 32 THEN
MessageDlg('Unable to open file: ' + ExecuteThis
+ ' ErrorCode= ' + IntToStr(sw_show), mtError, [mbOk], 0);
END;
--
τΏτ
V e r n www.parentpresent.org
NoWorrys = KidSafe Internet Filter (Freeware)