Accueil > > > FENETRE FERMÉ MASM32
FENETRE FERMÉ MASM32
Information sur la source
Description
Bonjour a tous! Mon prog s'occupe par l'intermediare d'un timer de fermer une fenetre bien precise a l'aide de findwindow et de sendmessage. En faisant un clique droit ca fait un beep a l'aide de l'api: "Invoke GetAsyncKeyState, 2" C'est le bonus du programme!!! :) Bref Simple... Bonne prog!
Source
- .386
- .model flat,stdcall
- option casemap:none
- include \masm32\include\windows.inc
- include \masm32\include\user32.inc
- includelib \masm32\lib\user32.lib
- include \masm32\include\kernel32.inc
- includelib \masm32\lib\kernel32.lib
- include \masm32\include\rand.inc
- WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
-
- .DATA
- ClassName db "SimpleWinClass",0
- AppName db "Our First Window",0
- shell db "Gestionnaire des tâches de Windows",0
- Handle dd ?
- Liste dd ?
- .DATA?
- Buffer db 32 dup (?)
-
- hInstance HINSTANCE ?
- CommandLine LPSTR ?
- .CODE
- start:
- INVOKE GetTickCount
- INVOKE Randomize,eax
- invoke GetModuleHandle, NULL
-
- mov hInstance,eax
- invoke GetCommandLine
- ;
- mov CommandLine,eax
- invoke WinMain, hInstance,NULL,CommandLine, 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
- mov wc.lpfnWndProc, OFFSET WndProc
- mov wc.cbClsExtra,NULL
- mov wc.cbWndExtra,NULL
- push hInstance
- pop wc.hInstance
- mov wc.hbrBackground,COLOR_WINDOW+1
- mov wc.lpszMenuName,NULL
- mov wc.lpszClassName,OFFSET ClassName
- invoke LoadIcon,NULL,IDI_APPLICATION
- mov wc.hIcon,eax
- mov wc.hIconSm,eax
- invoke LoadCursor,NULL,IDC_ARROW
- mov wc.hCursor,eax
- invoke RegisterClassEx, addr wc
- invoke CreateWindowEx,NULL, ADDR ClassName, ADDR AppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL
- aaa
-
- .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
-
- Invoke SetTimer,hWnd,0,4, 0
-
-
- .if uMsg == WM_TIMER
- invoke FindWindow,0,addr shell
- mov Handle,eax
- .if eax != 0
-
-
- invoke SendMessage,Handle,WM_CLOSE,0,0
-
-
-
-
-
-
- .endif
-
-
-
-
- Invoke GetAsyncKeyState, 2
- .if eax != 0
- invoke Beep,200,50
- .endif
-
- .endif
-
- invoke DefWindowProc,hWnd,uMsg,wParam,lParam
-
-
- ret
-
-
- WndProc endp
-
- end start
-
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\rand.inc
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
.DATA
ClassName db "SimpleWinClass",0
AppName db "Our First Window",0
shell db "Gestionnaire des tâches de Windows",0
Handle dd ?
Liste dd ?
.DATA?
Buffer db 32 dup (?)
hInstance HINSTANCE ?
CommandLine LPSTR ?
.CODE
start:
INVOKE GetTickCount
INVOKE Randomize,eax
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
;
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, 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
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx,NULL, ADDR ClassName, ADDR AppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL
aaa
.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
Invoke SetTimer,hWnd,0,4, 0
.if uMsg == WM_TIMER
invoke FindWindow,0,addr shell
mov Handle,eax
.if eax != 0
invoke SendMessage,Handle,WM_CLOSE,0,0
.endif
Invoke GetAsyncKeyState, 2
.if eax != 0
invoke Beep,200,50
.endif
.endif
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
WndProc endp
end start
Conclusion
Faite gaffe...ici on ferme le Gestionnaire des tâches de Windows!
Sources du même auteur
COSINUS D'UN ANGLE EN DEGRÉS MASM32COSINUS D'UN ANGLE EN DEGRÉS MASM32 Bonjour ,tous est dans le titre!
le programme execute ca:
Tmp=120
st(0)=Cos(Tmp*Pi/180)
Tmp=st(0)
c'est tellement évident.
...
TEXTBOX,BOUTON,TIMER MASM32TEXTBOX,BOUTON,TIMER MASM32 Bonjour a tous, ce code permet de voir,comment on peut gerer un evenement,
lorsque l'on appuie sur un bouton.
En clair, parce que la... Vous saissis...
AFFICHER UNE CHAINE DE CARACTERE MASM32AFFICHER UNE CHAINE DE CARACTERE MASM32 Bonjour a tous!
Ce petit bout de code affiche betement l'alphabet.
Pour les debutants,vous allez voir comment on manipulent les variables.
C'est un...
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
[FRAMEWORK 4] LES TASKS ET LE THREAD UI[FRAMEWORK 4] LES TASKS ET LE THREAD UI par fathi
Je viens de passer quelques temps au TechDay's et j'ai pu voir pas mal de session intéressante. Par contre une chose m'a un peu étonné lors de certaines de ces sessions qui abordaient les améliorations du framework .NET (donc le 4.5) : en gros, bea...
Cliquez pour lire la suite de l'article par fathi WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson TECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PCTECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PC par ROMELARD Fabrice
Speakers: Thierry Rapatout, Antoine Petit et Xavier Trebbia Cette session entre dans le cadre des RDV Décideurs des TechDays 2012, elle est liée à la consumérisation de l'IT et la mise en place du "DeskTop as a Service" dans de plus en ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLETECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLE par ROMELARD Fabrice
Speakers: Julien Marechal, Gautier Confiant, Sébastien MEYER La session débute par le positionnement de la solution System Center par rapport aux concepts d'organisation ITIL. Le portail du catalogue de se...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : PLEINIèRE SECOND JOURTECHDAYS PARIS 2012 : PLEINIèRE SECOND JOUR par ROMELARD Fabrice
Après une première journée dédiée aux développeurs, cette seconde journée est dédiée au monde des entreprises et de ses applications. Ainsi, cette pleinière est dédiée à faire un 360 de l'évolution des applications Business aux demandes ac...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|