Valhalla Legends Forums Archive | General Programming | Hiding with the close box.

AuthorMessageTime
Blade_360
How do I make it like in an instant messager where if you press the close box it doesn't unload the program? I know I could just do it where it loads when you click the systray icon or something but I want it to keep the original rtb text
February 28, 2003, 7:42 PM
iago
If you're using vb, maybe in form_deactive or form_unload or whatever it is to return FALSE and not die.

If that doesn't work, best I can think of is to set a hook, but I don't know enough about that to help you :-/
February 28, 2003, 10:36 PM
Eibro
Handle the WM_SYSCOMMAND message if you're using C/C++...
wParam will be SC_CLOSE if the close button was clicked.
Eg. If you want to minimize the window:
[code]
// ...
switch (uMsg)
{
case WM_SYSCOMMAND:
     if (wParam == SC_CLOSE)
     {
           SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
           return TRUE;
     }
     break;
}
// ...
[/code]
February 28, 2003, 11:14 PM
Skywing
[quote]Handle the WM_SYSCOMMAND message if you're using C/C++...
wParam will be SC_CLOSE if the close button was clicked.
Eg. If you want to minimize the window:
[code]
// ...
switch (uMsg)
{
case WM_SYSCOMMAND:
     if (wParam == SC_CLOSE)
     {
           SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
           return TRUE;
     }
     break;
}
// ...
[/code][/quote]
A minor correction:
[quote]In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by the system. To obtain the correct result when testing the value of wParam, an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator.[/quote]

Thus you should have: [code]switch(wParam & 0xfff0) {[/code]
February 28, 2003, 11:36 PM
Atom
[code]Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
'''''Now put your systray codeage in here
End Sub[/code]
March 3, 2003, 1:01 AM
Blade_360
Thanks
oh and you also need to show the frmChat.Hide or Hide me or else nothing will happen. ::)
March 3, 2003, 6:53 PM

Search