Re: X_Pos and Y_Pos ---> Button 1
Posted: Mon Jun 27, 2011 9:59 pm
Code: Select all
Button1 = CreateWindowEx_(...
GetWindowRect_(Button1, @br.RECT)
x = br\left
y = br\top
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
Button1 = CreateWindowEx_(...
GetWindowRect_(Button1, @br.RECT)
x = br\left
y = br\top
Code: Select all
Procedure WindowCallback(Window, Message, wParam, lParam)
Select Message
Case #WM_CLOSE
DestroyWindow_(Window)
Result = 0
Case #WM_DESTROY
PostQuitMessage_(0)
Result = 0
Default
Result = DefWindowProc_(Window, Message, wParam, lParam)
EndSelect
ProcedureReturn Result
EndProcedure
#Style = #WS_VISIBLE | #WS_BORDER | #WS_SYSMENU
#StyleEx = #WS_EX_TOOLWINDOW
WindowClass.s = "MeinFenster"
wc.WNDCLASSEX
wc\cbsize = SizeOf(WNDCLASSEX)
wc\lpfnWndProc = @WindowCallback()
wc\hCursor = LoadCursor_(0, #IDC_CROSS)
wc\hbrBackground = #COLOR_WINDOW + 1
wc\lpszClassName = @WindowClass
RegisterClassEx_(@wc)
hWndMain = CreateWindowEx_(#StyleEx, WindowClass, "Test-Window", #Style, 10, 10, 200, 200, 0, 0, 0, 0)
m=CreateWindowEx_(0, "Button", "Button 1", #WS_CHILD | #WS_VISIBLE, 10, 10, 100, 20, hWndMain, 0, 0, 0)
GetWindowRect_(m, @br.RECT)
mPoint.POINT
mPoint\x = br\left
mPoint\y = br\top
ScreenToClient_(hWndMain, mPoint)
Debug x = br\left
Debug y = br\top
Debug mPoint\x
Debug mPoint\y
ShowWindow_(hWndMain, #SW_SHOWDEFAULT)
UpdateWindow_(hWndMain);
While GetMessage_(msg.MSG, #Null, 0, 0 )
TranslateMessage_(msg)
DispatchMessage_(msg)
Wend