Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Drawing a clickable Button over the App title bar ?

Hi there, I have the following code which draws a Button but I can't manage
to place it right over the XL application title bar . This is because the
'Y' parameter of the 'CreateWindow' API function is relative to the Client
area of the Parent window.


I hope someone can help me with this.

Code :

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


Jaafar.
Regards.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drawing toolbar: line color button hammonl Excel Discussion (Misc queries) 1 August 25th 09 03:25 PM
changing vbOKCancel button title Jase Excel Discussion (Misc queries) 8 August 19th 08 08:56 PM
Creating a clickable button S Davis Excel Worksheet Functions 1 September 8th 06 04:53 PM
How can I make a clickable button to do a Key Combo? BGerman Excel Worksheet Functions 4 August 21st 06 05:01 PM
clickable URL in excel? djarcadian Excel Discussion (Misc queries) 3 May 31st 06 12:01 AM


All times are GMT +1. The time now is 03:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"