[VB6] Taksbar menu niet visible in maximize mode

Pagina: 1
Acties:

  • vorlox
  • Registratie: Juni 2001
  • Laatst online: 02-02-2022

vorlox

I cna ytpe 300 wrods pre miute

Topicstarter
[VB6] Taksbar menu niet visible in maximize mode

Beste Allemaal,

Ik heb van de Support.microsoft wesite een stukkie code gehaald om een taskbar icoontje en een menu e vershijnen.

Dit werkt een beetje wel en een beetje niet??

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Module
-------------------------------------------------------------
 'user defined type required by Shell_NotifyIcon API call
      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

      'constants required by Shell_NotifyIcon API call:
      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 Const WM_MOUSEMOVE = &H200
      Public Const WM_LBUTTONDOWN = &H201     'Button down
      Public Const WM_LBUTTONUP = &H202       'Button up
      Public Const WM_LBUTTONDBLCLK = &H203   'Double-click
      Public Const WM_RBUTTONDOWN = &H204     'Button down
      Public Const WM_RBUTTONUP = &H205       'Button up
      Public Const WM_RBUTTONDBLCLK = &H206   'Double-click

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

      Public nid As NOTIFYICONDATA

Form code
------------------------------------------------------------

      Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      
      'this procedure receives the callbacks from the System Tray icon.
      Dim Result As Long
      Dim msg As Long
       'the value of X will vary depending upon the scalemode setting
       If Me.ScaleMode = vbPixels Then
        msg = X
       Else
        msg = X / Screen.TwipsPerPixelX
       End If
       
       Select Case msg
        Case WM_LBUTTONUP        '514 restore form window
         Me.WindowState = vbMaximized
         Me.PopupMenu Me.mPopupSys
         Result = SetForegroundWindow(Me.hwnd)
         Me.Show
        Case WM_LBUTTONDBLCLK    '515 restore form window
         Me.WindowState = vbMaximized
         Me.PopupMenu Me.mPopupSys
         Result = SetForegroundWindow(Me.hwnd)
         Me.Show
        Case WM_RBUTTONUP        '517 display popup menu
         Result = SetForegroundWindow(Me.hwnd)
         Me.PopupMenu Me.mPopupSys
       End Select
       
      End Sub


Nu heb ik het volgende probleem?
Zodra de applicatie geminimaliseerd is dan klik ik links/rechts en krijg ik het menutje te zien

maar als de app gemaximaliseerd is en ik klik op de taskbar icon dan wordt er niks weergegeven
Zelfs de hele sub Form_MouseMove wordt niet aangeroepen??

wat zie ik in hemelsnaam over het hoofd?

Please help

  • pjvandesande
  • Registratie: Maart 2004
  • Laatst online: 21-05 14:59

pjvandesande

GC.Collect(head);

Dat hoeft toch ook niet, je wilt toch alleen de app in je system tray als hij geminimalizeerd is?

  • Kuhlie
  • Registratie: December 2002
  • Niet online
Ik gebruik voor systray-icoontjes altijd een aparte, invisible, Form. Daarmee werkt het iig wel.