Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

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

Commentaires et avis

Aucun commentaire pour le moment.

Ajouter un commentaire

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


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,468 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.