Horloges diverses

Soyez le premier à donner votre avis sur cette source.

Vue 4 706 fois - Téléchargée 443 fois

Description

Différentes façons d'afficher l'heure et la date en utilisant les procédures graphiques disponibles en assembleur.

Source / Exemple :


.586
.model flat,stdcall
option casemap:none

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

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

DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

;**********************************
;          MACROS
;**********************************
RGB MACRO red, green, blue
	xor eax, eax
	mov al, blue    ; blue
	rol eax, 8
	mov al, green   ; green
	rol eax, 8
	mov al, red     ; red
ENDM
    ; ---------------------
      literal MACRO quoted_text:VARARG
        LOCAL local_text
        .data
          local_text db quoted_text,0
        .code
        EXITM <local_text>
      ENDM
    ; --------------------------------
    ; string address in INVOKE format
    ; --------------------------------
      SADD MACRO quoted_text:VARARG
        EXITM <ADDR literalquoted_text)>
      ENDM
    ; --------------------------------
      m2m MACRO M1, M2
        push M2
        pop  M1
      ENDM    
;*********************************

.const

.data
DlgName db "MonDialog",0 

xTab0 POINT {100,100},{104,55},{100,40},{95,55},{100,100},{109,56},{106,40},{100,55},{100,100},{114,57},{113,41},{104,55},{100,100},{118,59},{119,43},{109,56}
      POINT {100,100},{123,62},{125,45},{114,57},{100,100},{126,64},{130,47},{118,59},{100,100},{130,67},{135,51},{123,62},{100,100},{133,70},{140,55},{126,64}
      POINT {100,100},{136,74},{144,59},{130,67},{100,100},{138,78},{149,65},{133,70},{100,100},{141,82},{153,69},{136,74},{100,100},{142,87},{155,75},{138,78}
      POINT {100,100},{143,92},{157,81},{141,82},{100,100},{144,96},{159,88},{142,87},{100,100},{145,100},{160,94},{143,92},{100,100},{144,105},{160,100},{144,96}
      POINT {100,100},{143,110},{160,107},{145,100},{100,100},{142,114},{158,113},{144,105},{100,100},{140,118},{157,119},{143,110},{100,100},{139,122},{155,125},{142,114}
      POINT {100,100},{136,126},{153,131},{140,118},{100,100},{133,130},{148,136},{139,122},{100,100},{129,133},{144,141},{136,126},{100,100},{126,136},{139,145},{133,130}
      POINT {100,100},{122,139},{135,150},{129,133},{100,100},{118,141},{131,153},{126,136},{100,100},{113,142},{125,155},{122,139},{100,100},{109,143},{119,157},{118,141}
      POINT {100,100},{104,144},{113,159},{113,142},{100,100},{100,144},{107,160},{109,143},{100,100},{95,144},{100,161},{104,144},{100,100},{91,144},{94,160},{100,144}
      POINT {100,100},{86,142},{87,159},{95,144},{100,100},{82,141},{81,157},{91,144},{100,100},{78,139},{76,155},{86,142},{100,100},{73,136},{69,152},{82,141}
      POINT {100,100},{70,133},{65,149},{78,139},{100,100},{67,130},{60,146},{73,136},{100,100},{64,127},{55,141},{70,133},{100,100},{61,122},{52,136},{67,130}
      POINT {100,100},{59,118},{48,131},{64,127},{100,100},{57,114},{45,125},{61,122},{100,100},{56,110},{43,119},{59,118},{100,100},{55,105},{42,113},{57,114}
      POINT {100,100},{55,100},{40,106},{56,110},{100,100},{55,95},{39,100},{55,105},{100,100},{56,91},{40,93},{55,100},{100,100},{57,86},{41,87},{55,95}
      POINT {100,100},{58,82},{42,81},{56,91},{100,100},{60,77},{45,75},{57,86},{100,100},{64,74},{46,68},{58,82},{100,100},{66,70},{51,64},{60,77}
      POINT {100,100},{70,67},{55,59},{64,74},{100,100},{73,63},{60,54},{66,70},{100,100},{77,61},{65,51},{70,67},{100,100},{81,59},{70,46},{73,63}
      POINT {100,100},{86,57},{75,45},{77,61},{100,100},{91,56},{81,43},{81,59},{100,100},{95,55},{87,41},{86,57},{100,100},{100,55},{94,40},{91,56}

