Windows API

BlitzMax Forums/BlitzMax Programming/Windows API

Foolish(Posted 2012) [#1]
All,
I am attempting to create a "live" wallpaper/desktop replacement for windows.

However, I am inexperienced converting WinAPI calls to something I can use in BMAX.

Can anyone tell me how I would leverage the following

[DllImport("user32.dll")]
public static extern bool SetTaskmanWindow(IntPtr hWnd);

I have something working for FindWindow:
Function FindWindow (x:Byte Ptr, y:Byte Ptr) = "FindWindowA@8"

But can't figure out what I am doing wrong with SetTaskmanWindow.

Thanks


col(Posted 2012) [#2]
Hiya,

Extern"Win32"
Function SetTaskmanWindow(hWnd)
Function FindWindowA(lpClassName$z,lpWindowName$z)
EndExtern


should get you started.

For maximum 'correct' compatibility you would use :-
Strict

Extern"Win32"
Global _bbusew

Function FindWindowA(lpClassName$z,lpWindowName$z)
Function FindWindowW(lpClassName$w,lpWindowName$w)

EndExtern

Function FindWindow(ClassName$,WindowName$)
	If _bbusew
		Return FindWindowW(ClassName,WindowName)
	Else
		Return FindWindowA(ClassName,WindowName)
	EndIf
EndFunction


Then in your own code you use FindWindow (note without the W or A appended) and your code will use the correct function for the machine its running on. The reason I mention this is that you *may* get EAVs when you exit your program on some machines on older machines. A difficult bug that took months and months to find!!

Last edited 2012