我的编译时出现
inline assembler syntax error in 'opcode'; found 'xxxx'
的错误

解决方案 »

  1.   

    我不知道呀,能告诉我怎么在VC里用ASM调用API函数吗?
      

  2.   

    先找到API的地址先再把参数先传进去!
    如:
    ::SendMessage(NULL, 0, 0, 0);
    写成
    004FE777   mov         esi,esp
    004FE779   push        0
    004FE77B   push        0
    004FE77D   push        0
    004FE77F   push        0
    004FE781   call        dword ptr 00cb8364
    004FE787   cmp         esi,esp
    004FE789   call        __chkesp (007c8500)
    写成
      

  3.   

    你那个是宏汇编,内嵌汇编是不支持宏的。
    注意:用fz_zhou(vcfan) 的方法是不正确的,因为API函数是从DLL里导入的,导入地址在装载DLL的时候由引入函数表确定,在编译前是不确定的。直接call这个函数名就可以了。
    _asm{
    push 0
    push 0
    push 0
    push 0
    call SendMessage
    }
      

  4.   

    还有,将函数定义为全局的,否则_asm不认识