xTab1 POINT {100,100},{95,89},{100,56},{105,89},{100,100},{97,88},{104,55},{106,89},{100,100},{98,88},{110,55},{107,89},{100,100},{100,87},{114,57},{108,90}
      POINT {100,100},{101,86},{118,59},{110,90},{100,100},{103,87},{122,61},{111,92},{100,100},{103,88},{126,64},{110,93},{100,100},{104,89},{130,67},{112,95}
      POINT {100,100},{106,89},{133,70},{113,95},{100,100},{107,90},{136,74},{112,97},{100,100},{108,90},{139,78},{113,98},{100,100},{110,91},{141,82},{113,99}
      POINT {100,100},{110,93},{143,87},{113,100},{100,100},{111,93},{144,92},{113,102},{100,100},{111,94},{145,96},{112,103},{100,100},{112,96},{145,100},{112,105}
      POINT {100,100},{113,97},{145,105},{112,107},{100,100},{114,98},{144,110},{111,108},{100,100},{113,99},{142,114},{110,108},{100,100},{112,101},{141,118},{108,109}
      POINT {100,100},{113,102},{139,122},{108,111},{100,100},{112,104},{136,126},{107,112},{100,100},{112,104},{133,130},{105,111},{100,100},{112,106},{130,133},{105,112}
      POINT {100,100},{110,106},{126,136},{103,112},{100,100},{110,108},{122,139},{102,113},{100,100},{108,109},{118,141},{100,113},{100,100},{108,110},{114,142},{99,113}
      POINT {100,100},{106,110},{109,144},{97,112},{100,100},{105,112},{104,144},{96,112},{100,100},{104,112},{100,144},{95,112},{100,100},{103,113},{95,144},{94,112}
      POINT {100,100},{102,113},{90,144},{93,111},{100,100},{100,112},{86,142},{92,110},{100,100},{99,113},{81,141},{91,109},{100,100},{98,112},{77,139},{90,108}
      POINT {100,100},{97,112},{73,136},{89,107},{100,100},{95,112},{70,134},{88,106},{100,100},{94,111},{67,130},{88,104},{100,100},{93,110},{64,126},{88,103}
      POINT {100,100},{92,110},{61,122},{87,102},{100,100},{91,109},{59,118},{87,101},{100,100},{90,108},{57,114},{87,99},{100,100},{89,107},{56,110},{87,98}
      POINT {100,100},{88,106},{55,105},{87,97},{100,100},{88,105},{55,100},{88,95},{100,100},{87,104},{55,95},{88,94},{100,100},{87,102},{56,91},{89,93}
      POINT {100,100},{87,101},{57,87},{90,92},{100,100},{86,100},{58,82},{90,91},{100,100},{87,98},{60,77},{92,90},{100,100},{86,96},{63,74},{92,88}
      POINT {100,100},{87,95},{66,70},{93,87},{100,100},{88,93},{70,67},{95,87},{100,100},{89,93},{73,63},{96,86},{100,100},{89,91},{77,61},{98,86}
      POINT {100,100},{91,90},{81,59},{100,86},{100,100},{92,89},{86,57},{101,86},{100,100},{93,88},{90,56},{102,86},{100,100},{94,89},{95,55},{103,87}

xTab db 100,106,113,119,125,131,136,141,145,150,154,156,158,160,161,161,161,159,158,156,154,149,145,140
     db 136,131,125,119,113,107,100,94,87,81,76,69,64,59,54,51,47,44,42,41,39,38,39,40,41,44,45,50,54,59
     db 64,69,75,81,87,94

yTab db 39,39,40,42,44,47,51,55,59,65,69,75,81,88,94,100,107,113,119,125,131,136,141,145,150,154,156,158
     db 160,161,162,161,160,158,156,153,149,146,141,136,131,125,119,113,106,100,93,87,81,75,68,64,59,54
     db 51,46,44,42,40,39,39

