Creating and Passing a C Struct

BlitzPlus Forums/BlitzPlus Programming/Creating and Passing a C Struct

OK I want to use this user32.dll procedure. I know how to add it to a .decls file and how to call it BUT how can I make a WINDOWPLACEMENT struct and pass a pointer to the procedure? Should I use a bank? Anyone help please...

BOOL GetWindowPlacement(

    HWND  hWnd,	// handle of window
    WINDOWPLACEMENT *  lpwndpl 	// address of structure for position data
   );


typedef struct _WINDOWPLACEMENT {     // wndpl 

    UINT  length; 
    UINT  flags; 
    UINT  showCmd; 
    POINT ptMinPosition; 
    POINT ptMaxPosition; 
    RECT  rcNormalPosition; 
} WINDOWPLACEMENT; 


btw this is all so that I can use a Windows Window handle to find out if a window is minimized because the Blitz commands don't work with windows handles.

Thanks

I couldn't leave it alone and after some google searching, it pointed to a blitz page that had the following:

; .lib "user32.dll"
; GetWindowPlacement%(hwnd%, pwpl*):"GetWindowPlacement"

CreateTimer(1)
w = CreateWindow("WindowPlacement Test", 100, 100, 400, 400, 0, 3)

Repeat 
	Select WaitEvent()
		Case $803 : End
		Case $4001 : wp(QueryObject(w,1))			
	End Select
Forever

Function wp(hwnd)
	wp.WindowPlacement = New WindowPlacement
	wp\size = 11 * 4
	If Not GetWindowPlacement(hwnd, wp) Then
		Notify "Failed"
	Else
		Print "Flags: " + wp\flags
		Print "ShowCmd: " + wp\showCmd
		Print "MinPos: ("+wp\x_MinPos+","+wp\y_MinPos+")"
		Print "MaxPos: ("+wp\x_MaxPos+","+wp\y_MaxPos+")"
		Print "Rect: ("+wp\leftRect+","+wp\topRect+") - ("+wp\rightRect+","+wp\bottomRect+")"
		Print "-----------"
	EndIf
End Function

Type WindowPlacement
	Field size
	Field flags
	Field showCmd
	Field x_MinPos, y_MinPos
	Field x_MaxPos, y_MaxPos
	Field leftRect, topRect, rightRect, bottomRect
End Type


by Soja


Nice one!