Secondary window under NetCF does not appear

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an App running in WinCe. It communicates with a desktop App via sockets.

The Netcf App has a number of threads. On one of the threads I am trying to
start a Windows Form as a secondary window. The secondary Form does not
appear and the main Form locks up. The Vs2003 debugger still has control (you
can stop the Netcf App) but I cannot get the secondary Form to come up.

Could you indicate what I may be doing wrong. The secondary form does come
up when run off another simple Netcf App that does not have threading.

Thanks.
 
I should note that the module trying to launch the secondary windows Form is
a module that is loaded at runtime dynamically.

Thanks.
 
You should really launch windows only from the UI thread, not from random
other threads. The windowing system can easily get confused about which
thread's message queue should get the window's messages, if you don't. A
possible architecture for this would be to have a list of user-defined
messages (RegisterWindowMessage), which various threads in the application
and PostMessage() to the main window when they want something done (like
popping up a window). If you're using OpenNETCF and ApplicationEx, those
are easy to catch...

Paul T.
 
I will try that but I just wanted to verify that there is no work around to
launch from a worker thread. The module that I am trying to launch from is
dynamically loaded at runtime.

I am migrating a set of modules from the desktop to WinCE and the Team
leader would prefer me not to modify the interface that defines the
dynamically loaded module.

Thanks again for your help.
--
John Olbert



Paul G. Tobey said:
You should really launch windows only from the UI thread, not from random
other threads. The windowing system can easily get confused about which
thread's message queue should get the window's messages, if you don't. A
possible architecture for this would be to have a list of user-defined
messages (RegisterWindowMessage), which various threads in the application
and PostMessage() to the main window when they want something done (like
popping up a window). If you're using OpenNETCF and ApplicationEx, those
are easy to catch...

Paul T.
 
And presumably dynamically unloaded, too, potentially leaving a window
laying around with no one to handle its messages. If you have an interface
between the main program and the add-on components, handling of windows
needs to be part of the defined interface.

Paul T.

John Olbert said:
I will try that but I just wanted to verify that there is no work around to
launch from a worker thread. The module that I am trying to launch from is
dynamically loaded at runtime.

I am migrating a set of modules from the desktop to WinCE and the Team
leader would prefer me not to modify the interface that defines the
dynamically loaded module.

Thanks again for your help.
 
Back
Top