Question about showing a form from unmanaged code

  • Thread starter Thread starter Tao
  • Start date Start date
T

Tao

hi.. Group

Some unmanaged code invokes my code to show a form.

If I use ShowDialog() to show the form, form shows but main application
stops running. If I use Show() to show the form, main application runs but
my form does not get shown.


Does anyone have experience on how to handle this? Thanks
 
Tao said:
hi.. Group

Some unmanaged code invokes my code to show a form.

If I use ShowDialog() to show the form, form shows but main application
stops running. If I use Show() to show the form, main application runs but
my form does not get shown.


Does anyone have experience on how to handle this? Thanks

You need a message loop. If the main application does not provide one, you
will have to start one on a new thread. Your windows would then have to be
created from that thread as well.

Since COM objects, DDE, etc also require a message loop or work properly,
most applications do provide one.
 
Thanks Ben,

I am pretty new in this area, could you please point me some sample on how
to create a "message loop"?

My form is written in C# and a C++ component calls the form.

thanks again for your help.
 
Tao said:
Thanks Ben,

I am pretty new in this area, could you please point me some sample on how
to create a "message loop"?

My form is written in C# and a C++ component calls the form.

Is the C++ component your code? If so, what framework is it using if any
(MFC, WinForms, ATL, WTL, etc)?
 
Back
Top