Click here to Skip to main content
15,885,244 members
Articles / Programming Languages / ASM

MASM ImageFader

Rate me:
Please Sign up or sign in to vote.
3.89/5 (15 votes)
19 Jan 2013CPOL1 min read 68.9K   679   26  
An Image fader application. This hides information behinde an image and fades it out onMouseOver to display the content behind the image. Useful for hiding something, or as a stylish accessory.
; ���������������������������������������������������������������������������
;
;	Filename:		GUIFadeImage.asm
;	Version			1.0
;	Date/Author:	10.09.2005, dave (juniorsoft)
;	Description:	Source File for the GUI of the FadeImage - Test  
;					application. This small app demonstrates how to
;					integrate the FadeImageCtrl into your applications.
;
; 					You can use, modify and copy this source file to fit your 
;					needs, it's Freeware/OpenSource.
;
; ���������������������������������������������������������������������������

      .486                      ; create 32 bit code
      .model flat, stdcall      ; 32 bit memory model
      option casemap :none      ; case sensitive

      include GUIFadeImage.inc     ; local includes for this file
.code

WinMain					proc n1:DWORD,n2:DWORD,n3:DWORD,n4:DWORD
		jmp start
	Ret
WinMain EndP

start:

	invoke GetModuleHandle, NULL
	mov    hInstance,eax
	invoke LoadIcon,hInstance, IDI_ICON    ; icon ID
    mov hIcon, eax   
    invoke RegisterFadeImage
	invoke DialogBoxParam, hInstance, addr sDlgName,NULL,addr DlgProc,NULL
	invoke ExitProcess,0
	
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
;	Procedure:		DlgProc
;	Parameter:		hWnd, uMsg, wParam, lParam (def. DlgProc parameter)
;	Version:		1.0
;	Date/Author:	10.09.2005, dave (juniorsoft)
;	Description:	Dialog Message-Handler. We must implement this function.
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DlgProc proc hWnd2:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
	.IF uMsg==WM_INITDIALOG
		mov eax, hWnd2	
		mov hWndDlg, eax
   		invoke SendMessage, hWndDlg, WM_SETICON, NULL, hIcon
   		invoke SetWindowText,hWndDlg, addr sAppTitle
   		;
   		invoke FillInfos
   		;
		invoke CreateFadeImage,hWndDlg,IDB_MAINBMP,5,5
		;
	.ELSEIF uMsg==WM_CLOSE
		invoke SendMessage,hWnd2,WM_COMMAND,IDM_EXIT,0
	.elseif uMsg==WM_DESTROY 
  		invoke DeleteObject,hBitmap 
  		invoke PostQuitMessage,NULL
	.ELSEIF uMsg==WM_COMMAND
		mov eax,wParam
		.IF lParam==0
			.IF ax==IDM_EXIT
				invoke EndDialog, hWnd2,NULL
			.ENDIF
		.ELSE
			mov edx,wParam
			shr edx,16
			.if dx==BN_CLICKED
				.IF ax==IDC_EXIT
					invoke SendMessage,hWnd2,WM_COMMAND,IDM_EXIT,0
				.ELSEIF ax==IDC_FADEOUT
					invoke FadeOut
				.ELSEIF ax==IDC_FADEIN
					invoke FadeIn
				.ENDIF
			.ENDIF
		.ENDIF
	.ELSE
		mov eax,FALSE
		ret
	.ENDIF
	mov eax,TRUE
	ret
DlgProc endp


; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
;	Procedure:		FillInfos
;	Parameter:		(none)
;	Version:		1.0
;	Date/Author:	10.09.2005, dave (juniorsoft)
;	Description:	Load infos from config.inc to lables behind FadeImage
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FillInfos proc
	invoke GetDlgItem,hWndDlg,IDC_LBLCOMPANY
	invoke SetWindowText,eax, addr sCompany
	invoke GetDlgItem,hWndDlg,IDC_LBLPRODUCT
	invoke SetWindowText,eax, addr sProduct
	invoke GetDlgItem,hWndDlg,IDC_LBLVERSION
	invoke SetWindowText,eax, addr sVersion
	Ret
FillInfos EndP

end start
; ���������������������������������������������������������������������������

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Switzerland Switzerland
programmer and software junkie since 1991 zurich switzerland

Comments and Discussions