void main()
{
DWORD error;
char szBuf[1024];
_asm
{
mov  ah, 16h
mov  al, 8Eh
mov  di, seg szBuf
mov  es, di
mov  di, offset szBuf
mov  cx, 1024
mov  dx, 3
int  2Fh
cmp  ax, 1
je   error
}
}

解决方案 »

  1.   

    int 2f/ax=168E/dx=3
    Windows95, get virtual machine title
    这个服务是16位的。不知道里边是如何做,假如是stosb,那你可以
    lea edi, szBuf试试,es不改。
    我是98,试了试,编译通过,但是死掉了。
      

  2.   

    再请问诸位大侠 #include <windows.h>void main()
    {
    char lpCaption[] = "Caption";
    char lpText[] = "Text";
    __asm
    {
    mov eax, MB_OK
    push eax
    mov eax, dword ptr [lpCaption]
    push eax
    mov eax, dword ptr [lpText]
    push eax
    mov eax, NULL
    push eax
    call MessageBox   ; 这句出错
    pop ebx
    pop ebx
    pop ebx
    }
    }编译通过了为什么运行出错?
    我有20000多可用分,重谢帮助我的人!!
      

  3.   

    将DWORD error;
    char szBuf[1024];
    定义成全局试试
      

  4.   

    楼上的,很感谢,在主题里的问题我已经放弃了,因为错误实在太多,也没法解决。现在就是这个问题:#include <windows.h>void main()
    {
    char lpCaption[] = "Caption";
    char lpText[] = "Text";
    __asm
    {
    mov eax, MB_OK
    push eax
    mov eax, dword ptr [lpCaption]
    push eax
    mov eax, dword ptr [lpText]
    push eax
    mov eax, NULL
    push eax
    call MessageBox   ; 这句出错
    pop ebx
    pop ebx
    pop ebx
    }
    }编译通过了为什么运行出错?
      

  5.   

    有错
    mov eax, dword ptr [lpCaption]
    这句意思是把lpCaption开头的4字节给eax,不是地址。同样还有:
    mov eax, dword ptr [lpText]改为
    lea eax, lpCaption
    lea eax, lpText
      

  6.   

    还有错给你个能转的:#include <windows.h>void main()
    {
    char lpCaption[] = "Caption";
    char lpText[] = "Text";
    __asm
    {
    mov eax, MB_OK
    push eax
    // mov eax, dword ptr [lpCaption]
    lea ax, lpCaption
    push eax
    // mov eax, dword ptr [lpText]
    lea ax, lpCaption
    push eax
    mov eax, NULL
    push eax
    // call MessageBox   ; 这句出错
    call dword ptr MessageBox
    // pop ebx
    // pop ebx
    // pop ebx
    //不用,MessageBox恢复栈指针。况且三个pop对应四个push?
    }
    }
      

  7.   

    写错了,lea eax, lpCaption
    第二个lea ax, lpCaption应该是lea eax, lpText
      

  8.   

    非常感谢!!请ndy_w(carpe diem) 来http://expert.csdn.net/Expert/topic/1744/1744786.xml?temp=.4250757
    接分!
      

  9.   

    //
    // 好象从这段代码看不出你想做点啥
    //  把seg 也改成OFFSET 就可以编译通过了
    //  di(es at last) would hold the low-part of the addr
    //
    void main()
    {
      // var should be modified 
      static DWORD error;
      static char szBuf[1024];  error = 888;
      strcpy (szBuf, "ee2ee");
      _asm
      {
        mov  ah, 16h
        mov  al, 8Eh
        mov  EDI,OFFSET szBuf
        mov  es, di
        mov  EDI,offset szBuf
        mov  cx, 1024
        mov  dx, 3
        int  2Fh
        cmp  ax, 1
        je   SHORT error
      }
    }