Opposite of FindClass$

Blitz3D Forums/Blitz3D Programming/Opposite of FindClass$

plash(Posted 2006) [#1]
API
.lib "user32.dll"
api_FindWindowB% (lpClassName, lpWindowName$) : "FindWindowA"


Code
Function FindClass$(t1$)
	b = api_FindWindowB(0, t1$)
		
	bbank = CreateBank(256)
	
	length = api_GetclassName( b, bbank, 255 )
	
	For i = 0 To length - 1
		class1$ = class1$ + Chr$(PeekByte(bbank, i))
	Next

	FreeBank bbank
	
	;DebugLog("Class = " + class1$)
	
	
	Return class1$
	
End Function



Any ideas on how to do the opposite? ('FindTitle$("Class", 0)')


b32(Posted 2006) [#2]
Hmm, but there could be more than one window with the same class. Maybe try GetForeGroundWindow and GetNextWindow ?



Kev(Posted 2006) [#3]
you would need GetClassName() pass the hwnd pointer of the window whos classname to wish to obtain.

woops maybe missunderstood, see FindWindowEx() this enables you to search all child windows of the passed parent hwnd, or you can start searching from child after using the second param


plash(Posted 2006) [#4]
After obtaining the handle of a window, how can you tell if it has been destroyed?


b32(Posted 2006) [#5]
Maybe enumerate all hwnds that are open, and see if the hwnd is in the list.


Kev(Posted 2006) [#6]
pass hwnd to IsWindow() found in user32.dll, this determines whether the specified window handle identifies an existing window.


plash(Posted 2006) [#7]
That worked. Thanks a lot Kev.


Kev(Posted 2006) [#8]
happy to help :)