Kann
asked on
Sample code for IShellExecuteHook
Hello,
I need the complete code for an small application (or DLL?) which use the IShellExecuteHook function.
(The best sample would be: Befor a application starts a messagebox should display with the question: "Should the file "notepade.exe" be executed?" [Yes] [No])
Thank you!
Kann
I need the complete code for an small application (or DLL?) which use the IShellExecuteHook function.
(The best sample would be: Befor a application starts a messagebox should display with the question: "Should the file "notepade.exe" be executed?" [Yes] [No])
Thank you!
Kann
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Listening
Kann?
ASKER
Thank you for your help!
> P.S: Ehm, I'm quite sure that this API only hook ShellExecute(Ex) calls, but NOT CreateProcess
> calls. I hope, that's no problem for you...
Do you know any example for this (when does a program be started by CreateProcess?)
> P.S: Ehm, I'm quite sure that this API only hook ShellExecute(Ex) calls, but NOT CreateProcess
> calls. I hope, that's no problem for you...
Do you know any example for this (when does a program be started by CreateProcess?)
CreateProcess is often used, when one programs executes another one. E.g. if a starter application starts another application and waits until the other application is finished. You can't do this with ShellExecute (I mean wait for the other app to finish).
Regards, Madshi.
Regards, Madshi.
begin
ShellExecuteInfo.hinstapp := 33; // > 32
// confirm operation
Result := MessageBox(0, 'Fred',
'IShellExecuteHook Shell Extension...' , MB_YESNOCANCEL);
end;
may be changed like this:
function TShellExecuteHook.Execute(
begin
ShellExecuteInfo.hinstapp := 33; // > 32
// confirm operation
Result:=S_FALSE;
if MessageBox(0, 'Go on?',
'IShellExecuteHook Shell Extension...' , MB_YESNO)=IDNO then
result:=S_OK;
end;
Good Luck.
shenqw
Result:=S_FALSE;
if MessageBox(0, 'Go on?',
'IShellExecuteHook Shell Extension...' , MB_YESNO)=IDNO then
result:=S_OK;