Tab1 dd (4)    

Cpt  db (32)
Cpt1 db (160)
Xs   dd (100)
Ys   dd (100)
forme db "HH:mm:ss",0
buffer db 20 dup (0)
format db "dddd dd MMMM yyyy",0
buff   db 27 dup (0)
TxtStatic db "STATIC",0

.data?
      hInstance   dd ?
      hdc         dd ? 
      hBrush      dd ?
      hPen        dd ? 
      hX          dd ?
      hY          dd ?         
      Xm          dd ?
      Ym          dd ?
      Syst SYSTEMTIME <?>
    .data  
        Ps PAINTSTRUCT <>        

.code
start:
	invoke GetModuleHandle, NULL
	mov    hInstance,eax
encore:       
	invoke DialogBoxParam, 0, ADDR DlgName,NULL,addr DlgProc,NULL
fin:       
  	invoke ExitProcess,eax

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
;LOCAL xTab[3] :BYTE

	.IF uMsg == WM_CLOSE
            invoke EndDialog,hWnd,NULL 

      .ELSEIF uMsg == WM_INITDIALOG
          invoke SetTimer,hWnd,15,1000,NULL
          invoke GetDateFormat,0,0,0,addr format,addr buff,27
          invoke CreateWindowEx,WS_EX_CLIENTEDGE,addr TxtStatic,addr buff,
                 SS_CENTER or WS_BORDER or WS_VISIBLE or WS_CHILD,14,262,174,27,hWnd,300,
                 hInstance,0
                       
      .ELSEIF uMsg==WM_PAINT      
          invoke BeginPaint,hWnd,addr Ps
          mov hdc,eax 
          invoke Arc,hdc,15,15,185,185,100,185,100,185
          invoke Ellipse,hdc,16,16,184,184
;****************************************
;*           dessin des chiffres
;****************************************
;                    I
;****************************************          
          invoke MoveToEx,hdc,138,36,0
          invoke LineTo,hdc,138,45
          invoke MoveToEx,hdc,139,36,0
          invoke LineTo,hdc,139,45
;****************************************
;                    II
;****************************************          
          invoke MoveToEx,hdc,160,61,0
          invoke LineTo,hdc,160,70
          invoke MoveToEx,hdc,161,61,0
          invoke LineTo,hdc,161,70
          invoke MoveToEx,hdc,163,61,0
          invoke LineTo,hdc,163,70
          invoke MoveToEx,hdc,164,61,0
          invoke LineTo,hdc,164,70 
;****************************************
;                    III
;****************************************          
          invoke MoveToEx,hdc,167,96,0
          invoke LineTo,hdc,167,105
          invoke MoveToEx,hdc,168,96,0
          invoke LineTo,hdc,168,105 
          invoke MoveToEx,hdc,170,96,0
          invoke LineTo,hdc,170,105
          invoke MoveToEx,hdc,171,96,0
          invoke LineTo,hdc,171,105
          invoke MoveToEx,hdc,173,96,0
          invoke LineTo,hdc,173,105
          invoke MoveToEx,hdc,174,96,0
          invoke LineTo,hdc,174,105          
;****************************************
;                    IV
;****************************************
          invoke MoveToEx,hdc,162,126,0
          invoke LineTo,hdc,162,135                                                                    
          invoke MoveToEx,hdc,163,126,0
          invoke LineTo,hdc,163,135
          invoke MoveToEx,hdc,165,126,0
          invoke LineTo,hdc,168,135
          invoke MoveToEx,hdc,166,126,0
          invoke LineTo,hdc,169,135
          invoke MoveToEx,hdc,171,126,0
          invoke LineTo,hdc,168,135
          invoke MoveToEx,hdc,172,126,0
          invoke LineTo,hdc,169,135
;****************************************
;                    V
;****************************************
          invoke MoveToEx,hdc,135,154,0
          invoke LineTo,hdc,138,163
          invoke MoveToEx,hdc,136,154,0
          invoke LineTo,hdc,139,163
          invoke MoveToEx,hdc,141,154,0
          invoke LineTo,hdc,138,163
          invoke MoveToEx,hdc,142,154,0
          invoke LineTo,hdc,139,163
