注册 登录
编程论坛 汇编论坛

CreateWindowEx()函数怎么用啊!

明的空间 发布于 2015-01-01 23:21, 4433 次点击
最好是使用参数举几个例子
3 回复
#2
GoldenSpider2015-01-01 23:53
新年快乐。
程序代码:
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;
Fasm AlphaWin.asm
;
简单的窗体透明示例  by G-Spider
;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;
使用下列命令进行编译:
;
fasm AlphaWin.asm AlphaWin.exe
;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include 'win32a.inc'
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

format PE GUI 4.0
entry start

section '.text' code readable writeable executable
  start:
     invoke GetModuleHandle,0
     mov [wc.hInstance],eax
     ;客户区使用黒色画刷
     invoke GetStockObject,BLACK_BRUSH
     mov [wc.hbrBackground],eax
     invoke RegisterClass,wc
     test eax,eax
     jz end_loop
     ;图层样式窗体WS_EX_LAYERED
     invoke CreateWindowEx,WS_EX_LAYERED,szClass,szTitle,\
            WS_VISIBLE+WS_SYSMENU,\
            100,100,600,400,NULL,NULL,[wc.hInstance],NULL
     test eax,eax
     jz end_loop
     ;黒色设为全透明色,其他颜色的透明度设为200 (范围:0~255).
     invoke SetLayeredWindowAttributes,eax,0,200,LWA_ALPHA + LWA_COLORKEY

  msg_loop:
     invoke GetMessage,msg,NULL,0,0
     or eax,eax
     jz end_loop
     invoke TranslateMessage,msg
     invoke DispatchMessage,msg
     jmp msg_loop

  end_loop:
     invoke ExitProcess,[msg.wParam]

proc WindowProc uses ebx esi edi, hwnd,umsg,wparam,lparam
     cmp [umsg],WM_DESTROY
     je .wmdestroy

  .defwndproc:
     invoke DefWindowProc,[hwnd],[umsg],[wparam],[lparam]
     jmp .finish

  .wmdestroy:
     invoke PostQuitMessage,0
     xor eax,eax
  .finish:
     ret

endp
;---------------------------------------------------------------------
;
    code is data
;
---------------------------------------------------------------------
     msg     MSG
     szClass TCHAR 'FASMWIN32',0
     szTitle TCHAR 'Alpha windows',0
     wc      WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,\
             COLOR_WINDOW + 1,NULL,szClass
;---------------------------------------------------------------------
section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',\
     user32,'USER32.DLL',\
     gdi32,'GDI32.DLL'

     include 'api\kernel32.inc'
     include 'api\user32.inc'
     include 'api\gdi32.inc'


只有本站会员才能查看附件,请 登录

#3
Evesd2015-03-07 19:04
#4
xzlxzlxzl2015-03-07 21:36
景仰!汇编调api
1