Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages
Started by Keneth Wagner
Wed, 09 Apr 2003 09:10
ShellExecute
Author: Keneth Wagner
Date: Wed, 09 Apr 2003 09:10
Date: Wed, 09 Apr 2003 09:10
5 lines
1269 bytes
1269 bytes
Hi, I need to control other program from my application. I call that program with SellExecute and opttain an HINSTANCE variable to the program. How I can use that variable to control the porgram, an make minimize, close, etc, to the program?. how to optain the handle of that other window?. Thanks a lot for any help.
Re: ShellExecute
Author: Remy Lebeau (TeamB)
Date: Wed, 09 Apr 2003 17:04
Date: Wed, 09 Apr 2003 17:04
27 lines
1992 bytes
1992 bytes
"Keneth Wagner" <Keneth_w@msn.com> wrote in message
news:3e93e3bd$1@newsgroups.borland.com...
> I call that program with SellExecute and opttain an
> HINSTANCE variable to the program.
The HINSTANCE returned by ShellExecute() is not a valid HINSTANCE, as stated
in Microsoft's own documentation:
Return Value
Returns a value greater than 32 if successful, or an error value
that is less than or equal to 32 otherwise. The following table lists the
error values. The return value is cast as an HINSTANCE for backward
compatibility with 16-bit Windows applications. It is not a true HINSTANCE,
however. The only thing that can be done with the returned HINSTANCE is to
cast it to an int and compare it with the value 32 or one of the error codes
below.
> how to optain the handle of that other window?.
Use CreateProcess() instead. It returns a process ID, which you can then
use with EnumWindows() and GetWindowThreadProcessId() to find any windows
that have a matching process ID.
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads