#include <acknex.h>
#include <windows.h>
#include <default.c>
#define LPWSTR char*
#define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
#define MAKEINTRESOURCE MAKEINTRESOURCEW
#define IDI_WINLOGO MAKEINTRESOURCE(32517)
#define ID_yourbutton 1
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND hwnd1;
HWND hwnd_button;
char cname[4] = {0x62, 0x6C, 0x61, 0}; // "bla"
void main ()
{
wait(1);
mouse_pointer = 2;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = cname;
RegisterClass (&wc);
hwnd1 = CreateWindowEx
(
0,
cname,
"Your Subwindow",
WS_OVERLAPPEDWINDOW | WS_POPUP,
400, 400, 400, 400,
hWnd,
0,
hInstance,
0
);
hwnd_button = CreateWindowEx (0, "Button", "Klick me!",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
10, 10, 96, 24, hwnd1, (HMENU)ID_yourbutton,
(HINSTANCE) GetWindowLong (hwnd1, GWL_HINSTANCE), NULL);
ShowWindow (hwnd1, SW_SHOWNORMAL);
MSG msg;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
wait(1);
}
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_LBUTTONDOWN:
MessageBox(hwnd1,"Left mouse button pressed inside your subwindow!","!!!",MB_OK);
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == ID_yourbutton)
{
MessageBox(hwnd1,"You pressed the button!","OMFG!!!",MB_OK);
}
/*default:
wait(1);
break;*/
}
return DefWindowProc (hwnd, message, wParam, lParam);
}