Accueil > > > SCREENSHOT CAPTURE D'ECRAN
SCREENSHOT CAPTURE D'ECRAN
Information sur la source
Description
J'avais besoin d'un screenshot en asm J'ai eu beaucoup de mal a trouver des sources finalement j'ai adapter une source c++ en assembleur (MASM32)
Source
- .486
- .model flat,stdcall
- option casemap:none
-
- include \masm32\include\windows.inc
- include \masm32\include\user32.inc
- include \masm32\include\kernel32.inc
- include \masm32\include\gdi32.inc
- include \masm32\include\masm32.inc
-
- includelib \masm32\lib\user32.lib
- includelib \masm32\lib\kernel32.lib
- includelib \masm32\lib\gdi32.lib
- includelib \masm32\lib\masm32.lib
-
- .data
- bmpname db "c:\toto.bmp",0
-
- .data?
-
- hDC HDC ?
- hMemDC HDC ?
- hBits HANDLE ?
- hFile HANDLE ?
- hBitmap HBITMAP ?
- lpBits LPVOID ?
- dwWritten dd ? ;temp
- Pixel dd ?
- _Height DD ?
- _Width DD ?
- bmFH BITMAPFILEHEADER <>
- bih BITMAPINFOHEADER <>
-
- .code
- start:
- invoke GetDC,0
- mov hDC,eax
- invoke GetSystemMetrics,SM_CXSCREEN
- mov _Width,eax
- invoke GetSystemMetrics,SM_CYSCREEN
- mov _Height,eax
- invoke GetDeviceCaps,hDC, BITSPIXEL
- mov Pixel,eax
- invoke CreateCompatibleDC,hDC
- mov hMemDC,eax
- invoke CreateCompatibleBitmap,hDC, _Width, _Height
- mov hBitmap,eax
- mov ecx,sizeof BITMAPINFO
- mov ebx,sizeof RGBQUAD
- mov eax,256
- mul ebx
- add eax,ecx
- invoke GlobalAlloc,GHND,eax
- mov edx,eax
- invoke GlobalLock,edx
- mov esi,eax
- invoke SelectObject,hMemDC, hBitmap
- invoke BitBlt,hMemDC,0,0,_Width,_Height,hDC,0,0,SRCCOPY
- mov bih.biSize,sizeof BITMAPINFOHEADER
- push _Width
- pop bih.biWidth
- push _Height
- pop bih.biHeight
- mov bih.biPlanes,1
- mov eax,Pixel
- mov bih.biBitCount,ax
- mov bih.biCompression,0
- invoke GetDIBits,hDC, hBitmap, 0,_Height, NULL, esi, DIB_RGB_COLORS
- invoke GetDeviceCaps,hDC, SIZEPALETTE
- mov ebx,sizeof RGBQUAD
- mul ebx
- mov ebx,eax
- mov eax,_Width
- mul _Height
- mul Pixel
- shr eax,3
- mov edi,eax
- mov bmFH.bfType,4d42h
- mov eax,ebx
- add eax,sizeof BITMAPINFOHEADER
- add eax,sizeof BITMAPFILEHEADER
- mov bmFH.bfOffBits,eax
- mov eax,edi
- add eax,bmFH.bfOffBits
- mov bmFH.bfSize,eax
- mov bmFH.bfReserved1,0
- mov bmFH.bfReserved2,0
- invoke CreateFile,ADDR bmpname, GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL
- mov hFile,eax
- invoke WriteFile,hFile, addr bmFH, sizeof BITMAPFILEHEADER , ADDR dwWritten, NULL
- invoke WriteFile,hFile, addr bih, sizeof BITMAPINFOHEADER , ADDR dwWritten, NULL
-
- invoke GlobalAlloc,GHND, edi
- mov hBits,eax
- invoke GlobalLock,hBits
- mov lpBits,eax
- invoke GetDIBits,hDC, hBitmap, 0,_Height, lpBits, addr bih, DIB_RGB_COLORS
- invoke WriteFile,hFile,lpBits,edi,ADDR dwWritten,NULL
- invoke GlobalUnlock,hBits
- invoke GlobalFree,hBits
-
- invoke GlobalUnlock,esi
- invoke GlobalFree,edx
- invoke DeleteObject,hBitmap
- invoke DeleteDC,hMemDC
- invoke ReleaseDC,0,hDC
- invoke CloseHandle,hFile
- ret
-
- end start
.486
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\masm32.lib
.data
bmpname db "c:\toto.bmp",0
.data?
hDC HDC ?
hMemDC HDC ?
hBits HANDLE ?
hFile HANDLE ?
hBitmap HBITMAP ?
lpBits LPVOID ?
dwWritten dd ? ;temp
Pixel dd ?
_Height DD ?
_Width DD ?
bmFH BITMAPFILEHEADER <>
bih BITMAPINFOHEADER <>
.code
start:
invoke GetDC,0
mov hDC,eax
invoke GetSystemMetrics,SM_CXSCREEN
mov _Width,eax
invoke GetSystemMetrics,SM_CYSCREEN
mov _Height,eax
invoke GetDeviceCaps,hDC, BITSPIXEL
mov Pixel,eax
invoke CreateCompatibleDC,hDC
mov hMemDC,eax
invoke CreateCompatibleBitmap,hDC, _Width, _Height
mov hBitmap,eax
mov ecx,sizeof BITMAPINFO
mov ebx,sizeof RGBQUAD
mov eax,256
mul ebx
add eax,ecx
invoke GlobalAlloc,GHND,eax
mov edx,eax
invoke GlobalLock,edx
mov esi,eax
invoke SelectObject,hMemDC, hBitmap
invoke BitBlt,hMemDC,0,0,_Width,_Height,hDC,0,0,SRCCOPY
mov bih.biSize,sizeof BITMAPINFOHEADER
push _Width
pop bih.biWidth
push _Height
pop bih.biHeight
mov bih.biPlanes,1
mov eax,Pixel
mov bih.biBitCount,ax
mov bih.biCompression,0
invoke GetDIBits,hDC, hBitmap, 0,_Height, NULL, esi, DIB_RGB_COLORS
invoke GetDeviceCaps,hDC, SIZEPALETTE
mov ebx,sizeof RGBQUAD
mul ebx
mov ebx,eax
mov eax,_Width
mul _Height
mul Pixel
shr eax,3
mov edi,eax
mov bmFH.bfType,4d42h
mov eax,ebx
add eax,sizeof BITMAPINFOHEADER
add eax,sizeof BITMAPFILEHEADER
mov bmFH.bfOffBits,eax
mov eax,edi
add eax,bmFH.bfOffBits
mov bmFH.bfSize,eax
mov bmFH.bfReserved1,0
mov bmFH.bfReserved2,0
invoke CreateFile,ADDR bmpname, GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL
mov hFile,eax
invoke WriteFile,hFile, addr bmFH, sizeof BITMAPFILEHEADER , ADDR dwWritten, NULL
invoke WriteFile,hFile, addr bih, sizeof BITMAPINFOHEADER , ADDR dwWritten, NULL
invoke GlobalAlloc,GHND, edi
mov hBits,eax
invoke GlobalLock,hBits
mov lpBits,eax
invoke GetDIBits,hDC, hBitmap, 0,_Height, lpBits, addr bih, DIB_RGB_COLORS
invoke WriteFile,hFile,lpBits,edi,ADDR dwWritten,NULL
invoke GlobalUnlock,hBits
invoke GlobalFree,hBits
invoke GlobalUnlock,esi
invoke GlobalFree,edx
invoke DeleteObject,hBitmap
invoke DeleteDC,hMemDC
invoke ReleaseDC,0,hDC
invoke CloseHandle,hFile
ret
end start
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Lire un text tapée a l'ecran [ par balgrim ]
Bonjour, je voudrais savoir comment lire un texte taper a l'ecran style readln(string) en delphi ou reconniatre les touche taper au clavier sans devoi
ecran de veille [ par jlassi ]
k_jlassije veux realisé un ecran de veille avec l'ASM sur le bios (int 10h)
mode 13h [ par krater ]
RebonjourEnfait je voudrait remplacer une parti de l'ecran par un dessin fixée a l'avanceMon ecran etant un tableau[0;320*200] si je ne me trompe pas
aide sur fond d'ecran [ par knetus12 ]
comment faire un fond d'ecran sans que les divers edit passe en dessous. je l'ai fait avec VerticalTile et le bmp passe en premier plan...
Affichage texte (Debutant) [ par ffomnislash ]
BonjourJe debute en assembleur et je voudrais pouvoir afficher du texte en boucle, ceci j'y arrive sans pb mais le texte se rajouteAutrement dit j'ai
detection ecran [ par patatalo ]
salut,Toujours dans le cadre d'un boot 32 bits, je cherche un moyen de detecter la présence d'un écran afin de pouvoir rediriger les sortie video vers
fond d'ecran [ par sam20 ]
Salut a tous je cherche un bout de code asm pour changer le fond d'ecran de windows sans apiet ce possible? ou directement dans la memoire video.Merci
documentation sur le fonctionnement d'un ecran LCD [ par lost01 ]
Boujours, je viens demander ici de l'aide.En effet je recherche de la documentation sur le fonctionnement d'un ecran LCD ( non TV ) car je ne trouve p
SCREENSHOT PAR URL [ par celbcelbcelb ]
BONJOURJE SUIS TRES DEBUTANT EN LAGUAGE informatique et je voudrais apprendre a ecrire un petit prog qui prend une screenshot si lutilisateur est sur
PICBASIC PB3H et IR [ par jejer6 ]
je voudrais decoder le signal envoyé par mes telecommandes infrarouge.... je capte un signal (en utilisant un photodetecteur) mais je n'arrive pas a l
|
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
|