Results 1 to 3 of 3

Thread: Generating Taskbar buttons

  1. #1

    Thread Starter
    Hyperactive Member billwagnon's Avatar
    Join Date
    Jul 1999
    Location
    St. Louis, Missouri, Mississippi Valley
    Posts
    290
    I have a "program" that is actually an Excel macro written in VBA. I leave the instance of Excel invisible.

    The problem I have is that because Excel is invisible, there is no button for the instance on the Taskbar when Excel is running.

    I use a tiny VB6 executable to "kick start" the instance of Excel and run the macro. The user double-clicks on the icon, and Excel starts but the user doesn't see it.

    The users of the "program" would like to be able to click on the taskbar to bring the macro forms to the top of the desktop (because some of them leave it on ALL DAY). I know how to do this using zorder, but I don't know how to put the task button on the Taskbar.

    Is there an API or a method related to a form (rather than the instance of Excel) that I could use to place this button on the Taskbar while the "program" is running?

    The only way to get to the form, if you are working with other programs, is to minimize the others. The form starts on top but if you activate another "program" it is covered up. Ultimately it ends up as the last thing on the desktop.


  2. #2
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89

    Smile

    2 ideas:

    (1) Use SetWindowPos to make your form 'always on top'.
    (2) Use GetWindowLong and SetWindowLong to modify the WS_EX_APPWINDOW extended style:

    ShowWindow hWnd, SW_HIDE
    SetWindowExStyles hWnd, WS_EX_APPWINDOW, 0
    ShowWindow hWnd, SW_SHOW

    to remove it from the taskbar, or

    ShowWindow hWnd, SW_HIDE
    SetWindowExStyles hWnd, WS_EX_APPWINDOW, WS_EX_APPWINDOW
    ShowWindow hWnd, SW_SHOW

    to put it back.

    SetWindowExStyles is:

    Code:
    Public Function SetWindowExStyles(ByVal hWnd As Long, ByVal mask As WindowStyleExConstants, ByVal styles As WindowStyleExConstants)
      Dim curStyle As Long
      curStyle = GetWindowLong(hWnd, GWL_EXSTYLE) ' get current style
      curStyle = curStyle And (Not mask)          ' remove masked styles
      SetWindowExStyles = SetWindowLong(hWnd, GWL_EXSTYLE, curStyle Or styles) And mask
    End Function
    - Steve

    Real programmers use COPY CON PROGRAM.EXE

  3. #3
    Lively Member Dr_Evil's Avatar
    Join Date
    Mar 2000
    Location
    Columbus, OH
    Posts
    105
    Have you tried the ITaskbarList API function? If you need more info reply & I will try to get more info. I've never had a need to do this so I don't have any related code at the moment.
    Dr_Evil
    Senior Programmer
    VS6 EE
    VS.NET EA

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