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.
thanks for your help, Jack.
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.D LL");
if (Kernel32==NULL)
{
PostMsg("Unable to get KERNEL32.DLL");
DestroyWindow(hWnd);
return 0;
}
RegisterServiceProcess=(Ex RegSrvProc )GetProcAd dress(Kern el32,"Regi sterServic eProcess") ;
if (RegisterServiceProcess==N ULL)
{
PostMsg("RegisterServicePr ocess entry point not found in KERNEL32");
DestroyWindow(hWnd);
return 0;
}
if (1!=RegisterServiceProcess (GetCurren tProcessId (),1))
{
PostMsg("Unable to register service");
DestroyWindow(hWnd);
return 0;
}
Yes, I know it's not not VB, but the switch to VB should go pretty easy.
Kernel32=GetModuleHandle("
if (Kernel32==NULL)
{
PostMsg("Unable to get KERNEL32.DLL");
DestroyWindow(hWnd);
return 0;
}
RegisterServiceProcess=(Ex
if (RegisterServiceProcess==N
{
PostMsg("RegisterServicePr
DestroyWindow(hWnd);
return 0;
}
if (1!=RegisterServiceProcess
{
PostMsg("Unable to register service");
DestroyWindow(hWnd);
return 0;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In your form query unload event
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
cancel = true
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
cancel = true
End Sub
ASKER
Nice1, thanks! sorry for the really really slow response. Jack
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