「C言語/C++/gdi+test」の編集履歴(バックアップ)一覧はこちら

C言語/C++/gdi+test - (2012/09/09 (日) 08:36:48) の1つ前との変更点

追加された行は緑色になります。

削除された行は赤色になります。

|開発環境|Microsoft Visual C++ 2010 Express (SP1)| |実行環境|Microsoft Windows XP Home Edition (SP3)| |プロジェクトの種類|Win32 プロジェクト| |プロジェクト名|gdi+test| |アプリケーションの種類|Windows アプリケーション| |追加のオプション|空のプロジェクト| |文字セット|Unicode| 参考 :[[JPEG(ジェイペグ)やGIF(ジフ)を表示しよう^0^>http://www.geocities.jp/ccfjd821/purogu/wpe-ji9.html]]| gdi+test.cpp #highlight(cpp){{ // GDI+ // Image:BMP, ICON, GIF, JPEG, Exif, PNG, TIFF, WMF, and EMF #pragma comment(lib, "gdiplus.lib") #include <Windows.h> #include <GdiPlus.h> using namespace Gdiplus; // 関数プロトタイプ宣言 LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // 外部変数 TCHAR g_szClassName[] = TEXT("gdi+test"); TCHAR g_szWindowName[] = TEXT("gdi+test"); Image *g_image = NULL; //============================================================================== int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wcx; HWND hWnd; MSG msg; ULONG token; GdiplusStartupInput input; // 初期処理 GdiplusStartup(&token, &input, NULL); g_image = new Image(lpCmdLine); // ウィンドウクラスの登録 wcx.cbSize = sizeof (WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = WindowProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hInstance; wcx.hIcon = NULL; wcx.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcx.lpszMenuName = NULL; wcx.lpszClassName = g_szClassName; wcx.hIconSm = NULL; if (RegisterClassEx(&wcx) == 0) { return 0; } // ウィンドウの作成 hWnd = CreateWindow( g_szClassName, g_szWindowName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (hWnd == NULL) { return 0; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); // メッセージループ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } // 終了処理 delete g_image; GdiplusShutdown(token); return msg.wParam; } //------------------------------------------------------------------------------ LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); Graphics g(hdc); g.DrawImage(g_image, 0, 0); EndPaint(hWnd, &ps); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0; } }}
|開発環境|Microsoft Visual C++ 2010 Express (SP1)| |実行環境|Microsoft Windows XP Home Edition (SP3)| |プロジェクトの種類|Win32 プロジェクト| |プロジェクト名|gdi+test| |アプリケーションの種類|Windows アプリケーション| |追加のオプション|空のプロジェクト| |文字セット|Unicode| 参考 [[JPEG(ジェイペグ)やGIF(ジフ)を表示しよう^0^>http://www.geocities.jp/ccfjd821/purogu/wpe-ji9.html]] gdi+test.cpp #highlight(cpp){{ // GDI+ // Image: BMP, ICON, GIF, JPEG, Exif, PNG, TIFF, WMF, and EMF #pragma comment(lib, "gdiplus.lib") #include <Windows.h> #include <GdiPlus.h> using namespace Gdiplus; // 関数プロトタイプ宣言 LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // 外部変数 TCHAR g_szClassName[] = TEXT("gdi+test"); TCHAR g_szWindowName[] = TEXT("gdi+test"); Image *g_image = NULL; //============================================================================== int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wcx; HWND hWnd; MSG msg; ULONG token; GdiplusStartupInput input; // 初期処理 GdiplusStartup(&token, &input, NULL); g_image = new Image(lpCmdLine); // g_image = Image::FromFile(lpCmdLine); // ウィンドウクラスの登録 wcx.cbSize = sizeof (WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = WindowProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hInstance; wcx.hIcon = NULL; wcx.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcx.lpszMenuName = NULL; wcx.lpszClassName = g_szClassName; wcx.hIconSm = NULL; if (RegisterClassEx(&wcx) == 0) { return 0; } // ウィンドウの作成 hWnd = CreateWindow( g_szClassName, g_szWindowName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (hWnd == NULL) { return 0; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); // メッセージループ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } // 終了処理 delete g_image; GdiplusShutdown(token); return msg.wParam; } //------------------------------------------------------------------------------ LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); Graphics g(hdc); g.DrawImage(g_image, 0, 0); EndPaint(hWnd, &ps); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return 0; } }}

表示オプション

横に並べて表示:
変化行の前後のみ表示: