Accueil > > > ICONE SYSTRAY [MASM] (ICONE PERSONNALISABLE)
ICONE SYSTRAY [MASM] (ICONE PERSONNALISABLE)
Information sur la source
Description
permet de creer une icone pres de l'heure sur la barre des taches :) - le fichier .RC : ;debut #include "resource.h" #define IDC_STATIC -1 1000 ICON "votre_icone.ico" ;fin - le fichier .bat ( pour compiller tout ca ) REM DEBUT "c:\masm32\bin\ml" /c /coff /Cp /I"c:\masm32\include" /I"c:\masm32\units" /Fo"icone.obj" "icone.asm" "c:\masm32\bin\rc" /i"c:\masm32\include" /fo"icone.res" "icone.rc" "c:\masm32\bin\link" /SUBSYSTEM:WINDOWS /LIBPATH:"c:\masm32\lib" /OUT:"icone.exe" "icone.obj" "icone.res" REM FIN - et le fichier .asm
Source
- .386
- .model flat,stdcall
- option casemap:none
- include \masm32\include\windows.inc
- include \masm32\include\user32.inc
- include \masm32\include\kernel32.inc
- include \masm32\include\shell32.inc
- includelib \masm32\lib\user32.lib
- includelib \masm32\lib\kernel32.lib
- includelib \masm32\lib\shell32.lib
-
- WM_SHELLNOTIFY equ WM_USER+5
- IDI_TRAY equ 0
- IDM_RESTORE equ 1000
- IDM_EXIT equ 1010
- WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
-
- .data
- ClassName db "TrayCendraClass",0
- AppName db "Icone en systray",0
- RestoreString db "Restaurer",0
- ExitString db "Quitter",0
-
- .data?
- hInstance dd ?
- note NOTIFYICONDATA <>
- hPopupMenu dd ?
-
- .code
- start:
- invoke GetModuleHandle, NULL
- mov hInstance,eax
- invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT
- invoke ExitProcess,eax
-
- WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
- LOCAL wc:WNDCLASSEX
- LOCAL msg:MSG
- LOCAL hwnd:HWND
- mov wc.cbSize,SIZEOF WNDCLASSEX
- mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
- mov wc.lpfnWndProc, OFFSET WndProc
- mov wc.cbClsExtra,NULL
- mov wc.cbWndExtra,NULL
- push hInst
- pop wc.hInstance
- mov wc.hbrBackground,COLOR_APPWORKSPACE
- mov wc.lpszMenuName,NULL
- mov wc.lpszClassName,OFFSET ClassName
- invoke LoadIcon,hInstance,1000
- mov wc.hIcon,eax
- mov wc.hIconSm,eax
- invoke LoadCursor,NULL,IDC_ARROW
- mov wc.hCursor,eax
- invoke RegisterClassEx, addr wc
- invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR AppName,\
- WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE,CW_USEDEFAULT,\
- CW_USEDEFAULT,350,200,NULL,NULL,\
- hInst,NULL
- mov hwnd,eax
- .while TRUE
- invoke GetMessage, ADDR msg,NULL,0,0
- .BREAK .IF (!eax)
- invoke TranslateMessage, ADDR msg
- invoke DispatchMessage, ADDR msg
- .endw
- mov eax,msg.wParam
- ret
- WinMain endp
-
- WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
- LOCAL pt:POINT
- LOCAL rect:RECT
- .if uMsg==WM_CREATE
- invoke CreatePopupMenu
- mov hPopupMenu,eax
- invoke AppendMenu,hPopupMenu,MF_STRING,IDM_RESTORE,addr RestoreString
- invoke AppendMenu,hPopupMenu,MF_STRING,IDM_EXIT,addr ExitString
- .elseif uMsg==WM_DESTROY
- invoke DestroyMenu,hPopupMenu
- invoke PostQuitMessage,NULL
- .elseif uMsg==WM_SIZE
- .if wParam==SIZE_MINIMIZED
- mov note.cbSize,sizeof NOTIFYICONDATA
- push hWnd
- pop note.hwnd
- mov note.uID,IDI_TRAY
- mov note.uFlags,NIF_ICON+NIF_MESSAGE+NIF_TIP
- mov note.uCallbackMessage,WM_SHELLNOTIFY
- invoke LoadIcon,hInstance,1000
- mov note.hIcon,eax
- invoke lstrcpy,addr note.szTip,addr AppName
- invoke ShowWindow,hWnd,SW_HIDE
- invoke Shell_NotifyIcon,NIM_ADD,addr note
- .endif
- .elseif uMsg==WM_COMMAND
- .if lParam==0
- invoke Shell_NotifyIcon,NIM_DELETE,addr note
- mov eax,wParam
- .if ax==IDM_RESTORE
- invoke ShowWindow,hWnd,SW_RESTORE
- .else
- invoke DestroyWindow,hWnd
- .endif
- .endif
- .elseif uMsg==WM_SHELLNOTIFY
- .if wParam==IDI_TRAY
- .if lParam==WM_RBUTTONDOWN
- invoke GetCursorPos,addr pt
- invoke SetForegroundWindow,hWnd
- invoke TrackPopupMenu,hPopupMenu,TPM_RIGHTALIGN or TPM_RIGHTBUTTON,pt.x,pt.y,NULL,hWnd,NULL
- invoke PostMessage,hWnd,WM_NULL,0,0
- .elseif lParam==WM_LBUTTONDBLCLK
- invoke SendMessage,hWnd,WM_COMMAND,IDM_RESTORE,0
- .endif
- .endif
- .else
- invoke DefWindowProc,hWnd,uMsg,wParam,lParam
- ret
- .endif
- xor eax,eax
- ret
- WndProc endp
-
- end start
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
WM_SHELLNOTIFY equ WM_USER+5
IDI_TRAY equ 0
IDM_RESTORE equ 1000
IDM_EXIT equ 1010
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
.data
ClassName db "TrayCendraClass",0
AppName db "Icone en systray",0
RestoreString db "Restaurer",0
ExitString db "Quitter",0
.data?
hInstance dd ?
note NOTIFYICONDATA <>
hPopupMenu dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke WinMain, hInstance,NULL,NULL, SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_APPWORKSPACE
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,hInstance,1000
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR AppName,\
WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE,CW_USEDEFAULT,\
CW_USEDEFAULT,350,200,NULL,NULL,\
hInst,NULL
mov hwnd,eax
.while TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.endw
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL pt:POINT
LOCAL rect:RECT
.if uMsg==WM_CREATE
invoke CreatePopupMenu
mov hPopupMenu,eax
invoke AppendMenu,hPopupMenu,MF_STRING,IDM_RESTORE,addr RestoreString
invoke AppendMenu,hPopupMenu,MF_STRING,IDM_EXIT,addr ExitString
.elseif uMsg==WM_DESTROY
invoke DestroyMenu,hPopupMenu
invoke PostQuitMessage,NULL
.elseif uMsg==WM_SIZE
.if wParam==SIZE_MINIMIZED
mov note.cbSize,sizeof NOTIFYICONDATA
push hWnd
pop note.hwnd
mov note.uID,IDI_TRAY
mov note.uFlags,NIF_ICON+NIF_MESSAGE+NIF_TIP
mov note.uCallbackMessage,WM_SHELLNOTIFY
invoke LoadIcon,hInstance,1000
mov note.hIcon,eax
invoke lstrcpy,addr note.szTip,addr AppName
invoke ShowWindow,hWnd,SW_HIDE
invoke Shell_NotifyIcon,NIM_ADD,addr note
.endif
.elseif uMsg==WM_COMMAND
.if lParam==0
invoke Shell_NotifyIcon,NIM_DELETE,addr note
mov eax,wParam
.if ax==IDM_RESTORE
invoke ShowWindow,hWnd,SW_RESTORE
.else
invoke DestroyWindow,hWnd
.endif
.endif
.elseif uMsg==WM_SHELLNOTIFY
.if wParam==IDI_TRAY
.if lParam==WM_RBUTTONDOWN
invoke GetCursorPos,addr pt
invoke SetForegroundWindow,hWnd
invoke TrackPopupMenu,hPopupMenu,TPM_RIGHTALIGN or TPM_RIGHTBUTTON,pt.x,pt.y,NULL,hWnd,NULL
invoke PostMessage,hWnd,WM_NULL,0,0
.elseif lParam==WM_LBUTTONDBLCLK
invoke SendMessage,hWnd,WM_COMMAND,IDM_RESTORE,0
.endif
.endif
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
end start
Conclusion
voila , j'espere que ca vous plaira ;)
Cendra
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
WP7 5K BELGIUM CHALLENGEWP7 5K BELGIUM CHALLENGE par junarnoalg
Microsoft Belgique a le plaisir de vous annoncer le lancement du
Challenge Windows Phone 7
. Celui-ci se déroule du 12 juillet au 30 novembre 2010 et vous donne l'opportunit...
Cliquez pour lire la suite de l'article par junarnoalg LES MONADES POUR LES NULSLES MONADES POUR LES NULS par mdufourneaudravel
Avec l'annonce de F#, je me suis intéressé de plus en plus à la programmation fonctionnelle, je suis donc rapidement tombé sur les " monades ", mais malgré la lecture de plusieurs articles, j'étais resté perméable à leur concept. C'est désormais fini, grâ...
Cliquez pour lire la suite de l'article par mdufourneaudravel [WP7] AJOUTER DES IMAGES DANS LA MEDIA LIBRARY D'UN WINDOWS PHONE 7[WP7] AJOUTER DES IMAGES DANS LA MEDIA LIBRARY D'UN WINDOWS PHONE 7 par Audrey
L'émulateur Windows Phone 7, fourni avec la version Beta des outils développeurs n'inclut aucune image dans sa bibliothèque. Pas très pratique de tester son application lorsque l'on souhaite que l'utilisateur puisse choisir une image présente dans le télé...
Cliquez pour lire la suite de l'article par Audrey VIVE LES MOCKS ET LES POCOSVIVE LES MOCKS ET LES POCOS par vLabz
J'observe régulièrement autour de moi de la confusion à propos de ces deux termes et j'aimerais juste rappeler ce qu'ils signifient. Je ne suis bien sûr pas le mieux placé pour faire une leçon mais je vais faire de mon mieux pour mettre en valeur ce q...
Cliquez pour lire la suite de l'article par vLabz [WF4] WORKFLOW AND CUSTOM ACTIVITIES - BEST PRACTICES (4/5)[WF4] WORKFLOW AND CUSTOM ACTIVITIES - BEST PRACTICES (4/5) par JeremyJeanson
Vendredi dernier Microsoft a publié le quatrième épisode des bonnes pratiques pour coder ses activités custom dans WF4 : endpoint.tv - Workflow and Custom Activities - Best Practices (Part 4) . Tout comme pour les précédents épisodes, j'ai pris le temps d...
Cliquez pour lire la suite de l'article par JeremyJeanson
Logiciels
Crystal Report (11)CRYSTAL REPORT (11)Crystal Reports est un outil de reporting souple et puissant, vous pouvez très facilement consult... Cliquez pour télécharger Crystal Report Academy System (12.0.2.0)ACADEMY SYSTEM (12.0.2.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft iPod Vidéo Convertisseur 6 (6.0.3.0419)XILISOFT IPOD VIDéO CONVERTISSEUR 6 (6.0.3.0419)Xilisoft iPod Vidéo Convertisseur est un outil puissant de conversion d'iPod, facile à utiliser. ... Cliquez pour télécharger Xilisoft iPod Vidéo Convertisseur 6 Xilisoft iPhone Vidéo Convertisseur 6 (6.0.3.0419)XILISOFT IPHONE VIDéO CONVERTISSEUR 6 (6.0.3.0419)Xilisoft iPhone Vidéo Convertisseur est le meilleur logiciel de conversion iPhone qui peut facile... Cliquez pour télécharger Xilisoft iPhone Vidéo Convertisseur 6 Xilisoft iPad Vidéo Convertisseur 6 (6.0.3.0419)XILISOFT IPAD VIDéO CONVERTISSEUR 6 (6.0.3.0419)Il s'agit d'un logiciel polyvalent pour convertir les formats vidéo/audio populaires en formats p... Cliquez pour télécharger Xilisoft iPad Vidéo Convertisseur 6
|