C语言中嵌入汇编代码实现弹出对话框
出处: 作者: 日期:2007年11月26日 15时11分
由于实际需要在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
}
}
最后更新时间:2008-05-28 12:26:43