Importing windows libs

Just starting out? Need help? Post your questions and find answers here.
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Importing windows libs

Post 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?
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Importing windows libs

Post 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.
fryquez
Enthusiast
Enthusiast
Posts: 362
Joined: Mon Dec 21, 2015 8:12 pm

Re: Importing windows libs

Post 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.
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Importing windows libs

Post by Justin »

thanks i'll give it a try
Post Reply