Vous avez amais fait de fenetres? vous en coulez? voici le main.c (langage C bien sur)
[spoiler]#include <windows.h>
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hinstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MaWinClass";
if(!RegisterClass(&wc)) return FALSE;
hwnd = CreateWindow("MaWinClass", "Test", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
NULL, NULL, hinstance, NULL);
if (!hwnd) return FALSE;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
/******************************************************************************/
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
/* mis en commentaire et remplacé par WM_PAINT
case WM_KEYDOWN :
{
int y;
char st[] = “Bonjour” ;
HDC hdc = GetDC(hwnd);
SetBkMode(hdc, TRANSPARENT);
for(y=10; y <= 200; y += 20)
TextOut(hdc, 10, y, st , lstrlen(st));
ReleaseDC(hwnd, hdc);
return 0;
} */
/* mis en commentaire et remplacé par WM_PAINT suivant
case WM_PAINT :
{
int y;
char st[] = "Bonjour" ;
HDC hdc = GetDC(hwnd);
SetBkMode(hdc, TRANSPARENT);
for(y=10; y <= 200; y += 20)
TextOut(hdc, 10, y, st , lstrlen(st));
ReleaseDC(hwnd, hdc);
return 0;
} */
case WM_PAINT :
{
int y;
char st[] = "Bonjour" ;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
SetBkMode(hdc, TRANSPARENT);
for(y=10; y <= 200; y += 20)
TextOut(hdc, 10, y, st , lstrlen(st));
EndPaint(hwnd, &ps);
return 0;
}
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}[/spoiler]