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

1810阅读 0评论2013-05-30 szc982
分类:C/C++

  下面代码是在C语言中嵌入汇编代码实现弹出对话框:


点击(此处)折叠或打开

  1. #include <windows.h>
  2. #include <stdio.h>
  3. char format[] = "%s %sn";
  4. char hello[] = "Hello";
  5. char world[] = "world";
  6. HWND hwnd;
  7. void main( void )
  8. {
  9.    __asm
  10.    {
  11.         //push NULL
  12.         //call dword ptr GetModuleHandle
  13.         //mov hwnd,eax
  14.         push MB_OK
  15.       mov eax, offset world
  16.       push eax
  17.       mov eax, offset hello
  18.       push eax
  19.         push 0//说明此处不能将前面注释掉代码处得到的hwnd压栈,否则对话框弹不出来。
  20.         call dword ptr MessageBox
  21.    }
  22. }

上一篇:【原创】超精简VC6.0 + 破解小助手 + 使用小技巧
下一篇:Android APK反编译详解(附图)