The MASM Forum

General => The Campus => Topic started by: LiaoMi on August 26, 2016, 08:06:54 PM

Title: InitCommonControlsEx in DLL does not work
Post by: LiaoMi on August 26, 2016, 08:06:54 PM
Hallo,

for a long time looking for an answer or advice on the Internet, and now I decided to ask here  :eusa_boohoo:

Why function InitCommonControlsEx is not executed successfully in dll, but it succeeds in exe, as a consequence, Invoke CreateDialogParam, hInstance, IDD_DIALOG, 0, Addr WndProc, 0 returns an error, the resources are not found.

There is a good description of InitCommonControlsEx - https://blogs.msdn.microsoft.com/oldnewthing/20050718-16/?p=34913
Title: Re: InitCommonControlsEx in DLL does not work
Post by: jj2007 on August 26, 2016, 10:05:12 PM
Log.exe works fine. Why don't you call InitCommonControlsEx before LoadLibrary?
Title: Re: InitCommonControlsEx in DLL does not work
Post by: LiaoMi on August 26, 2016, 10:27:26 PM
Quote from: jj2007 on August 26, 2016, 10:05:12 PM
Log.exe works fine. Why don't you call InitCommonControlsEx before LoadLibrary?

Log.dll with the same code does not work, even if I do separately to initialize the dll as it should be. InitCommonControlsEx returns zero... WinMainCRTStartup runs as the first order, LoadLibrary not used, because it is one and the same code that in dll and executable file.
Title: Re: InitCommonControlsEx in DLL does not work
Post by: TWell on August 26, 2016, 10:51:10 PM
dll use instance of calling process? GetModuleHandle ?
but resources are in dll.
Title: Re: InitCommonControlsEx in DLL does not work
Post by: LiaoMi on August 26, 2016, 11:02:06 PM
Quote from: TWell on August 26, 2016, 10:51:10 PM
dll use instance of calling process? GetModuleHandle ?
but resources are in dll.

Hallo TWell,

This is critical in this case? I tried with a zero option. But the whole situation is not affected.

P.S. Thank you! Indeed, it was necessary to obtain GetModuleHandle from log.dll, then everything works fine! Although InitCommonControlsEx returns zero, but it works.

invoke GetModuleHandle,addr logdll