News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

InitCommonControlsEx in DLL does not work

Started by LiaoMi, August 26, 2016, 08:06:54 PM

Previous topic - Next topic

LiaoMi

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

jj2007

Log.exe works fine. Why don't you call InitCommonControlsEx before LoadLibrary?

LiaoMi

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.

TWell

dll use instance of calling process? GetModuleHandle ?
but resources are in dll.

LiaoMi

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