闪烁程序求思路
我想用汇编编一个能然字符闪烁的程序,但是我无奈了,好久都没什么思路,大家有什么好想法,给我说一说,不胜感激!谢谢
目标明确么
什么环境的汇编啊 假设是16位汇编的 去查中断或书上的相应章节 有实现方法
合适的关键字搜索 可以找到实例代码
学而不思则罔 思而不学则殆 空想是想不出来的
[ 本帖最后由 zklhp 于 2012-4-17 14:17 编辑 ]
.386 .model flat, stdcall option casemap:none include windows.inc include user32.inc include kernel32.inc include gdi32.inc includelib user32.lib includelib kernel32.lib includelib gdi32.lib DlgProc proto :HWND, :UINT, :WPARAM, :LPARAM .data hInst dd ? szString db 'hello world', 0 flag dd ? col dw ? .const DLG_DEMO equ 101 .code start: invoke GetModuleHandle, NULL mov hInst, eax invoke DialogBoxParam, hInst, DLG_DEMO, NULL, addr DlgProc, NULL invoke ExitProcess, NULL ;------------------------------------------ DlgProc proc hwnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM local ps:PAINTSTRUCT local hdc:HDC mov eax, uMsg .if eax == WM_TIMER not flag xor eax, eax .if flag == TRUE mov dword ptr eax, 00ff0000h .else mov dword ptr eax, 00ffffffh .endif mov dword ptr col, eax invoke InvalidateRect, hwnd, NULL, TRUE .elseif eax == WM_PAINT invoke BeginPaint, hwnd, addr ps mov hdc, eax invoke SetBkMode, hdc, TRANSPARENT invoke SetTextColor, hdc, col invoke lstrlen, offset szString invoke TextOut, hdc, 10, 10, offset szString, eax invoke EndPaint, hwnd, addr ps .elseif eax == WM_INITDIALOG mov flag, TRUE .elseif eax == WM_CLOSE invoke EndDialog, hwnd, 0 .elseif eax == WM_COMMAND mov eax, wParam .if al == 102 invoke SetTimer, hwnd, 1, 100, NULL .elseif al == 103 invoke KillTimer, hwnd, 1 .endif .else mov eax, FALSE ret .endif mov eax, FALSE ret DlgProc endp ;------------------------------------------ end start
#define DLG_DEMO 101 #define IDC_BTN1 102 #define IDC_BTN2 103 DLG_DEMO DIALOGEX 6,6,194,106 CAPTION "Demo" FONT 8,"MS Sans Serif" STYLE 0x10CF0800 EXSTYLE 0x00000000 BEGIN PUSHBUTTON "Start",IDC_BTN1,80,80,50,15,NOT 0x00820000|0x50010000,0x00000000 PUSHBUTTON "End",IDC_BTN2,140,80,50,15,NOT 0x00820000|0x50010000,0x00000000 END
EXE = Demo.exe OBJS = Demo.obj RES = Demo.res LINK_FLAG = /subsystem:windows ML_FLAG = /c /coff $(EXE): $(OBJS) $(RES) link $(LINK_FLAG) /out:$(EXE) $(OBJS) $(RES) .asm.obj: ml $(ML_FLAG) $< .rc.res: rc $< clean: del *.obj del *.res
@echo off set path=%path%;d:\radasm\masm32\bin set include=d:\radasm\masm32\include set lib=d:\radasm\masm32\lib nmake makefile.txt pause del *.obj del *.res