;****************************************
;                    VI
;****************************************
          invoke MoveToEx,hdc,95,166,0
          invoke LineTo,hdc,98,175
          invoke MoveToEx,hdc,96,166,0
          invoke LineTo,hdc,99,175
          invoke MoveToEx,hdc,101,166,0
          invoke LineTo,hdc,98,175
          invoke MoveToEx,hdc,102,166,0
          invoke LineTo,hdc,99,175
          invoke MoveToEx,hdc,104,166,0
          invoke LineTo,hdc,104,175
          invoke MoveToEx,hdc,105,166,0
          invoke LineTo,hdc,105,175          
;****************************************
;                    VII
;****************************************
          invoke MoveToEx,hdc,60,158,0
          invoke LineTo,hdc,63,167
          invoke MoveToEx,hdc,61,158,0
          invoke LineTo,hdc,64,167
          invoke MoveToEx,hdc,66,158,0
          invoke LineTo,hdc,63,167
          invoke MoveToEx,hdc,67,158,0
          invoke LineTo,hdc,64,167
          invoke MoveToEx,hdc,69,158,0
          invoke LineTo,hdc,69,167
          invoke MoveToEx,hdc,70,158,0
          invoke LineTo,hdc,70,167
          invoke MoveToEx,hdc,72,158,0
          invoke LineTo,hdc,72,167
          invoke MoveToEx,hdc,73,158,0
          invoke LineTo,hdc,73,167
;****************************************
;                    VIII
;****************************************
          invoke MoveToEx,hdc,28,130,0
          invoke LineTo,hdc,31,139
          invoke MoveToEx,hdc,29,130,0
          invoke LineTo,hdc,32,139
          invoke MoveToEx,hdc,34,130,0
          invoke LineTo,hdc,31,139
          invoke MoveToEx,hdc,35,130,0
          invoke LineTo,hdc,32,139 
          invoke MoveToEx,hdc,37,130,0
          invoke LineTo,hdc,37,139
          invoke MoveToEx,hdc,38,130,0
          invoke LineTo,hdc,38,139
          invoke MoveToEx,hdc,39,130,0
          invoke LineTo,hdc,39,139
          invoke MoveToEx,hdc,40,130,0
          invoke LineTo,hdc,40,139                  
          invoke MoveToEx,hdc,41,130,0
          invoke LineTo,hdc,41,139
          invoke MoveToEx,hdc,42,130,0
          invoke LineTo,hdc,42,139          
;****************************************
;                    IX
;****************************************
          invoke MoveToEx,hdc,23,96,0
          invoke LineTo,hdc,23,105
          invoke MoveToEx,hdc,24,96,0
          invoke LineTo,hdc,24,105
          invoke MoveToEx,hdc,26,96,0
          invoke LineTo,hdc,32,105
          invoke MoveToEx,hdc,27,96,0
          invoke LineTo,hdc,33,105
          invoke MoveToEx,hdc,32,96,0
          invoke LineTo,hdc,26,105
          invoke MoveToEx,hdc,33,96,0
          invoke LineTo,hdc,27,105
;****************************************
;                    X
;****************************************
          invoke MoveToEx,hdc,31,63,0
          invoke LineTo,hdc,38,73
          invoke MoveToEx,hdc,32,63,0
          invoke LineTo,hdc,39,73
          invoke MoveToEx,hdc,37,63,0
          invoke LineTo,hdc,29,73
          invoke MoveToEx,hdc,38,63,0
          invoke LineTo,hdc,30,73  
;****************************************
;                    XI
;****************************************
          invoke MoveToEx,hdc,53,38,0
          invoke LineTo,hdc,57,45
          invoke MoveToEx,hdc,54,38,0
          invoke LineTo,hdc,58,48
          invoke MoveToEx,hdc,57,38,0
          invoke LineTo,hdc,53,48
          invoke MoveToEx,hdc,58,38,0
          invoke LineTo,hdc,54,48
          invoke MoveToEx,hdc,60,38,0
          invoke LineTo,hdc,60,48
          invoke MoveToEx,hdc,61,38,0
          invoke LineTo,hdc,61,48
