R
RAFAAJ2000
Hi all ,
I posted this question earlier on but for some reason , it didn't go thru !
Anyway... I am trying to draw a button over the XL application title bar by
using the 'CreateWindoEx' API function.However, the 'Y' parameter is related
to the Client Area of the Parent Window and therefore the Button is placed
right under the Title bar if 'Y' is set to 0 Not over it.
Any idea how to place the Button over the NonClient area of the XL
application ie:the Title Bar ?
Here is the code I have so far:
Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" _
(ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName _
As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, _
ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal _
hWndNewParent As Long) As Long
Declare Function DestroyWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Const SW_NORMAL = 1
Const WS_CHILD = &H40000000
Dim lngBtnHndl As Long
Sub CreateButton()
lngBtnHndl = CreateWindowEx(0, "Button", "Test !", WS_CHILD, _
ActiveWindow.Width * 3 / 4, 0, 50, 25, Application.hwnd, 0, 0, 0)
SetParent lngBtnHndl, Application.hwnd
ShowWindow lngBtnHndl, SW_NORMAL
End Sub
Sub DestroyButton()
DestroyWindow lngBtnHndl
End Sub
Regards.
I posted this question earlier on but for some reason , it didn't go thru !
Anyway... I am trying to draw a button over the XL application title bar by
using the 'CreateWindoEx' API function.However, the 'Y' parameter is related
to the Client Area of the Parent Window and therefore the Button is placed
right under the Title bar if 'Y' is set to 0 Not over it.
Any idea how to place the Button over the NonClient area of the XL
application ie:the Title Bar ?
Here is the code I have so far:
Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" _
(ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName _
As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, _
ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal _
hWndNewParent As Long) As Long
Declare Function DestroyWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Const SW_NORMAL = 1
Const WS_CHILD = &H40000000
Dim lngBtnHndl As Long
Sub CreateButton()
lngBtnHndl = CreateWindowEx(0, "Button", "Test !", WS_CHILD, _
ActiveWindow.Width * 3 / 4, 0, 50, 25, Application.hwnd, 0, 0, 0)
SetParent lngBtnHndl, Application.hwnd
ShowWindow lngBtnHndl, SW_NORMAL
End Sub
Sub DestroyButton()
DestroyWindow lngBtnHndl
End Sub
Regards.