FindWindowA failure

BlitzMax Forums/BlitzMax Programming/FindWindowA failure

Grey Alien(Posted 2006) [#1]
Hi, this doesn't seem to work yet it worked totally fine in Blitz PLus.

Extern "win32"
	Function FindWindowA%(NullString%,WindowText$)
End Extern

AppTitle = "test"
Graphics 640,320,0
Cls
Local handle = FindWindowA(0,"test")
DrawText handle,0,0
Flip
WaitKey



what am I doing wrong, any ideas?

thanks


REDi(Posted 2006) [#2]
Extern "win32"
	Function FindWindowA:Int(NullString$z,WindowText$z)
End Extern

AppTitle = "test"
Graphics 640,320,0
Cls
Local handle = FindWindowA(Null,"test")
DrawText handle,0,0
Flip
WaitKey



tonyg(Posted 2006) [#3]
What is FindWindowA?
There are a few posts with findwindow which you can search on and might give some help.


Grey Alien(Posted 2006) [#4]
papa: TOP MAN! it's that mysterious z after the $. I presume $z must mean shortstring or somthing, right? The actual param NullString wasn't a problem left as an integer as you can see by this now working code:
Extern "win32"
	Function FindWindowA:Int(nullstring%,WindowText$z)
End Extern

AppTitle = "test"
Graphics 640,320,0
Cls
Local handle = FindWindowA(0,"test")
DrawText handle,0,0
Flip
WaitKey


thanks again.


REDi(Posted 2006) [#5]
Sweet, $z is a C String btw.


TartanTangerine (was Indiepath)(Posted 2006) [#6]
Jake,

If you are trying to get your own window handle there is a much simpler and elegant way. Remember that BMAX had to create the hWnd so it must be stored somewhere right?

Local my_hWnd:Int = Primarydevice.hwnd



Grey Alien(Posted 2006) [#7]
OK thanks, that'll be quicker and not need a windows dll call.


TomToad(Posted 2006) [#8]
$z means zero delimited string. In other words, your strings have a 0 appended to the end which many C funtions require.


Grey Alien(Posted 2006) [#9]
yeah I know about those thanks, been using them since the year dot. Just needed to get Max to use the correct sort.