当前位置:首页 > 网络编程 > 软件语言 > C语言 > C语言中嵌入汇编代码实现弹出对话框

C语言中嵌入汇编代码实现弹出对话框

点击次数:25 次 发布日期:2008-12-01 12:51:22 作者:源代码网
源代码网推荐     由于实际需要在C语言中嵌入汇编代码实现弹出对话框:
#include <windows.h>
#include <stdio.h>
char format[] = "%s %s\n";
char hello[] = "Hello";
char world[] = "world";
HWND hwnd;
void main( void )
{
   __asm
   {
        //push NULL
        //call dword ptr GetModuleHandle
        //mov hwnd,eax
        push MB_OK
      mov eax, offset world
      push eax
      mov eax, offset hello
      push eax
        push 0//说明此处不能将前面注释掉代码处得到的hwnd压栈,否则对话框弹不出来。
        call dword ptr MessageBox
   }
} 源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华