C語言中嵌入?yún)R編代碼實現(xiàn)彈出對話框

字號:

由于實際需要在C語言中嵌入?yún)R編代碼實現(xiàn)彈出對話框:
    #include
    #include
    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
     }
    }