szdialogname db '对话框模板',0 ;这类定义中 不能用dd
刚才终于把子窗口搞出来了 Makefile文件是这样写的
NAME = FirstWindowDLL = gongneng
ML_FLAG = /c /coffLINK_FLAG = /subsystem:windowsDLL_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 retInstallHook 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