Discussione:
WinApi32 funzione "LRESULT CALLBACK WndProc(...)"
(troppo vecchio per rispondere)
NERO23
2013-10-24 12:54:04 UTC
Permalink
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}

Il parametro "hwnd" a quale Handle si riferisce?
A quello che il sistema assegna alla funzione
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR
lpCmdLine, int nCmdShow)
{... ?

Nero23
enoquick
2013-10-24 13:07:46 UTC
Permalink
Post by NERO23
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
{
switch(msg)
{
DestroyWindow(hwnd);
break;
PostQuitMessage(0);
break;
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Il parametro "hwnd" a quale Handle si riferisce?
A quello che il sistema assegna alla funzione
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR
lpCmdLine, int nCmdShow)
{... ?
Nero23
Visto che hai postato un' altra domanda vorrei sapere una cosa
Ma è troppo difficile fare una ricerca in internet per queste banalità ?
Oppure se non conosci l' ambiente delle api win32/64 prima ti consiglio
di leggeti un buon libro su come sviluppare

Comunque la risposta è l' handle di una finestra
acc
2013-10-24 15:06:04 UTC
Permalink
Post by NERO23
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
{
switch(msg)
{
DestroyWindow(hwnd);
break;
PostQuitMessage(0);
break;
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Il parametro "hwnd" a quale Handle si riferisce?
A quello che il sistema assegna alla funzione
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR
lpCmdLine, int nCmdShow)
{... ?
E' l'handle della window a cui e' rivolto il messaggio, non ha nulla a
che vedere coi parametri della WinMain(), ma dentro alla WinMain() ci
sara' una chiamata a CreateWindow() o CreateWindowEx(), in pratica
quello e' l'handle tornato da una di queste due funzioni.

Loading...