子窗口成功搞出

szdialogname db '对话框模板',0                ;这类定义中 不能用dd

 

 

刚才终于把子窗口搞出来了  Makefile文件是这样写的

NAME = FirstWindow
DLL = gongneng

 

ML_FLAG = /c /coff
LINK_FLAG = /subsystem:windows
DLL_LINK_FLAG = /subsystem:windows /Dll /section:.bss,S

$(DLL).dll $(NAME).exe:

gongneng.dll:gongneng.def gongneng.obj
 Link  $(DLL_LINK_FLAG) /Def:gongneng.def /Dll gongneng.obj

$(NAME).exe: $(NAME).obj gongneng.res
 Link  $(LINK_FLAG) $(NAME).obj gongneng.res

.asm.obj:
 ml $(ML_FLAG) $<
.rc.res:
 rc gongneng.rc

clean:
 del *.obj
 del *.res
 del *.exp
 del *.lib

 

动态链接库里这样写

InstallHook proc _hWnd,_dwMessage,_hWinMain
  
  push _hWnd
  pop hWnd
  push _dwMessage
  pop dwMessage
  push _hWinMain
  pop hWinMain

  
  invoke FindWindow,NULL,addr szwgtitle
  .if eax   
  mov hwggame,eax
  invoke GetWindowThreadProcessId,hwggame,addr szdwProcessId
  mov szdwProcessId,eax
  ;invoke OpenProcess,PROCESS_ALL_ACCESS,FALSE,szdwProcessId
  ;mov hProcess,eax
  ;invoke VirtualAllocEx,hProcess,NULL,3000h,MEM_COMMIT | MEM_RESERVE,PAGE_EXECUTE_READWRITE

  invoke SetWindowsHookEx,WH_KEYBOARD,addr HookProc,hInstance,szdwProcessId
  mov hHook,eax
  
   
   invoke GetModuleHandle,NULL
   mov hInstance1,eax

   
  
   invoke CreateDialogParam,hInstance1,DLG_MAIN,hWinMain,addr _ProcDlgMain,NULL      

   mov hDlg,eax
   
   invoke MessageBox,NULL,addr szwgtitle,addr szwgtitle,MB_OK
   
   invoke ShowWindow,hDlg,SW_SHOWNORMAL
   
   
  
      


  .endif
 ret
InstallHook endp

 

一定要自建窗口过程 对话框窗口比较讨厌 必须写完全

_ProcDlgMain proc uses ebx edi esi hWnd1,wMsg,wParam,lParam
  mov eax,wMsg
  .if eax == WM_CLOSE
   invoke EndDialog,hWnd,NULL
  .elseif eax == WM_COMMAND
   mov eax,wParam
   .if ax == IDOK  ;这个if语句可以没有 但没有其他任何一个程序将不显示子窗口
    invoke EndDialog,hWnd1,NULL
   .endif
  .else
  
   mov eax,FALSE
   ret
  .endif
  mov eax,TRUE
  ret
 ret
_ProcDlgMain endp

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值