Accueil > > > LISTER VOS FICHIER TEMPORAIRE DANS UNE LISTBOX MASM32
LISTER VOS FICHIER TEMPORAIRE DANS UNE LISTBOX MASM32
Information sur la source
Description
Bonjour a tous, Ce code Liste les fichiers temporaires dans une listbox. Pas le temps d'expliquer le fonctionnement,mais il suffit de jeter un coups d'oeil aux apis pour comprendre et a quelque bout de code simple! Bon coding!
Source
- .386
- .model flat, stdcall
- option casemap :none
-
- include \masm32\include\windows.inc
- include \masm32\include\gdi32.inc
- include \masm32\include\user32.inc
- include \masm32\include\kernel32.inc
-
- includelib \masm32\lib\gdi32.lib
- includelib \masm32\lib\user32.lib
- includelib \masm32\lib\kernel32.lib
-
-
- szText MACRO Name, Text:VARARG
- LOCAL lbl
- jmp lbl
- Name db Text,0
- lbl:
- ENDM
-
- m2m MACRO M1, M2
- push M2
- pop M1
- ENDM
-
- return MACRO arg
- mov eax, arg
- ret
- ENDM
-
- WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
- WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
- TopXY PROTO :DWORD,:DWORD
-
- .data
- szDisplayName db "Fichier Temporaire:",0
- CommandLine dd 0
- hWnd dd 0
- hInstance dd 0
- lpfnWndProc dd 0
- EnPlus db "*.*",0
-
- .DATA?
- CheminTemp db 256 dup(?)
- buffer2 db 256 dup(?)
- result WIN32_FIND_DATA <?>
- hdl dd ?
-
- .code
-
- start:
- invoke GetModuleHandle, NULL
- mov hInstance, eax
-
- invoke GetCommandLine
- mov CommandLine, eax
-
- invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
- invoke ExitProcess,eax
-
-
-
- WinMain proc hInst :DWORD,
- hPrevInst :DWORD,
- CmdLine :DWORD,
- CmdShow :DWORD
-
-
-
- LOCAL msg :MSG
- LOCAL Wwd :DWORD
- LOCAL Wht :DWORD
- LOCAL Wtx :DWORD
- LOCAL Wty :DWORD
-
- mov Wwd, 300
- mov Wht, 200
-
- invoke GetSystemMetrics,SM_CXSCREEN
- invoke TopXY,Wwd,eax
- mov Wtx, eax
-
- invoke GetSystemMetrics,SM_CYSCREEN
- invoke TopXY,Wht,eax
- mov Wty, eax
-
- szText szClassName,"LISTBOX"
-
- invoke CreateWindowEx,WS_EX_PALETTEWINDOW or WS_EX_CLIENTEDGE,
- ADDR szClassName,
- ADDR szDisplayName,
- WS_OVERLAPPEDWINDOW or WS_VSCROLL or LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or LBS_DISABLENOSCROLL, Wtx,Wty,Wwd,Wht,
- NULL,NULL,
- hInst,NULL
- mov hWnd,eax
-
- invoke SetWindowLong,hWnd,GWL_WNDPROC,ADDR WndProc
- mov lpfnWndProc, eax
-
- invoke GetStockObject,ANSI_FIXED_FONT
- invoke SendMessage,hWnd,WM_SETFONT,eax,0
-
- ;Trouve le repertoire des fichiers temporaires <-----------
-
- invoke GetTempPath,MAX_PATH,addr CheminTemp
-
- ;---------------------------------------------------------------
-
- Invoke lstrcat,addr CheminTemp,addr EnPlus
-
- invoke FindFirstFile, ADDR CheminTemp, ADDR result
- .IF eax!=INVALID_HANDLE_VALUE
- mov hdl, eax
-
- invoke SendMessage,hWnd,LB_ADDSTRING,0,ADDR result.cFileName
-
- le_loop:
- invoke FindNextFile, hdl, ADDR result
- cmp eax, 0
- je fini
- invoke SendMessage,hWnd,LB_ADDSTRING,0,ADDR result.cFileName
-
- jmp le_loop
- .ELSE
-
- .ENDIF
- fini:
- invoke FindClose, hdl
-
-
-
- invoke ShowWindow,hWnd,SW_SHOWNORMAL
- invoke UpdateWindow,hWnd
-
-
-
- StartLoop:
- invoke GetMessage,ADDR msg,NULL,0,0
- cmp eax, 0
- je ExitLoop
- invoke TranslateMessage, ADDR msg
- invoke DispatchMessage, ADDR msg
- jmp StartLoop
- ExitLoop:
-
- return msg.wParam
-
- WinMain endp
-
-
- WndProc proc hWin :DWORD,
- uMsg :DWORD,
- wParam :DWORD,
- lParam :DWORD
-
- .if uMsg == WM_CLOSE
-
- .elseif uMsg == WM_DESTROY
- invoke PostQuitMessage,NULL
- return 0
- .endif
-
- invoke CallWindowProc,lpfnWndProc,hWin,uMsg,wParam,lParam
-
- ret
-
- WndProc endp
-
-
- TopXY proc wDim:DWORD, sDim:DWORD
-
- shr sDim, 1
- shr wDim, 1
- mov eax, wDim
- sub sDim, eax
-
- return sDim
-
- TopXY endp
-
-
- end start
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
m2m MACRO M1, M2
push M2
pop M1
ENDM
return MACRO arg
mov eax, arg
ret
ENDM
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD
.data
szDisplayName db "Fichier Temporaire:",0
CommandLine dd 0
hWnd dd 0
hInstance dd 0
lpfnWndProc dd 0
EnPlus db "*.*",0
.DATA?
CheminTemp db 256 dup(?)
buffer2 db 256 dup(?)
result WIN32_FIND_DATA <?>
hdl dd ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD
LOCAL msg :MSG
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD
mov Wwd, 300
mov Wht, 200
invoke GetSystemMetrics,SM_CXSCREEN
invoke TopXY,Wwd,eax
mov Wtx, eax
invoke GetSystemMetrics,SM_CYSCREEN
invoke TopXY,Wht,eax
mov Wty, eax
szText szClassName,"LISTBOX"
invoke CreateWindowEx,WS_EX_PALETTEWINDOW or WS_EX_CLIENTEDGE,
ADDR szClassName,
ADDR szDisplayName,
WS_OVERLAPPEDWINDOW or WS_VSCROLL or LBS_HASSTRINGS or LBS_NOINTEGRALHEIGHT or LBS_DISABLENOSCROLL, Wtx,Wty,Wwd,Wht,
NULL,NULL,
hInst,NULL
mov hWnd,eax
invoke SetWindowLong,hWnd,GWL_WNDPROC,ADDR WndProc
mov lpfnWndProc, eax
invoke GetStockObject,ANSI_FIXED_FONT
invoke SendMessage,hWnd,WM_SETFONT,eax,0
;Trouve le repertoire des fichiers temporaires <-----------
invoke GetTempPath,MAX_PATH,addr CheminTemp
;---------------------------------------------------------------
Invoke lstrcat,addr CheminTemp,addr EnPlus
invoke FindFirstFile, ADDR CheminTemp, ADDR result
.IF eax!=INVALID_HANDLE_VALUE
mov hdl, eax
invoke SendMessage,hWnd,LB_ADDSTRING,0,ADDR result.cFileName
le_loop:
invoke FindNextFile, hdl, ADDR result
cmp eax, 0
je fini
invoke SendMessage,hWnd,LB_ADDSTRING,0,ADDR result.cFileName
jmp le_loop
.ELSE
.ENDIF
fini:
invoke FindClose, hdl
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
return msg.wParam
WinMain endp
WndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD
.if uMsg == WM_CLOSE
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
return 0
.endif
invoke CallWindowProc,lpfnWndProc,hWin,uMsg,wParam,lParam
ret
WndProc endp
TopXY proc wDim:DWORD, sDim:DWORD
shr sDim, 1
shr wDim, 1
mov eax, wDim
sub sDim, eax
return sDim
TopXY endp
end start
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...
GENERE UN NOM AU HAZARDGENERE UN NOM AU HAZARD Bonjour a tous!
Je me suis amusé un programmé une Procédure qui genere un nom au hazard!
invoke UnNom,10 <--- ici on genere un nom de 10lettre...
C...
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
|