shellexecute - How to shell to another app and have it appear in a delphi form -


In Delphi I used to use ShellXsecute for many years (and alternatively to wait) for other applications However, one of these applications is required to come in one of my Delphi application forms. I have tried the following code as a simple test to open a notepad (which does this ) And PAAR1 on my form To display results within (which does not do it). Can anybody keep me on the right track? Thanks

  var Rick: TShellExecuteInfo; Wnd: HWD; Const averb = 'open'; Aparam = ''; Affile name = 'Notepad XE '; Edir = ''; Start fill-variable (rec, shape (rec), # 0); Rec.cb Size: = Eyes (rec); Rec.fMask: = SEE_MASK_NOCLOSEPROCESS; Rec.lpVerb: = Pichar (Everb); Rec.lpFile: = Pichar (AfileName); Rec.lpParameters: = PCAR (Aparam); Rec.lp directory: = PCHAR (Adyar); Rec.nShow: = sw_Show; ShellExecuteEx (@Rec); Wnd: = Windows.FindWindow ('Notepad', zero); Windows.SetParent (Wnd, PAnel1.Handle); End;  

All error checks have been omitted, but you should start with:

  Process TForm1.Button1Click (Sender: Tubbed); Var Rick: TShellExecuteInfo; Const averb = 'open'; Aparam = ''; Affile name = 'Notepad XE '; Edir = ''; Start fill-variable (rec, shape (rec), # 0); Rec.cb Size: = Eyes (rec); Rec.fMask: = SEE_MASK_NOCLOSEPROCESS; Rec.lpVerb: = Pichar (Everb); Rec.lpFile: = Pichar (AfileName); Rec.lpParameters: = PCAR (Aparam); Rec.lp directory: = PCHAR (Adyar); Rec.nShow: = SW_HIDE; ShellExecuteEx (@Rec); WaitForInputIdle (Rik. Process, 5000); FNotepadHandle: Windows.FindWindow ('Notepad', zero); Windows.SetParent (fNotepadHandle, Handle); change shape; ShowWindow (fNotepadHandle, SW_SHOW); End; Process TForm1.form resize (sender: tubageet); If IsWindow (fNotepadHandle) then start Setup WindPOS (F. Notepad Handle, 0, 0, 0, ClientWidth, ClientHight, SWP_ASYNCWINDOWPOS), then start; End; End;  

Instead of using any window handle, you should calculate the new process windows which FindWindow () returns.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -