Page 1 of 1

Importing windows libs

Posted: Tue Nov 20, 2018 7:15 pm
by Justin
I'm trying to import some functions in comctl32.dll like SetWindowSubclass() to avoid using Openlibary() etc.
I used polib.exe:
polib /out:c:\comctl32.lib /machine:X86 C:\Windows\System32\comctl32.dll

and then import

Code: Select all

Import "comctl32.lib"
	SetWindowSubclass_(hwnd.i, pfnSubclass.i, uIdSubclass.i, dwRefData.i) As "_SetWindowSubclass"
EndImport

Debug SetWindowSubclass_(0, 0, 0, 0)


; OpenWindow(0, 0, 0, 300, 30, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; 
; Repeat
; Event = WaitWindowEvent()
; 
; Until Event = #PB_Event_CloseWindow
the function works until you uncomment the Openwindow() code, then crashes at the first line.
This is on W732 on W764 works perfect and the function does its job(undecorating and using machine:X64)
PB5.62 - 5.70
Any hints? is this the correct way to do this?

Re: Importing windows libs

Posted: Wed Nov 21, 2018 5:18 pm
by Justin
If anyone is intetested using the libs in the win sdk with the full decorated name works. It seems there is something wrong with the lib produced by polib.

Re: Importing windows libs

Posted: Wed Nov 21, 2018 8:19 pm
by fryquez
Same, here. But no problem when using polib.exe from current Pelles C package.

BTW: the C:\Windows\System32\comctl32.dll is a legacy one v 5.82, you want the new version 6.0.

Re: Importing windows libs

Posted: Wed Nov 21, 2018 9:57 pm
by Justin
thanks i'll give it a try