|
-
Dec 15th, 1999, 03:47 PM
#1
Thread Starter
Hyperactive Member
Hi, I created a program which doesn't have a caption; I fake that (including form-moving etc.)
In the taskbar, the icon of my program was blank (you know, where you usually see the form-icon and the form-caption). The caption part is easy - SetWindowText in the form-load, but how do I let windows draw my icon? The form does have an icon, but since it has no caption, it doesn't show that caption.
Any ideas where to start?
Tnx :-)
-
Dec 16th, 1999, 12:05 PM
#2
One really simple method would be to Disable the Caption at Runtime, this way the Taskbar Section is Still created as though the Form had a Caption and Icon..
Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const WS_CAPTION = &HC00000
Private Const GWL_STYLE = (-16)
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Sub Form_Load()
Dim W As Integer
Dim H As Integer
W = ScaleX(Width, ScaleMode, vbPixels)
'Will Need to resize the Height otherwise you'll get extra space where the Caption was.
H = ScaleY(ScaleHeight, ScaleMode, vbPixels)
Caption = "CaptionLess Form"
Call SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Xor WS_CAPTION)
Call SetWindowPos(hwnd, 0&, 0&, 0&, W, H, SWP_NOMOVE Or SWP_FRAMECHANGED)
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|