Results 1 to 5 of 5

Thread: Why is this not working.......I, i i i i want the knife

  1. #1

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Why wont this return the program to the windowstate of 2(Max) from the system tray?


    Private Sub GoSystemTray()
    VBGTray.cbSize = Len(VBGTray)
    VBGTray.hwnd = Me.hwnd
    VBGTray.uId = vbNull
    VBGTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    VBGTray.ucallbackMessage = WM_MOUSEMOVE
    VBGTray.hIcon = Me.Icon
    'tool tip text
    VBGTray.szTip = Me.Caption & vbNullChar
    Call Shell_NotifyIcon(NIM_ADD, VBGTray)
    App.TaskVisible = False 'remove application from taskbar
    Me.Hide
    End Sub


    Private Sub Form_Load()

    VBGTray.cbSize = Len(VBGTray)
    VBGTray.hwnd = Me.hwnd
    VBGTray.uId = vbNull
    VBGTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    VBGTray.ucallbackMessage = WM_MOUSEMOVE
    VBGTray.hIcon = Me.Icon
    'tooltiptext
    VBGTray.szTip = Me.Caption & vbNullChar
    Call Shell_NotifyIcon(NIM_ADD, VBGTray)
    End Sub


    Private Sub Form_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single)
    Static lngMsg As Long
    Static blnFlag As Boolean
    Dim result As Long
    lngMsg = X / Screen.TwipsPerPixelX
    If blnFlag = False Then
    blnFlag = True
    Select Case lngMsg
    'right-click
    Case WM_RBUTTONUP
    result = SetForegroundWindow(Me.hwnd)
    PopupMenu Me.mnumenu
    'left-click
    Case WM_LBUTTONUP
    Me.WindowState = 1 'HERE IS WHERE IT SHOULD DO IT!
    End Select
    blnFlag = False
    End If
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    VBGTray.cbSize = Len(VBGTray)
    VBGTray.hwnd = Me.hwnd
    VBGTray.uId = vbNull
    Call Shell_NotifyIcon(NIM_DELETE, VBGTray)
    End Sub

    Private Sub Form_Resize()
    If Me.WindowState = 1 Then
    Call GoSystemTray
    End If
    End Sub
    That arranged can be

  2. #2
    Guest
    Code:
    Me.WindowState = 1 'HERE IS WHERE IT SHOULD DO IT!
    maybe you need to set the window state to 2 in that expression and try that!

  3. #3

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    tried that before...it doesn't do either...
    That arranged can be

  4. #4
    Guest
    This may be a stupid question, but did you declare the constants?

  5. #5

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Yeah, just didn't really wanna post them..


    Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

    Public Const WM_LBUTTONDOWN = &H201
    Public Const WM_LBUTTONUP = &H202
    Public Const WM_LBUTTONDBLCLICK = &H203
    Public Const WM_RBUTTONUP = &H205
    Public Const WM_MOUSEMOVE = &H200
    Public Const NIM_ADD = &H0
    Public Const NIM_MODIFY = &H1
    Public Const NIM_DELETE = &H2
    Public Const NIF_MESSAGE = &H1
    Public Const NIF_ICON = &H2
    Public Const NIF_TIP = &H4

    Public Type NOTIFYICONDATA
    cbSize As Long
    hwnd As Long
    uId As Long
    uFlags As Long
    ucallbackMessage As Long
    hIcon As Long
    szTip As String * 64
    End Type

    Public VBGTray As NOTIFYICONDATA





    error there?
    That arranged can be

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