Results 1 to 2 of 2

Thread: Icon in Taskbar

  1. #1

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Hi chaps, I'm going to have another go with this question.

    I know there's an API that lets you set the text on the button in the taskbar (and you're all thinking, "hmm, yes, that'll be the Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
    (ByVal hWnd As Long, ByVal lpString As String) As Long API if I'm not mistaken, and I very rarely am.)

    So is there one that lets you set the ICON? What I have found in my meddling with a perfectly good (if somewhat bugged) vb6, is that if you turn off the control box, and set the caption of a form to nothing, when you run your prog it shows only an empty button in the task bar. Surely there is a civlised way around this?

    Here's hoping....


  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    Well, if I understand you correctly, you want to change the icon of your app in the Task Bar, right? You are aware that this is the same as the Icon of the Form that it belongs to, correct? So what are you trying to do? Do you want it so that your app has no Icon but the button in the Task Bar does have an icon? If this is what you want, I don't think that it is possible. Anyway if you want the command to set the Form's Icon (which will be the same in theTask Bar) you can use SendMessage, as follows:
    Code:
    Private Const WM_SETICON As Long = &H80
    
    Private Declare Function SendMessage _
                    Lib "user32" _
                    Alias "SendMessageA" _
                    (ByVal hwnd As Long, ByVal wMsg As Long, _
                    ByVal wParam As Long, lParam As Any) As Long
    
    Private Sub Command1_Click()
       'hIcon is a module-level variable that is the handle to a
       'previously loaded Icon.
       Call SendMessage(Form1.hWnd, WM_SETICON, 0, ByVal hIcon)
    End Sub
    Explain a little bit more and I'll see if I can throw any more ideas your way.
    Dan PM
    Analyst Programmer

    VB6 SP3 (also VB4 16-bit sometimes )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width