鱼C论坛

 找回密码
 立即注册
查看: 4345|回复: 2

新手求解 错误代码A2206 A2114

[复制链接]
发表于 2014-4-21 17:50:15 | 显示全部楼层 |阅读模式
10鱼币
.386
.model flat,stdcall
option casemap:none

include  windows.inc
include  gdi32.inc
includelib gdi32.lib
include  user32.inc
includelib user32.lib
include  kernel32.inc
includelib kernel32.lib
include  shell32.inc
includelib shell32.lib
IDM_MAIN equ 0x4000
IDA_MAIN equ 0x4200
IDM_CLOSE equ 0x4201
.data?
hInstance dd ?
hWinMain dd ?
hMenu  dd ?
szBuffer dd 512 dup(?)
.const
szClassName db 'MyClass',0
szCaptionMain db '接受程序',0
szReceive db 'receive说 接受到WM_SETTEXT消息',0dh,0ah
  db 'receive说param的内容是%08x',0dh,0ah
  db 'receive说 指向的字符串是"%s"',0dh,0ah,0
szButton db 'button',0
szButtonText db '点击此处打开qq',0
szOpen  db 'open',0
szURL  db '"D:\Program Files\Tencent\qq\Bin\QQ.exe"'
szCaption db '菜单选择',0
szFormat db '你选择了菜单命令:%08x',0
.code
;窗口过程
_ProcWinMain proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
mov eax,uMsg
.if eax==WM_CLOSE
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,NULL
.elseif eax==WM_SETTEXT
invoke wsprintf,addr szBuffer,addr szReceive,lParam,lParam
invoke MessageBox,hWnd,offset szBuffer,addr szCaptionMain,MB_OK
.elseif eax==WM_COMMAND
mov eax,wParam
.if ax==IDOK
invoke ShellExecute,NULL,offset szOpen,offset szURL,NULL,NULL,SW_SHOWNORMAL
.endif
.elseif eax==WM_CREATE
invoke CreateWindowEx,NULL,offset szButton,offset szButtonText,WS_CHILD or WS_VISIBLE,10,10,200,50,hWnd,1,hInstance,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
_ProcWinMain endp

_WinMain proc

local @stWndClass:WNDCLASSEX
local @stMsg:MSG
local @hAccelerator

invoke GetModuleHandle,NULL
mov hInstance,eax
invoke LoadMenu,hInstance,IDM_MAIN
mov hMenu,eax
invoke LoadAccelerators,hInstance,IDA_MAIN
mov @hAccelerator,eax
invoke RtlZeroMemory,addr @stWndClass,sizeof @stWndClass
;注册窗口类
invoke LoadCursor,0,IDC_ARROW
mov @stWndClass.hCursor,eax
push hInstance
pop @stWndClass.hInstance
mov @stWndClass.cbSize,sizeof WNDCLASSEX
mov @stWndClass.style,CS_HREDRAW or CS_VREDRAW
mov @stWndClass.lpfnWndProc,offset _ProcWinMain
mov @stWndClass.hbrBackground,COLOR_WINDOW+1
mov @stWndClass.lpszClassName,offset szClassName
invoke RegisterClassEx,addr @stWndClass
;建立并显示窗口
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szCaptionMain,\
WS_OVERLAPPEDWINDOW,\
100,100,600,400,\
NULL,hMenu,hInstance,NULL
mov hWinMain,eax
invoke ShowWindow,hWinMain,SW_SHOWNORMAL
invoke UpdateWindow,hWinMain
;消息循环
.while TRUE
invoke  GetMessage,addr @stMsg,NULL,0,0
.break .if eax==0
invoke TranslateMessage,addr @stMsg
invoke DispatchMessage,addr @stMsg
.endw
ret
_WinMain endp
start:   
      call _WinMain   
      invoke ExitProcess,NULL   
end start

  
前面是asm主程序
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"

#define IDM_MAIN 0x4000
#define IDA_MAIN 0x4200
//
// Menu resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDM_MAIN MENU
{
    POPUP "文件"
    {
        MENUITEM "关闭(x)...", IDM_CLOSE
    }
}

//
// Accelerator resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDA_MAIN ACCELERATORS
{
    VK_F1,         IDM_CLOSE, VIRTKEY
}
这个是资源文件
为什么nmake的时候显示 error A2206: missing operator in expression
和 error A2114: INVOKE argument type mismatch : argument : 2
错误对应的是invoke LoadMenu,hInstance,IDM_MAIN  函数
新手求解

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2014-4-24 21:09:50 | 显示全部楼层
IDM_MAIN equ 0x4000
IDA_MAIN equ 0x4200
IDM_CLOSE equ 0x4201

汇编下应该是 IDM_MAIN EQU 4000H 而不是0x4000
资源文件里好像没定义IDM_CLOSE
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2015-8-8 10:46:33 | 显示全部楼层
:big
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-19 00:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表