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
SQL SERVER : PHP ET SQL SERVERSQL SERVER : PHP ET SQL SERVER par christian
Juste une petite synthèse sur les possibilités de connecter une application PHP sur un serveur SQL Server. Non pas que je me sois reconverti en développeur PHP, mais je constate qu'actuellement il est très difficile dans un environnement PHP et partic...
Cliquez pour lire la suite de l'article par christian [TECHDAYS 2010] WINDOWS AZURE APPFABRIC (CLO305)[TECHDAYS 2010] WINDOWS AZURE APPFABRIC (CLO305) par NeuroCypher
Les webcasts sont désormais en ligne, je me décide donc à écrire ce post. J'ai encore eu la chance d'animer une session aux TechDays cette année. Le sujet : le même que l'année dernière, ou plutôt son évolution. En effet, l'année dernière la couche de com...
Cliquez pour lire la suite de l'article par NeuroCypher OUTILS D'IMPORT AVEC MISE à JOUR DANS MICROSOFT DYNAMICS CRMOUTILS D'IMPORT AVEC MISE à JOUR DANS MICROSOFT DYNAMICS CRM par bianca
Problématique
Si vous avez besoin d'exporter sous Excel une liste de comptes ou de contacts dans le but de faire des retouches à droite à gauche puis de réinjecter le tout dans CRM, vous ne pouvez pas vous en...
Cliquez pour lire la suite de l'article par bianca SQL SERVER : DéVELOPPER UN ADDON POUR SQL SERVER MANAGEMENT STUDIO (SSMS)SQL SERVER : DéVELOPPER UN ADDON POUR SQL SERVER MANAGEMENT STUDIO (SSMS) par christian
Pour celles et ceux qui aiment SQL Server et on l'âme de développeur (ou sont tout simplement développeur) et veulent étendre les fonctionnalités de SQL Server, voici un article qui devrait pouvoir un intéresser.
Certes ce dernier est écrit sur u...
Cliquez pour lire la suite de l'article par christian EDITEUR XAML DE VISUAL STUDIO: COMMENT ALIGNER LES ATTRIBUTS LES UNS EN DESSOUS DES AUTRES AUTOMATIQUEMENTEDITEUR XAML DE VISUAL STUDIO: COMMENT ALIGNER LES ATTRIBUTS LES UNS EN DESSOUS DES AUTRES AUTOMATIQUEMENT par Miiitch
Lorsque l'on écrit du XAML, les tags XML peuvent vraiment devenir très longs et pas pratique à lire: Il y a une option vraiment pratique dans l'éditeur de Visual Studio qui va nous permettre de réorganiser tout cela en mettant les attributs XAML les uns e...
Cliquez pour lire la suite de l'article par Miiitch
Logiciels
Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods Konvertor (4.00)KONVERTOR (4.00)Le logiciel est un gestionnaire multimedia affichant, jouant et convertissant plus de 2000 format... Cliquez pour télécharger Konvertor
|