#include <windows.h>
#include <gdiplus.h>
#pragma comment (lib, "Gdiplus.lib")
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrewInstance,
PSTR szCmdLine,int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL,IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL,IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{ //UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit
MessageBox (NULL, TEXT ("Programm arbeitet mit Unicode!"),
szAppName,MB_ICONERROR) ;
return 0;
}
hwnd = CreateWindow (szAppName, // Name der Fensterklasse
TEXT ("Counter-Strike Befehle V 1.0"), // Fenstertitel
WS_OVERLAPPEDWINDOW, // Fensterstil
CW_USEDEFAULT, // X-Position des Fensters
CW_USEDEFAULT, // Y-Position des Fensters
CW_USEDEFAULT, // Fensterbreite
CW_USEDEFAULT, // Fensterhöhe
NULL, // übergeordnetes Fenster
NULL, // Menü
hInstance, // Programm-Kopiezähler (Programm-ID)
NULL) ; // zusätzliche Parameter
ShowWindow (hwnd,iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
switch (message)
{
case WM_CREATE:
ULONG_PTR token;
Gdiplus::GdiplusStartupInput startupInput;
Gdiplus::GdiplusStartup(&token, &startupInput, NULL);
return 0 ;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
Gdiplus::Bitmap *pBitmap = Gdiplus::Bitmap::FromFile(L"C:\\00NewGame.png");
if( pBitmap ) {
Gdiplus::Graphics g(hdc);
g.DrawImage(pBitmap, Gdiplus::PointF(0.0f, 0.0f));
}
delete oBitmap;
EndPaint(hwnd, &ps);
}
return 0L;
case WM_DESTROY:
Gdiplus::GdiplusShutdown(token);
PostQuitMessage (0) ;
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}