Userlib and Win api calls????

Blitz3D Forums/Blitz3D Programming/Userlib and Win api calls????

AJirenius(Posted 2007) [#1]
Ok, now after a couple of weeks I just must crawl to the cross and admit that I havent got a clue how to create my own small userlibs for Win apis. I recieved help regarding icons in window and taskbar but I just don't know how to implent it in Blitz3D
I've tried so many different things to be able to call those api's in B3D but none of them seems to work.

... soooo dear fellow Blitzers. How do I do it?

This is what I receieved from Grey Alien but he is using BlitzMAX
' -----------------------------------------------------------------------------
' ccSetIcon
' -----------------------------------------------------------------------------
Function ccSetIcon(iconname$, TheWindow%)	
	?Win32
	Local icon=ExtractIconA(TheWindow,iconname,0)
	Local WM_SETICON = $80
	Local ICON_SMALL = 0
	Local ICON_BIG = 1
'	sendmessage(TheWindow, WM_SETICON, ICON_SMALL, icon) 'don't need this
	sendmessage(TheWindow, WM_SETICON, ICON_BIG, icon)
'	SetClassLongA(TheWindow,-14,icon)'obsolete as it doesn't work with Windows XP Theme!
	?
End Function

'call it like this
ccSetIcon("test.ico", GetActiveWindow())


and the externs:


?win32
Extern "win32"
	Function ExtractIconA%(hWnd%,File$z,Index%)
	Function GetActiveWindow%()
	Function SendMessage:Int(hWnd:Int,MSG:Int,wParam:Int,lParam:Int) = "SendMessageA@16"
End Extern
?


I understand that I must put a file in the userlib folder to be able to call them and this is what I put there:
; Win32.decls

; Is placed in my userlib folder

.lib "win32.dll"


ExtractIconA%(hWnd%,File$z,Index%)
GetActiveWindow%()


obviously it doesn't work...
HELP!


Kev(Posted 2007) [#2]
AJirenius if you dont mind the .dll winblitz3d offers support to change the icon in the blitz3d window, lots more is also included.

if you want to take a look see the link in my sig!

kev


VIP3R(Posted 2007) [#3]
Save these in your userlibs folder as 'Shell32.decls' and 'User32.decls'...

.lib "shell32.dll"

ExtractIconA%(hWnd%,File$,Index%):"ExtractIconA"
.lib "user32.dll"

GetActiveWindow%():"GetActiveWindow"
SendMessageA%(hWnd%,wMsg%,wParam%,lParam$):"SendMessageA"
...Kev's WinBlitz3D is also well worth using instead.


AJirenius(Posted 2007) [#4]
Kev: I've seen your name around this area lots of time before (icon-changing, api etc) and you definitely seems to know your way around this, but honestly, I just finished my game and must send it to the publisher tomorrow and am not that keen to include a big package.dll that I only will use 2 or 3 calls from.

The thing is that I will need the icon on the Title bar and also change the text and put an icon in the taskbar. I would appreciate help but I understand it's bad for business if you share the secrets :/


AJirenius(Posted 2007) [#5]
VIP3R: except for the
lParam*)

that should be

lParam$)

it worked just perfectly!, thanks a lot.


VIP3R(Posted 2007) [#6]
Oops, corrected above :)