;****************************************
;                    XII
;****************************************
          invoke MoveToEx,hdc,90,24,0
          invoke LineTo,hdc,95,34
          invoke MoveToEx,hdc,91,24,0
          invoke LineTo,hdc,96,34
          invoke MoveToEx,hdc,95,24,0
          invoke LineTo,hdc,90,34
          invoke MoveToEx,hdc,96,24,0
          invoke LineTo,hdc,91,34          
          invoke MoveToEx,hdc,99,24,0
          invoke LineTo,hdc,99,34
          invoke MoveToEx,hdc,100,24,0
          invoke LineTo,hdc,100,34
          invoke MoveToEx,hdc,103,24,0
          invoke LineTo,hdc,103,34
          invoke MoveToEx,hdc,104,24,0
          invoke LineTo,hdc,104,34
;****************************************
; Marquage des heures sur la périphérie                   
;****************************************                                     
          Invoke MoveToEx,hdc,100,35,0
          Invoke LineTo,hdc,100,40 
          Invoke MoveToEx,hdc,133,44,0
          Invoke LineTo,hdc,130,48
          Invoke MoveToEx,hdc,156,69,0
          Invoke LineTo,hdc,151,71
          Invoke MoveToEx,hdc,165,100,0
          Invoke LineTo,hdc,160,100
          Invoke MoveToEx,hdc,156,132,0
          Invoke LineTo,hdc,151,129
          Invoke MoveToEx,hdc,132,156,0
          Invoke LineTo,hdc,130,152
          Invoke MoveToEx,hdc,100,165,0
          Invoke LineTo,hdc,100,160
          Invoke MoveToEx,hdc,67,156,0
          Invoke LineTo,hdc,70,152
          Invoke MoveToEx,hdc,44,133,0
          Invoke LineTo,hdc,48,130
          Invoke MoveToEx,hdc,35,100,0
          Invoke LineTo,hdc,40,100
          Invoke MoveToEx,hdc,43,67,0
          Invoke LineTo,hdc,48,70
          Invoke MoveToEx,hdc,67,44,0
          Invoke LineTo,hdc,70,47
          call Minutes
          invoke GetLocalTime,addr Syst          
          call FaitSecondes
          call FaitMinutes
          call FaitHeures
;***********************************************
; Pas de EndPaint,sinon le mouvement est stoppé
;***********************************************
              
      .ELSEIF uMsg==WM_CTLCOLORSTATIC                                   
 

      .ELSEIF uMsg == WM_COMMAND
            mov eax,wParam                              
   

      .ELSEIF uMsg == WM_TIMER 
           invoke GetLocalTime,addr Syst                               
           call FaitMinutes
           call FaitHeures           
           call FaitSecondes
           invoke GetTimeFormat,LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT,NULL,addr forme,addr buffer,20
           invoke SetDlgItemText,hWnd,1002,addr buffer

	.ELSE
             mov eax,FALSE
		 ret
	.ENDIF
	mov eax,TRUE
	ret
DlgProc endp

