begin process at 2012 05 24 04:02:06
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Applications Windows

 > SPLASH SCREEN

SPLASH SCREEN


 Information sur la source

Note :
Aucune note
Catégorie :Applications Windows Niveau :Débutant Date de création :14/05/2005 Vu / téléchargé :5 004 / 361

Auteur : quoi

Ecrire un message privé
Commentaire sur cette source (1)
Ajouter un commentaire et/ou une note

 Description

exemple simple pour ajouter un splash screen à vos application

Source

  • .386
  • .model flat,stdcall
  • option casemap:none
  • include c:\masm32\include\windows.inc
  • include c:\masm32\include\kernel32.inc
  • include c:\masm32\include\user32.inc
  • include c:\masm32\include\gdi32.inc
  • includelib c:\masm32\lib\kernel32.lib
  • includelib c:\masm32\lib\user32.lib
  • includelib c:\masm32\lib\gdi32.lib
  • .CODE
  • include splash.hex
  • PROGRAMME:
  • ;////////////////////////////////
  • ;----------- CREE THREAD -------
  • ;////////////////////////////////
  • push 0
  • push 0
  • push 0
  • push offset WINSPLASH
  • push 0
  • push 0
  • call CreateThread
  • ;////////////////////////////////////////////
  • ;---------- FENETRE PRINCIPAL ---------------
  • ;////////////////////////////////////////////
  • push 200h
  • push GPTR
  • call GlobalAlloc
  • push eax ;arg GlobalFree
  • mov dword ptr [eax],WS_CAPTION or WS_SYSMENU or DS_CENTER
  • mov word ptr [eax+14],290
  • mov word ptr [eax+16],100
  • push 0
  • push offset DialogProc
  • push 0
  • push eax
  • push 400000h ;hinst
  • call DialogBoxIndirectParam
  • call GlobalFree
  • push 0
  • call ExitProcess
  • ;//////////////////////////////////////////////////
  • ;----------- PROC FENETRE PRINCIPAL --------------
  • ;//////////////////////////////////////////////////
  • DialogProc proc
  • mov eax,[esp+8]
  • cmp eax,WM_CLOSE
  • je WMCLOSE
  • jmp DLG
  • WMCLOSE: push 0
  • push [esp+8]
  • call EndDialog
  • DLG: xor eax,eax
  • ret 16
  • DialogProc endp
  • ;///////////////////////////////////////////
  • ;------------- FENETRE SPLASH --------------
  • ;///////////////////////////////////////////
  • WINSPLASH proc
  • push 512
  • push GPTR
  • call GlobalAlloc
  • push eax ;arg GlobalFree
  • mov dword ptr [eax],WS_POPUP or DS_CENTER
  • mov dword ptr [eax+4],WS_EX_TOPMOST or WS_EX_TOOLWINDOW
  • mov word ptr [eax+14],160
  • mov word ptr [eax+16],120
  • push 0
  • push offset DlgSplashProc
  • push 0
  • push eax
  • push 400000h ;hinst
  • call DialogBoxIndirectParam
  • call GlobalFree
  • ret
  • WINSPLASH endp
  • ;///////////////////////////////////////
  • ;--------- PROC FENETRE SPLASH --------
  • ;///////////////////////////////////////
  • DlgSplashProc proc
  • mov eax,[esp+8]
  • cmp eax,WM_ACTIVATEAPP
  • je WMACTIVAPP
  • cmp eax,WM_CLOSE
  • je WMCLOSE
  • push [esp+4]
  • call GetDC
  • mov edi,eax
  • lea esi,image
  • mov eax,esi
  • add eax,14
  • mov edx,esi
  • add edx,[esi+10]
  • push 00CC0020h ;copy
  • push 0 ;DIB_RGB_COLORS=0
  • push eax;bmp_header
  • push edx;bmp_pixels
  • push [esi+22] ;bmp height DIB source
  • push [esi+18] ;bmp width DIB source
  • push 0 ;y of source rectangle
  • push 0 ;x of source rectangle
  • push 240 ;bmp height rect destination
  • push 320 ;bmp width rect destination
  • push 0 ;y of destination rectangle
  • push 0 ;x of destination rectangle
  • push edi ;DC of da window
  • call StretchDIBits
  • jmp DLG
  • WMACTIVAPP: push 0
  • push 0
  • push [esp+12]
  • push offset TIMER
  • push 0
  • push 0
  • call CreateThread
  • jmp DLG
  • WMCLOSE: push 0
  • push [esp+8]
  • call EndDialog
  • DLG: xor eax,eax
  • ret 16
  • DlgSplashProc endp
  • ;/////////////////////////////////
  • ;-------------- TIMER ------------
  • ;/////////////////////////////////
  • TIMER proc
  • push 5000
  • call Sleep
  • push 0
  • push 0
  • push WM_CLOSE
  • push [esp+16]
  • call SendMessage
  • ret 4
  • TIMER endp
  • end PROGRAMME
.386
.model flat,stdcall
option casemap:none

include c:\masm32\include\windows.inc
include c:\masm32\include\kernel32.inc
include c:\masm32\include\user32.inc
include c:\masm32\include\gdi32.inc

includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\user32.lib
includelib c:\masm32\lib\gdi32.lib

.CODE
include splash.hex
PROGRAMME:
;////////////////////////////////
;----------- CREE THREAD ------- 
;////////////////////////////////
           push 0
           push 0
           push 0
           push offset WINSPLASH
           push 0
           push 0
           call CreateThread 
    
