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
[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Arnault Nouvel et Antoine Dongois Le processus à prendre : Apprendre (découvrir la plateforme) Préparer (documenter l'historique et choisir la méthode de MAJ) Test (Test de MAJ) Implémenter (Effectuer la MAJ) Valid...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOURTECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOUR par ROMELARD Fabrice
Après un retour sur l'histoire des TechDays de Paris et le fait que ce soit le plus gros event MS au monde (du fait de sa gratuité), le président de MS France (Eric Boustoullier) a fait une présentation de la vision Microsoft pour les années à venir...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
RE : PIC 16F84RE : PIC 16F84 par pont
Cliquez pour lire la suite par pont RE : PIC 16F84RE : PIC 16F84 par belounis
Cliquez pour lire la suite par belounis RE : PIC 16F84RE : PIC 16F84 par pont
Cliquez pour lire la suite par pont
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|