Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am having a problem trying to migrate a dll from MFC to plain Win32, i am stuck in a part that creates a window, i can create the window but i need WndProc method to be called in the mainthread because the app(firefox) denies calls to its methods from a thread.

In MFC side worked with the hidden window, but trying to migrate it to win32 is where i don't understand how did it worked, i tried to create a method and put the CreateWindow code there and the end the message loop but it stops there and i need it to exit that method, using that i can send messages to firefox and works because WndProc is in the main thread.

I have already tried creating the window in another thread but then firefox denies calls to its methods because is not the main thread.

How does MFC does this? :(

Updated 9-Jan-12 8:51am
JackDingler 9-Jan-12 17:34pm    
Do you actually need a hidden window?

If you think you need it to pass messages between threads, there are better ways to do this.
manchukuo 9-Jan-12 18:36pm    
well it doesn't matter how to achieve it, i need to call a method in the main thread from a thread so i can call firefox methods, any suggestion that does this is ok, i only tried to do the similar stuff i did in MFC

1 solution

If you really need a window then create the window without WS_VISIBLE window style.

But if it is just a function then create a DLL file and export that function,
Share this answer
manchukuo 10-Jan-12 11:16am    
well the thread i have is a listener for IPC, that thread has to call somehow the main thread, and yes i did that hidden window already the thing is that because of the message loop it will not continue the execution of the calling method, in MFC when i created the window it manage the message loop without stopping the calling method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900