Skip to main content
gamedev.net
🔒 Locked

windows problem

Started by meeshoo 3 replies 550+ views
Original Post
meeshoo
meeshoo
I have a real problem.I hava a dialog based application from where, through a script language(Lua) i make a function call in a dll, wich should open me another window.The problem is that, in spite the window appears, I get the error that the RegisterClass function fails.Well i use for the second window in the WNDCLASS structure the dll instance(GetModuleInstance(NULL)) and everything should work.The same code, moved from the dll to an exe with a WinMain function works.Where might be the mistake? Mihai
Dave Hunt
Dave Hunt
Did you, perhaps, mean GetModuleHandle()? Passing NULL returns the handle (instance) of the file used to create the calling process. You need to pass the name of the dll.
meeshoo
meeshoo
yes that is what i ment, GetModuleHandle.well.so u say that if the initialization code for the second window it''s in the dll, and there i call GetModuleHandle(NULL), it won''t return the dll HMODULE structure?i think this is what is going on in fact,and i think this is producing the error, but i''m not sure.i''ll have to check it over and over again if anyone doesn''t give me the solution.

maybe my describing on the problem was a little fuzzy.so i have an application and a dll wich is load when the application starts(the dll is linked through a lib file).the app has a dialog type window.in the dll are some initialization functions for another window, wich i intend to make it a child of the first window(owned by the app).i get the module handle with GetModuleHandle(NULL), describing the structure(WNDCLASS) and then calling RegisterClass wich fails(don''t know why).I thought the problem is that i pass the dll module handle to the window and not the app handle(but i don''t know if my supposition is right) and the question is how i make the second window as a window of the first process(the app) or if there is another way to deal with it.

please, i need help



Mihai
meeshoo
meeshoo
is there anyone who ca help me?

Mihai
Dave Hunt
Dave Hunt
Perhaps you could show how your WNDCLASS structure is set up (for both the app window and the dll window).

Are you specifying the same class name for both? If so, then the RegisterClass in the DLL should fail because it''s already been registered (by the app).

Without seeing some code, there''s not much help to be offered.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.