Archive for 4月 12th, 2012

  1. Hello, Win32 API(GUI) World!

    Posted on 4月 12th, 2012 by cx20

    Win32 API(GUI)

    Win32 API は、Windows の機能にアクセスする為の API(Application Programming Interface)である。

    ソースコード

    #include <windows.h>
    #include <tchar.h>
     
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
    {
        MessageBox( NULL, _T("Hello, Win32 API(GUI) World!"), _T("Hello, World!"), MB_OK );
        return 0;
    }

    コンパイル方法(Visual C++)

    C:¥> cl hello.c /link user32.lib /SUBSYSTEM:WINDOWS

    実行結果

    ---------------------------
    Hello, World!
    ---------------------------
    Hello, Win32 API(GUI) World!
    ---------------------------
    OK   
    ---------------------------