;////////////////////////////////////////////   
;---------- FENETRE PRINCIPAL ---------------
;////////////////////////////////////////////       
     
            push 200h
            push GPTR
            call GlobalAlloc 
            push eax  ;arg GlobalFree
            mov dword ptr [eax],WS_CAPTION or WS_SYSMENU or DS_CENTER
            mov word ptr  [eax+14],290
            mov word ptr  [eax+16],100
            push 0
            push offset DialogProc
            push 0
            push eax
            push 400000h ;hinst
            call DialogBoxIndirectParam 
            call GlobalFree
            push 0
            call ExitProcess 
      
;//////////////////////////////////////////////////
;-----------  PROC FENETRE PRINCIPAL --------------
;//////////////////////////////////////////////////
DialogProc proc
            mov  eax,[esp+8]
            cmp  eax,WM_CLOSE
            je   WMCLOSE
            jmp  DLG
WMCLOSE:    push 0
            push [esp+8]
            call EndDialog
DLG:        xor eax,eax
            ret 16
DialogProc endp
;///////////////////////////////////////////
;------------- FENETRE SPLASH --------------
;///////////////////////////////////////////
WINSPLASH proc
            push 512
            push GPTR
            call GlobalAlloc 
            push eax  ;arg GlobalFree
            mov dword ptr [eax],WS_POPUP or DS_CENTER
            mov dword ptr [eax+4],WS_EX_TOPMOST or WS_EX_TOOLWINDOW     
            mov word ptr  [eax+14],160
            mov word ptr  [eax+16],120
            push 0
            push offset DlgSplashProc
            push 0
            push eax
            push 400000h ;hinst
            call DialogBoxIndirectParam 
            call GlobalFree
            ret
WINSPLASH endp
;///////////////////////////////////////
;--------- PROC FENETRE SPLASH --------
;///////////////////////////////////////

DlgSplashProc proc

            mov  eax,[esp+8]
            cmp  eax,WM_ACTIVATEAPP
            je   WMACTIVAPP
            cmp  eax,WM_CLOSE
            je   WMCLOSE

            push [esp+4]
            call GetDC
            mov  edi,eax
    
            lea  esi,image
            mov  eax,esi
            add  eax,14
            mov  edx,esi
            add  edx,[esi+10]   

            push 00CC0020h		;copy
            push 0			;DIB_RGB_COLORS=0
            push eax;bmp_header
            push edx;bmp_pixels
            push [esi+22]	;bmp height DIB source
            push [esi+18]	;bmp width DIB source
            push 0			;y of source rectangle 
            push 0			;x of source rectangle
            push 240	;bmp height rect destination
            push 320	;bmp width rect destination
            push 0			;y of destination rectangle 
            push 0			;x of destination rectangle
            push edi	;DC of da window
            call StretchDIBits 
            jmp DLG
WMACTIVAPP: push 0
            push 0
            push [esp+12]
            push offset TIMER
            push 0
            push 0
            call CreateThread
            jmp  DLG
WMCLOSE:    push 0
            push [esp+8]
            call EndDialog 
DLG:        xor eax,eax
            ret 16
       
DlgSplashProc endp
;/////////////////////////////////
;-------------- TIMER ------------
;/////////////////////////////////
TIMER proc
     
            push 5000
            call Sleep
            push 0
            push 0
            push WM_CLOSE
            push [esp+16]
            call SendMessage
            ret 4 

TIMER endp
end PROGRAMME      

 Conclusion

Très simple on cree un thread qui cree la fenetre splash
et dans sa proc on cree un thread qui sert de timer
propre simple efficace comparer avec l'example dans masm.

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip TEXTURE AVEC DIRECTX9
Source avec Zip FLOATTOHEX CODE DE BRUNEWS RETRENSCRIS EN ASM PAR MOI
Source avec Zip Source avec une capture PATCH TOUT EXE 32BITS POUR Y INSERER UNE IMAGE (GIF ,JPG,BMP...
Source avec Zip EXTRACTICONES
Source avec Zip DUMP HEXADECIMAL

 Sources de la même categorie

Source avec Zip Source avec une capture DUMPER HEXADÉCIMAL par BLUEBIBUBBLE
Source avec Zip AFFICHAGE PIXEL EN ASM X86\VESA SOUS XP par wqaxs36
Source avec Zip LA COMMUNICATION ENTRE PROGRAMMES PAR ECHANGES DE MESSAGES par ToutEnMasm
Source avec Zip EDITEUR AVEC RICHEDIT ET OLE (POUR LES PHOTOS..) par ToutEnMasm
Source avec Zip METTRE UN BOUTON DANS UN CONTROLE EDIT par ToutEnMasm

Commentaires et avis

Commentaire de silkscalp le 01/09/2005 05:21:47

Interressant et sympa. J'aime bien les idée de source que tu proposes. Parfois le code est mal documenté. D'ailleurs, vu qu'apparemment tu ne connnais pas les prototypes des API (copie de fichier, un vir decompilé) plus accessibles (mais ien sur moin complet, ce dit trop d'ionfo tue l'info) tu as  à ta disposition win32.hlp qui est excellent concernant les API et leur utilisation en ASM. Il decrit chaque API, chacun des arguments (par exemple, avec tu sais que le push 0 de ta MessageBox correspond au handle de la fenêtre appelante),il donne d'autre API du même groupe, explique les constantes. Si l'anglais ne te rebute pas c'est parfais pour l'utilisation des API.
Je te dis ca car je vois que tu as ecrit beaucoup de source en ASM et c'est bien. Perso je n'ai jamais rien envoyé car je suis plus sur la sécurité logicielle asm :))
Mais comme je fais de plus en plus d'asm je vais envoyer + de truc.
++ et bon apprentissage perpetuel ...
silk

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
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

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 3,962 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales