Archive for 4月 11th, 2012
-
Hello, Win32 API(CUI) World!
Posted on 4月 11th, 2012 by cx20
Win32 API(CUI)
Win32 API は、Windows の機能にアクセスする為の API(Application Programming Interface)である。
ソースコード
#include <windows.h> #include <tchar.h> int _tmain( int argc, TCHAR* argv[] ) { HANDLE hStdOutput; DWORD dwSize; TCHAR szBuf[256]; lstrcpy( szBuf, _T("Hello, Win32 API(CUI) World!n") ); hStdOutput = GetStdHandle( STD_OUTPUT_HANDLE ); WriteConsole( hStdOutput, szBuf, lstrlen(szBuf), &dwSize, NULL ); return 0; }
コンパイル方法(Visual C++)
C:¥> cl hello.c /link /SUBSYSTEM:CONSOLE
実行結果
Hello, Win32 API(CUI) World!