CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Posts
    1

    Newbie in need!!! Please Help!!! Just 2 easy questions...

    Hi I have 2 questions for you professionals,

    1) How do I make it so that the user can't shut down my program, or so that it loads back up as soon as it is closed?

    2) How do I get my program to display the Connect To box when you load it, like when you load internet explorer or netscape, it displays that connect to box if your not already connected to the internet, how do I get that menu to come up?

    Please Help Me!!!


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Question number 1

    in order to not allow the user to close your program, you can set the Cancel argument to True, when trapping the QueryUnload event for your main form window.


  3. #3
    Join Date
    Mar 2000
    Posts
    7

    Re: Question number 1

    That will work unless the user terminates the program from the taskmanager. In an extreme case when you want to keep it open (which you wouldn't normally do) you could have another ActiveX exe program running that checked to see if your app is running with the FindWindow api. There are other api's you can use as long as you know the windows handle. You get get that from the findwindow api.
    Then open the app again with the shell command after its closed. When you attempt this be wary about how you are going to safely shutdown your computer.

    In answer to your second question:
    You can run this
    Dim rs
    rs = Shell("rundll32.exe rnaui.dll,RnaDial " & "Name of connection", 1)
    If you want to find out the active connection its in the registry but varies between NT and 95/98. There is also an API for this.

    Private Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, lpcConnections As Long) As Long

    The functions to use the apis are get slighty large so if you need more help email me @[email protected] - Remove the @xxx from the email addres..(for anti spam purposes)



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured