Link to home
Start Free TrialLog in
Avatar of Portal111
Portal111

asked on

Uncloseable Window

Hi there, basically, I would like some code that will stop my app from closing. On RM networks, it closes any applications that are not meant to be running when you log off the network and i want my program to keep running.

thanks for your help, Jack.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Please maintain your open questions:

Hiding Objects Date: 07/13/2001 10:20AM PST
https://www.experts-exchange.com/jsp/qShow.jsp?ta=flash&qid=20150504
Getting Process Icons Date: 01/07/2002 11:30PM PST
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20252540
Using The Tint Command / If There is One Date: 12/05/2001 10:18AM PST
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20243976

Thanks,
Anthony
Here's a snippet that references a largely undocumented API call that let's the caller survive a logoff.  This is one of the tings I do to simulate services on 95.

Yes, I know it's not not VB, but the switch to VB should go pretty easy.

Kernel32=GetModuleHandle("KERNEL32.DLL");
if (Kernel32==NULL)
   {
   PostMsg("Unable to get KERNEL32.DLL");
   DestroyWindow(hWnd);
   return 0;
   }

RegisterServiceProcess=(ExRegSrvProc)GetProcAddress(Kernel32,"RegisterServiceProcess");
if (RegisterServiceProcess==NULL)
   {
   PostMsg("RegisterServiceProcess entry point not found in KERNEL32");
   DestroyWindow(hWnd);
   return 0;
   }
if (1!=RegisterServiceProcess(GetCurrentProcessId(),1))
   {
   PostMsg("Unable to register service");
   DestroyWindow(hWnd);
   return 0;
   }
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In your form query unload event

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
cancel = true
End Sub
Avatar of Portal111
Portal111

ASKER

Nice1, thanks! sorry for the really really slow response. Jack