Cooker
December 19th, 2004, 11:04 PM
Hi,
I write the message handle such as:
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message){
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
I rewrite the function by using HANDLE_MSG macro such as:
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message){
HANDLE_MSG(hwnd, WM_CREATE, MainWindow_OnCreate) ;
HANDLE_MSG(hwnd, WM_DESTROY, MainWindow_OnDestroy) ;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
default:
return MainWindow_DefProc (hwnd, Message, wParam, lParam) ;
}
}
/****************************
MsgHand: WM_CREATE
***************************/
BOOL MainWindow_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
return TRUE;
}
/****************************
MsgHand: WM_DESTROY
***************************/
void MainWindow_OnDestroy(HWND hwnd)
{
PostQuitMessage(0) ;
return ;
}
But when I will execute the program again after I have alread closed the window,
the message tell me :
INK : fatal error LNK1168: cannot open Debug/Player.exe for writing
Error executing link.exe.
I confirm that I have closed the windows.
But why I can't execute the program again?
Could someone tell me ? Thank you! :)
I write the message handle such as:
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message){
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
I rewrite the function by using HANDLE_MSG macro such as:
LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message){
HANDLE_MSG(hwnd, WM_CREATE, MainWindow_OnCreate) ;
HANDLE_MSG(hwnd, WM_DESTROY, MainWindow_OnDestroy) ;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
default:
return MainWindow_DefProc (hwnd, Message, wParam, lParam) ;
}
}
/****************************
MsgHand: WM_CREATE
***************************/
BOOL MainWindow_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
return TRUE;
}
/****************************
MsgHand: WM_DESTROY
***************************/
void MainWindow_OnDestroy(HWND hwnd)
{
PostQuitMessage(0) ;
return ;
}
But when I will execute the program again after I have alread closed the window,
the message tell me :
INK : fatal error LNK1168: cannot open Debug/Player.exe for writing
Error executing link.exe.
I confirm that I have closed the windows.
But why I can't execute the program again?
Could someone tell me ? Thank you! :)