;*****************************************
Minutes proc

    invoke MoveToEx,hdc,106,39,0
    invoke LineTo,hdc,106,40 
    invoke MoveToEx,hdc,113,40,0
    invoke LineTo,hdc,113,41
    invoke MoveToEx,hdc,119,42,0
    invoke LineTo,hdc,119,43 
    invoke MoveToEx,hdc,125,44,0
    invoke LineTo,hdc,125,46          
    invoke MoveToEx,hdc,136,51,0
    invoke LineTo,hdc,136,52 
    invoke MoveToEx,hdc,141,55,0
    invoke LineTo,hdc,141,56
    invoke MoveToEx,hdc,145,59,0
    invoke LineTo,hdc,145,60 
    invoke MoveToEx,hdc,150,65,0
    invoke LineTo,hdc,150,66
    invoke MoveToEx,hdc,156,75,0
    invoke LineTo,hdc,156,76 
    invoke MoveToEx,hdc,158,81,0
    invoke LineTo,hdc,158,82
    invoke MoveToEx,hdc,160,88,0
    invoke LineTo,hdc,160,89 
    invoke MoveToEx,hdc,161,94,0
    invoke LineTo,hdc,161,95          
    invoke MoveToEx,hdc,161,107,0
    invoke LineTo,hdc,161,108 
    invoke MoveToEx,hdc,159,113,0
    invoke LineTo,hdc,159,114
    invoke MoveToEx,hdc,158,119,0
    invoke LineTo,hdc,158,120 
    invoke MoveToEx,hdc,156,125,0
    invoke LineTo,hdc,156,126
    invoke MoveToEx,hdc,149,136,0
    invoke LineTo,hdc,149,137 
    invoke MoveToEx,hdc,145,141,0
    invoke LineTo,hdc,145,142
    invoke MoveToEx,hdc,140,145,0
    invoke LineTo,hdc,140,146 
    invoke MoveToEx,hdc,136,150,0
    invoke LineTo,hdc,136,151          
    invoke MoveToEx,hdc,125,156,0
    invoke LineTo,hdc,125,157 
    invoke MoveToEx,hdc,119,158,0
    invoke LineTo,hdc,119,159
    invoke MoveToEx,hdc,113,160,0
    invoke LineTo,hdc,113,161 
    invoke MoveToEx,hdc,107,161,0
    invoke LineTo,hdc,107,162
    invoke MoveToEx,hdc,94,161,0
    invoke LineTo,hdc,94,162 
    invoke MoveToEx,hdc,87,160,0
    invoke LineTo,hdc,87,161
    invoke MoveToEx,hdc,81,158,0
    invoke LineTo,hdc,81,159 
    invoke MoveToEx,hdc,76,156,0
    invoke LineTo,hdc,76,157          
    invoke MoveToEx,hdc,64,149,0
    invoke LineTo,hdc,64,150 
    invoke MoveToEx,hdc,59,146,0
    invoke LineTo,hdc,59,147
    invoke MoveToEx,hdc,54,141,0
    invoke LineTo,hdc,54,142 
    invoke MoveToEx,hdc,51,136,0
    invoke LineTo,hdc,51,137
    invoke MoveToEx,hdc,44,125,0
    invoke LineTo,hdc,44,126 
    invoke MoveToEx,hdc,42,119,0
    invoke LineTo,hdc,42,120
    invoke MoveToEx,hdc,41,113,0
    invoke LineTo,hdc,41,114 
    invoke MoveToEx,hdc,39,106,0
    invoke LineTo,hdc,39,107          
    invoke MoveToEx,hdc,39,93,0
    invoke LineTo,hdc,39,94 
    invoke MoveToEx,hdc,40,87,0
    invoke LineTo,hdc,40,88
    invoke MoveToEx,hdc,41,81,0
    invoke LineTo,hdc,41,82 
    invoke MoveToEx,hdc,44,75,0
    invoke LineTo,hdc,44,76
    invoke MoveToEx,hdc,50,64,0
    invoke LineTo,hdc,50,65 
    invoke MoveToEx,hdc,54,59,0
    invoke LineTo,hdc,54,60
    invoke MoveToEx,hdc,59,54,0
    invoke LineTo,hdc,59,55 
    invoke MoveToEx,hdc,64,51,0
    invoke LineTo,hdc,64,52          
    invoke MoveToEx,hdc,75,44,0
    invoke LineTo,hdc,75,45 
    invoke MoveToEx,hdc,81,42,0
    invoke LineTo,hdc,81,43
    invoke MoveToEx,hdc,87,40,0
    invoke LineTo,hdc,87,41 
    invoke MoveToEx,hdc,94,39,0
    invoke LineTo,hdc,94,40  
    ret
Minutes endp                 
;******************************************
FaitSecondes proc
                
                call EffaceSecondes
                movzx eax,Syst.wMinute
                inc eax               
                invoke CreatePen,0,1,000000FFh
                mov hPen,eax
                invoke SelectObject,hdc,hPen
                invoke MoveToEx,hdc,100,100,0                
                movzx eax,Syst.wSecond
                mov ebx,eax
                movzx eax,xTab[eax]
                movzx ebx,yTab[ebx]
                mov Xs,eax
                mov Ys,ebx 
                invoke LineTo,hdc,eax,ebx                                              
                invoke DeleteObject,hPen
                
               ret
