Importing SetWindowSubclass?

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

Importing SetWindowSubclass?

Post by Justin »

This throws a polink error:

Code: Select all

import "comctl32.lib"
	SetWindowSubclass(hwnd.i, pfnSubclass.i, uIdSubclass.i, dwRefData.i)
	DefSubclassProc(hwnd.i, uMsg.i, wparam.i, lparam.i)
endimport

SetWindowSubclass(0, 0, 0, 0)
I used PE Explorer and the function names are ok, what happens?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Importing SetWindowSubclass?

Post by ts-soft »

Use another static lib, the one from pb doesn't have this functions.
Use for example the lib from pellesc, this should work.
Justin
Addict
Addict
Posts: 952
Joined: Sat Apr 26, 2003 2:49 pm

Re: Importing SetWindowSubclass?

Post by Justin »

That did it. Shouldn't PB use the newest libs?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Importing SetWindowSubclass?

Post by ts-soft »

Justin wrote:That did it. Shouldn't PB use the newest libs?
the new functions doesn't work on older os, so pb requires not the newest.
Poplar
User
User
Posts: 16
Joined: Sun Apr 30, 2017 12:27 pm

Re: Importing SetWindowSubclass?

Post by Poplar »

Code: Select all

Prototype p_SetWindowSubclass(hWnd.i, pfnSubclass.i, uIdSubclass.i, dwRefData.i)
Prototype p_RemoveWindowSubclass(hWnd.i, pfnSubclass.i, uIdSubclass.i)
Prototype p_DefSubclassProc(hWnd.i, uMsg.i, wparam.i, lparam.i)
Prototype p_GetWindowSubclass(hWnd.i, Proc.i, ID.i, RefData.i)

Define.i hComCtl32

hComCtl32 = OpenLibrary(#PB_Any, "comctl32.dll")
If hComCtl32
  Global SetWindowSubclass.p_SetWindowSubclass = GetFunction(hComCtl32, "SetWindowSubclass")
  Global RemoveWindowSubclass.p_RemoveWindowSubclass = GetFunction(hComCtl32, "RemoveWindowSubclass")
  Global DefSubclassProc.p_DefSubclassProc = GetFunction(hComCtl32, "DefSubclassProc")
  Global GetWindowSubclass.p_GetWindowSubclass = GetFunction(hComCtl32, "GetWindowSubclass")
  CloseLibrary(hComCtl32)
EndIf
__________________________________________________
Code tags added
05.06.2018
RSBasic
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: Importing SetWindowSubclass?

Post by chi »

If you want this to be permanent:
Copy comctl32.lib from PellesC to PB\PureLibraries\Windows\Libraries and run this code (CompilerSelect 2) in the IDE and hit 'Restart Compiler'
Et cetera is my worst enemy
Post Reply