C语言中嵌入汇编代码实现弹出对话框 |
|
www.nanhushi.com 佚名 不详 |
由于实际需要在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 } }
|
|
|
文章录入:杜斌 责任编辑:杜斌 |
|
上一篇文章: 用itoa()函数将整数转换为字符串 下一篇文章: VC下Debug和Release区别 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|