• Welcome to Valhalla Legends Archive.
 

Hiding with the close box.

Started by Blade_360, February 28, 2003, 01:42 PM

Previous topic - Next topic

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

iago

#1
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 :-/
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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:
// ...
switch (uMsg)
{
case WM_SYSCOMMAND:
      if (wParam == SC_CLOSE)
      {
            SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
            return TRUE;
      }
      break;
}
// ...
Eibro of Yeti Lovers.

Skywing

#3
QuoteHandle 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:
// ...
switch (uMsg)
{
case WM_SYSCOMMAND:
      if (wParam == SC_CLOSE)
      {
            SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
            return TRUE;
      }
      break;
}
// ...
A minor correction:
QuoteIn 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.

Thus you should have: switch(wParam & 0xfff0) {

Atom

#4
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
'''''Now put your systray codeage in here
End Sub
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.

Blade_360

Thanks
oh and you also need to show the frmChat.Hide or Hide me or else nothing will happen. ::)