



#include <windows.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
HWND hwnd, simple_button, icon_button, icon_button2, icon_button3;
HINSTANCE hInstance;
HICON hIcon1, hIcon2;
POINT pt;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmd )
{
MSG msg ;
WNDCLASS wc = {0};
wc.lpszClassName = TEXT( "Static Control" );
wc.hInstance = hInstance ;
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc = WndProc ;
wc.hCursor = LoadCursor(0,IDC_ARROW);
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
RegisterClass(&wc);
hwnd = CreateWindow( wc.lpszClassName, TEXT("Basic Win32API"),WS_BORDER,100, 200, 150, 355, 0, 0, hInstance, 0);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
while( GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
HDC hDC;
PAINTSTRUCT ps;
RECT rect;
switch(msg)
{
case WM_PAINT:
hDC = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
DrawText(hDC, TEXT("ALT+F4 to Close!"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
DrawText(hDC, TEXT("Basic Win32 Api App \n- Fallen"), -1, &rect,
DT_CENTER | DT_TOP);
EndPaint(hwnd, &ps);
break;
case WM_CREATE:
{
simple_button = CreateWindow(TEXT("button"), TEXT("Button1"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
20, 30, 110, 50,
hwnd, (HMENU) 1, NULL, NULL);
icon_button = CreateWindow(TEXT("button"), TEXT("Button2"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
20, 100, 110, 50,
hwnd, (HMENU) 2, NULL, NULL);
icon_button2 = CreateWindow(TEXT("button"), TEXT("Button3"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
20, 170, 110, 50,
hwnd, (HMENU) 3, NULL, NULL);
icon_button3 = CreateWindow(TEXT("button"), TEXT("Button4"),
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
20, 240, 110, 50,
hwnd, (HMENU) 4, NULL, NULL);
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case 1:
//case
break;
}
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}

SSJ5 wrote:Could someone give me some examples of API librarys?


Users browsing this forum: No registered users and 0 guests