Win32 FindWindow()

BlitzMax Forums/BlitzMax Beginners Area/Win32 FindWindow()

Hi!
I'm haveing trouble getting some of the Win32 functions working in Max and am wondering if someone can help me out. Ive added the following to user32.bmx in win32.mod:
Function FindWindow( lpClassName:Byte Ptr,lpWindowName:Byte Ptr ) = "FindWindowA@8"

I've built win32.mod (debug and release) and running the following code:
class:String="Calculator"
title:String="SciCalc"
hWnd=FindWindow(class.ToCString(),title.ToCString())

Print hWnd

With windows calculator running I get 0 for the handle. Any ideas on what I'm doing wrong?

the Class should be "SciCalc" the Title should be "Calculator"

Gah!! I feel stupid.. =) Thanks Perturbatio!

I found this handy utility many years ago now, it allows you to find the classname and handle for any control or window that is open just by mousing over it.

It may come in handy for your experiments.

Thanks! That will be useful.

What I've been working on is embedding another application in the BlitzMax window. I've got it figured out and now I'm working on eliminating the title bar.

Graphics 800,600,0

title:String="Calculator"
class:String="SciCalc"
calchWnd=FindWindow(class.ToCString(),title.ToCString())

title:String="BlitzGL Window"
class:String="BlitzGL Window Class"
maxhWnd=FindWindow(class.ToCString(),title.ToCString())

Print calchWnd
Print maxhWnd

SetParent(calchWnd,maxhWnd)
MoveWindow(calchWnd,0,0,480,317,1)

While Not KeyDown(KEY_ESCAPE)
	Cls

	DrawRect 100,100,100,100	

	FlushMem
	Flip
Wend