| |
|
|
| RGH
and here for all Mitleser, The know want, How one at all Applications for Systemtray Windows in XProfan program, one complete Beispiellisting with TrayIcon-Menu and Images in the same: Declare Hicon&,end%,Show%
Declare Checkmerker%,Menuhandle&
Declare hbmChecked&,hbmUnchecked&
DEF SetMenuItemBitmaps(5) !USER32,SetMenuItemBitmaps
Proc Ico2SizedBmp
Parameters Icon&, dx&, dy&
Weiße temporary Bitmap in Size 32 * 32 produce
Var TempBmp& = Create(hNewPic, 32, 32, RGB(255,255,255))
On these Bitmap the Icon draw
StartPaint TempBmp&
DrawIcon Icon&, 0, 0
EndPaint
Weiße Bitmap in Size dx& * dy& produce
Var IBmp& = Create(hNewPic, dx&, dy&, RGB(255,255,255))
On these Bitmap The temporary Bitmap minimizes draw
StartPaint IBmp&
DrawSizedPic TempBmp&, 0, 0 - dx&, dy&; 0
EndPaint
DeleteObject TempBmp&
Return IBmp&
ENDPROC
Proc Menue
CreateMenu
AppendMenu 101, &Info
AppendMenu 102, &deaktiviert
SetMenuItemBitmaps(&hMenu,102,$10,hbmChecked&,hbmUnChecked&) Menu-graphic ändern...
AppendMenu 106, Mainwindow &visible
SetMenuItemBitmaps(&hMenu,106,$10,hbmChecked&,hbmUnChecked&) Menu-graphic ändern...
AppendMenu 104, -
AppendMenu 103, &terminate
CheckMenu 106, Show%
CheckMenu 102, Checkmerker%
Return @TrackMenu()
ENDPROC
Windowstyle 26 + 512
Window Title TrayIcon_Test
Window 0,0-640,480
@ShowWindow(%hWnd,0)
Hicon& = @create(hIcon,Profan)
hbmChecked& = Ico2SizedBmp(@create(hIcon, A),13,13)
hbmUnChecked& = Ico2SizedBmp(@create(hIcon, tree),13,13)
@TrayIcon(Add, %hWnd, 1, hIcon&, TrayIcon 11)
Whilenot end%
Waitinput
If @TrayIcon(Msg, 1) = $203 Double click left
end%=1
Elseif @TrayIcon(Msg, 1) = $204 right Mausbutton pressed
@SetActiveWindow(%hWnd)
Menue()
If (%MenuItem = 102)
Checkmerker% = @hardship(Checkmerker%) Zustandsänderung remember...
If Checkmerker% = 0
Hicon& = @create(hIcon, A)
@TrayIcon(SetIcon, %hWnd, 1, hIcon&)
Else
Hicon& = @create(hIcon, tree)
@TrayIcon(SetIcon, %hWnd, 1, hIcon&)
EndIf
Setmenuitem 0
ElseIf (%MenuItem = 101)
@Messagebox(program in XProfan 11,Info,64)
Setmenuitem 0
ElseIf (%MenuItem = 103)
end%=1
ElseIf (%MenuItem = 106)
Show% = @hardship(Show%)
@Showwindow(%hWnd,Show%)
Setmenuitem 0
EndIf
Endif
Endwhile
@TrayIcon(Delete, %hWnd, 1)
End
Greeting Roland |
|
|
| |
|
|