FaitSecondes endp               
;******************************************
FaitMinutes proc

                call EffaceMinutes 
                invoke CreatePen,0,1,00FF0000h
                mov hPen,eax
                invoke SelectObject,hdc,hPen 
                invoke CreateSolidBrush,0000FF00h
                mov hBrush,eax
                invoke SelectObject,hdc,hBrush                                
                movzx eax,Syst.wMinute    
                mul [Cpt]
                lea esi,xTab0
                add esi,eax
                lea edi,Tab1
                mov Xm,esi
                mov Ym,edi                
                invoke PolyPolygon,hdc,esi,edi,1 ;;;;;;
                invoke DeleteObject,hPen
                invoke DeleteObject,hBrush
 
               ret
FaitMinutes endp               
;*******************************************
EffaceSecondes proc

                invoke CreatePen,0,1,00FFFFFFh;00D8E9ECh
                mov hPen,eax
                invoke SelectObject,hdc,hPen
                invoke MoveToEx,hdc,100,100,0
                invoke LineTo,hdc,Xs,Ys
                invoke DeleteObject,hPen
                ret
EffaceSecondes endp
                
;*******************************************
EffaceMinutes proc

                invoke CreatePen,0,1,00FFFFFFh;00D8E9ECh
                mov hPen,eax
                invoke SelectObject,hdc,hPen 
                invoke CreateSolidBrush,00FFFFFFh
                mov hBrush,eax
                invoke SelectObject,hdc,hBrush                             
                invoke PolyPolygon,hdc,Xm,Ym,1
                invoke DeleteObject,hPen
                invoke DeleteObject,hBrush
                ret
EffaceMinutes endp                
;*******************************************
               
;*******************************************
FaitHeures proc

                call EffaceHeures 
                invoke CreatePen,0,1,00FF0000h
                mov hPen,eax
                invoke SelectObject,hdc,hPen 
                invoke CreateSolidBrush,0000FF00h
                mov hBrush,eax
                invoke SelectObject,hdc,hBrush                                
                invoke GetLocalTime,addr Syst
                movzx eax,Syst.wHour
                cmp eax,13
                jb @F
                sub eax,12
@@:                
                mul Cpt1
                lea esi,xTab1
                add esi,eax
                lea edi,Tab1
                .if (Syst.wMinute > 47) 
                    add esi,128
                .elseif (Syst.wMinute > 35) && (Syst.wMinute < 48)
                    add esi,96
                .elseif (Syst.wMinute > 23) && (Syst.wMinute < 36)
                    add esi,64
                .elseif (Syst.wMinute > 11) && (Syst.wMinute < 24)
                    add esi,32
                .endif                                                                 
                mov hX,esi
                mov hY,edi                
                invoke PolyPolygon,hdc,esi,edi,1 
                invoke DeleteObject,hPen
                invoke DeleteObject,hBrush
 
               ret
FaitHeures endp               
;*******************************************
EffaceHeures  proc
                invoke CreatePen,0,1,00FFFFFFh
                mov hPen,eax
                invoke SelectObject,hdc,hPen 
                invoke CreateSolidBrush,00FFFFFFh
                mov hBrush,eax
                invoke SelectObject,hdc,hBrush                             
                invoke PolyPolygon,hdc,hX,hY,1
                invoke DeleteObject,hPen
                invoke DeleteObject,hBrush
                ret
EffaceHeures endp
;*******************************************
end start

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

#include "\masm32\include\resource.h"

IDI_ICON1  ICON   DISCARDABLE "\masm32\en_cours\icones\essai.ico" 

MonDialog DIALOGEX 90,15,50,65
STYLE   WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_GROUP
                       
CAPTION "  Date + heure ?"
FONT 24,"Monotype Corsiva",800,1

BEGIN

    EDITTEXT 1002,8,40,35,10,ES_LEFT | WS_BORDER | ES_WANTRETURN

END

Conclusion :


compilé en Masm32

Codes Sources

A voir également

