This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
I have a program that starts up a notepad, and I want it to be contained inside a java application.
Like: http://www.codeproject.com/KB/threads/applicationhost.aspx Everything runs fine, but finally the SetParent does not work at all, but it return a pointer (showing me that it is success)
The SetParent() does not set the parent, but everything seems to be fine.
The following is done:
CreateProcessA() called to start notepad (and I used it because java does not allow me to retrieve process id).
WaitForInputIdle() used to wait for the window to become visible, and to retrieve its handle.
GetTopWindow(null), GetWindowThreadProcessId(w, pid), GetWindow(w, 2); is used to find the window of the given process id. (If I close the notepad before these are executed the system does not find a window for that process id, so it works as well)
Finally the SetParent() is used to set the parent
From the microsoft msdn:
"If the function succeeds, the return value is a handle to the previous parent window."
And it does return a pointer!
The notepad window does not hosted