Click to See Complete Forum and Search --> : Have AnyOne tried this before
akhil
Feb 16th, 2001, 11:39 PM
I want to hide my VB Application whenever user switch to some third party application invoked by my application and he could be able to come back to vb application only after finishing third party application and i have to trap time till user is on third party application and display it in my vb application, i have done this using "Shell Execute" api and getting process id of third party application, it works fine with all other application but not with our third party application we found that it is not working with our third party application because this application isn't having any process id as shown in task manager, is there any other method please let me know at this thread or at email address akhilakhil1@rediffmail.com
Thanks
Akhil.
Lord Orwell
Feb 17th, 2001, 01:50 AM
You could get the handle of the application's main window, and then once every second do a iswindow(hwnd). So as long as that window exists, your program can remain hidden or whatever. When it is closed, the iswindow will return a false, and you are done.
akhil
Feb 18th, 2001, 10:51 PM
Thanks Lord for your help but my main problem is that only that this third party application is not returning any handle, is there some other way or do you have some code that could help in acheiving the same.
Thanks, in advance,
Akhil.
Lord Orwell
Feb 19th, 2001, 12:44 AM
How are you trying to get the handle? Tell me your method, and maybe we can come up with a different one.
Maybe what you see isn't the main window. (see compiled vb programs for an example...)
akhil
Feb 19th, 2001, 01:00 AM
This are the two API i am using
Public Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
pHandle = OpenProcess(SYNCHRONIZE, 0, pid) "pid is process id which we are getting using create process api and dwProcessId"
r = WaitForSingleObject(pHandle, INFINITE)
one thing i want to mention is that our third party application is made in toolbook not in VB and it is not showing process id in task manager but is there in task manager.
Lord Orwell
Feb 19th, 2001, 01:20 AM
Not the method i would have used. (not that your method is bad. I just don't understand it hehe)
I would use the findwindow api call (assuming the program has a window?) You only need to know either the window title, or the class name
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.