Ajouter un commentaire Commentaires
Messages postés
2
Date d'inscription
samedi 30 octobre 2004
Statut
Membre
Dernière intervention
23 juin 2010

Encore merci pour touts ces précieux renseignements.Je suis impardonnable!.
Bien sûr, les instructions inc et add jouent sur le résultat des registres et ça je l'ai su....... il y a déjà bien longtemps!!la mémoire vous joue de ces tours avec l'age qui avance exonérablement.
Il va falloir que je me mette à reviser mes classiques sérieusement.
Messages postés
1466
Date d'inscription
vendredi 2 janvier 2004
Statut
Modérateur
Dernière intervention
14 février 2014
1
encore un petit plus:
Minute proc
mov edi,2
lea esi,xTab
push 0
push 0
push 0
push hdc
lp1:
mov al,[esi]
mov ah,[esi+(yTab-xTab)]
mov [esp+1*4],al
mov [esp+2*4],ah
call MoveToEx
add [esp+2*4],edi
call LineTo
cmp byte ptr [esi+(yTab-xTab)+1],-1
lea esi,[esi+1]
jne lp1
inc esi
dec edi
jne lp1
lea esp,[esp+4*4]
ret
Minute endp
Messages postés
1466
Date d'inscription
vendredi 2 janvier 2004
Statut
Modérateur
Dernière intervention
14 février 2014
1
xTab db 125,-1,100,106,113,119,125,131,136,141,94
yTab db 44,-1,39,39,40,42,47,51,55,59
endTab db -1

Minute proc
mov edi,2
lea esi,xTab
push 0
push 0
push 0
push hdc
lp1:
movzx eax,byte ptr[esi]
movzx edx,byte ptr[esi+(yTab-xTab)]
mov [esp+1*4],eax
mov [esp+2*4],edx
call MoveToEx
add [esp+2*4],edi
call LineTo
cmp byte ptr [esi+(xTab-xTab)+1],-1
lea esi,[esi+1]
jne lp1
inc esi
dec edi
jne lp1
lea esp,[esp+4*4]
ret
Minute endp

dans ce cas, tu traites d'abord les coordonnées avec 2 en ajout. au premier -1 rencontré on decremente edi qui traitera les coordonnées avec 1 en ajout des que edi devient 0, on quitte.
Messages postés
1466
Date d'inscription
vendredi 2 janvier 2004
Statut
Modérateur
Dernière intervention
14 février 2014
1
ceux de cette forme devront êtres prévus autrement: (mis après la première boucle)
400. invoke MoveToEx,hdc,125,44,0
401. invoke LineTo,hdc,125,46
Messages postés
1466
Date d'inscription
vendredi 2 janvier 2004
Statut
Modérateur
Dernière intervention
14 février 2014
1
re,


l'instruction inc modifie le zero du registre des flags, le jne lpt1 n'est donc pas correct.
lea edi,[edi+1] ira car l'instruction lea ne modifie pas le registre des flags:

xTab db 100,106,113,119,125,131,136,141,145,150,154,156,158,160,161,161,161,159,158,156,154,149,145,140,136,131,125,119,113,107,100,94,87,81,76,69,64,59,54,51,47,44,42,41,39,38,39,40,41,44,45,50,54,59,64,69,75,81,87,94
yTab db 39,39,40,42,44,47,51,55,59,65,69,75,81,88,94,100,107,113,119,125,131,136,141,145,150,154,156,158,160,161,162,161,160,158,156,153,149,146,141,136,131,125,119,113,106,100,93,87,81,75,68,64,59,54,51,46,44,42,40,39,39
endTab db -1


Minute proc
lea esi,xTab
push 0
push 0
push 0
push hdc
lp1:
movzx eax,byte ptr[esi]
movzx edx,byte ptr[esi+(yTab-xTab)]
mov [esp+1*4],eax
mov [esp+2*4],edx
call MoveToEx
inc dword ptr[esp+2*4]
call LineTo
cmp byte ptr [esi+(yTab-xTab)+1],-1
lea esi,[esi+1]
jne lp1
lea esp,[esp+4*4]
ret
Minute endp
Afficher les 7 commentaires

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.