Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with findWindow porting dll from NT to 98

Status
Not open for further replies.

moisesventura

Programmer
Mar 27, 2001
2
CA
Hi,

I'm programming a c++ dll that is being called from a java code using jni.
The code works wonderfully under NT, but in 98 the process frozes when arrives to "findWindow" function.

I tryed to use enumwindows instead, with the same result.

Some ideas?

Moises
 
Well, all I can see is:
1. Your code is called in a complex environment (Java virtual machine) that can use multiple threads in W98 and can use multiple threads or fibers in WNT.
2. Your code frozes in FindWindow.
3. MSDN says that FindWindow uses GetWindowText and troubles with GetWindowText may cause troubles using FindWindow.
4. MSDN says that GetWindowText can froze when the window owns to the calling process but the window is frozen.

What I can suppose is:
1. There is a frozen window in your process, owned by a suspended thread.
2. When you call FindWindow you cause a WM_GETTEXT to be send to all windows in your process, including windows of suspended thread.
3. Your call is frozen waiting for the response from the suspended thread. If the suspended thread is a working communication thread that wakes up only when your thread ask for a service you have a deadlock

What I can suggest is:
1. Use MS Spy to verify if your process contains more than one thread. Verify if more than one thread ownes windows.
2. Use EnumWindows and verify the ownership of every window before calling GetWindowText. You must not call this function for windows belonging to other thread of your process. You can verify this conditions using GetWindowThreadProcessId and GetCurrentThreadId.

Good luck
 
Try to use PeekMessage where it is possible, for what message what you are waiting. John Fill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top