[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

registry and internet

I have some questions if any experts can help me out.

I writing a program to detect and do a certain thing when user log on the internet.

First, I want to have a function that allow my program to automatically, hiddenly starts when windows starts.  It just like putting my program in the startup folder but I dont want to do so.  I think there is a way by adding it to the registry.  I want to be able to enable and disable the start up option at choice by running my program.  By the way, I dont want it to show its icon at the lower end of the windows where the clock appear, neither is on the task menu[ctr-alt-del].  But I want a tricky way to access to my program so no other users would be able to access to the program but me.

Second, how do I detect when user go to the internet.  The user would use dial-up to connect to the internet.  I noticed when user connect to the internet, a small two-lights computer appear at the bottom left of the screen.

I will accept the most complete and helpful comments as answer.

Thanks
cdloves
0
cdloves
Asked:
cdloves
  • 9
  • 6
  • 3
  • +3
1 Solution
 
Erick37Commented:
Win 95/98, NT or both?
0
 
Brendt HessSenior DBACommented:
Sample code showing how to automatically start a program when windows starts using the registry (not the Startup folder):

http://vbaccelerator.com/codelib/inireg/regmisc1.htm

To ensure that the program doesn't show on the task bar:

http://vbaccelerator.com/codelib/winstyle/taskshow.htm

To hide a program from the Task List:

http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=186

Hope these help...
0
 
cdlovesAuthor Commented:
Eric,
I am looking for 95/98,  but it would be nice if you have both
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
cdlovesAuthor Commented:
bhess1,

those examples seem little complicated...It will take me a while to check it out....so hang on.

Any comments for checking internet status?
0
 
AzraSoundCommented:
you want to know right when an internet session begins?  or you just want to be able to check if there is an internet connection already established?
0
 
Brendt HessSenior DBACommented:
Nothing right now - you'll have to count on some of the other experts here for that.
0
 
cdlovesAuthor Commented:
AzraSound, I want to know right when an internect session begins(is that how you call when the dialup finished and the small computer appear at bottom right?).  I want my program to execute the main statements when the internet first connected.  Well how about this...when a internet is first establish, I want my program to run its main function...Otherwise it just sit there and wait....

Thanks...I hope I made it clear...
cdloves
0
 
Brendt HessSenior DBACommented:
Well, actually, you might check out:

http://www.mvps.org/vbnet/code/network/internetgetconnectedstate.htm

Sample VB code to determine if you are connected.  However, it only works if IE4 or later is installed, as it uses a DLL from IE4.

Using this, you could have your background program check the connected state evert second or two (using the Sleep() api call to suspend processing in between)
0
 
cdlovesAuthor Commented:
OK, here is my status so far...

I test the automacially start function and it "partially" works.  However, here is my sub main:

 Sub Main()
     AutoRun eOnce
    If MsgBox("hello", vbYesNo) = vbYes Then
        Exit Sub
    Else
        AutoRun eNever
    End If
 End Sub
....
After startup the comp, the prog runs and display a hello message, if I click on yes, another hello message will appear, and it will keep appearing until I click no.  Why is that happen?  

After I click no, the program exit and windows begin to load it startmenu and so on.  Then I run the program again, this time I click yes, the program exit...I restart the comp, program runs at start up, click yes on the message box, the msgbox appear again and again until I click no.

If you want to test out for yourself...have the class include.  Set the let property of autorun into sub and block out the get property...  See if you can help me out.
0
 
AzraSoundCommented:
thats why i was asking...i only knew of a way to check if there was already a connection though I imagine there is another way with API.  You can monitor the system and be notified upon certain events occurring though I am not quite certain how its done.  But if you dont mind checking for a connection every few seconds with a timer control then I have the code that will do that.
0
 
AzraSoundCommented:
youre program starts off calling SubMain from the module...so since you put that code in your module and you say "yes start my program" it will always call SubMain at the beginning.  You need to put that code somewhere else.  Perhaps in a formload event.
0
 
Brendt HessSenior DBACommented:
You are setting a new Registry key every time the program runs.  So, once the current RunOnce is done, the start-up sequence checks for more AutoRun keys, and re-starts the program from the new key.

You can't re-install the same Autorun key during the startup sequence.
0
 
wsh2Commented:
No offense folks.. but what is cdloves up to?... Ahhhhhhh-chooooo, uh sorry.. I must be getting the flu.

cdloves.. what are you up to?.. <eg>.
0
 
cdlovesAuthor Commented:
hahahah...

good question wsh2...

First of all, I main point in here is that I want to "block" my brother from going to the internet.  Because he is quite good at computer (he is a college student in CS major) so it would be very hard do it.  I want a program run in back ground and prevent him from going to the internet.  I enventually will disable ctr-alt-del so he can't end my program, he still can enable it and re-call the function it[I believe he can].  so I will need to hide it so that it would not dispay in task list in case he enables Ctr-Alt-Del.  Now, the next point is how will I do it so that I can use the internet myself but not him.  And I dont want him to figure out that I up to the trick.

Second of all, this is a good practice for me because I dont familiar much with API call.

Did that answer your question?  By the way, it would be nice if you answer me what you really thought I was up to... FAIR, right?

cdloves
P.S.  It was nice you brought this up.
0
 
cdlovesAuthor Commented:
AzraSound, I put every thing in the formload and the result was the form act like the msgbox that is keep re-appearing after I close it.

Bhess1, I will take your word that I can't install same key...

By the way, you mention something about call Sleep() api call, how do I use it.  I hope my reply to wsh2 give you a general idea what I am "up to".

Thanks,
cdloves
0
 
Brendt HessSenior DBACommented:
You declare the API call as:

Declare Sub Sleep Lib "kernel32" ( _    ByVal dwMilliseconds As Long)


And use it where ever you want to pause your program:

(doing something here...)

Sleep 1000   ' pause program for 1000 milliseconds = 1 second

0
 
cdlovesAuthor Commented:
so you mean I should use a:
while notoninternet
   sleep 1000
wend

to wait for internet connection 2 be made?
0
 
cdlovesAuthor Commented:
I meant is that they way most programmers do while their program runs in back ground?
0
 
wsh2Commented:
Thanks for writing cdloves.. <huge smile>. First of all.. Mom loves you too, Ok?.. <just kidding!> and <LOL>.

A word of caution in this though, add a switch to your program so that it only activates when you are around.. either that or don't stand under any open windows of the computer room whenever he gets on the machine and you are not around. Remember, everything of his is going to be be yours one day.. and hopefully the computer will still be in one piece like that Scooby Doo pass me down Lunchbox that you came to love.

Now, I want you to know.. what you are doing can get you thrown out of the League Of Justice Superhero Club. Batman, Superman, da Flash all kinda frown on this schtuff.. and don't be surprised if you do not get invited to their Chucky Cheese Pizza birthday parties and miss out on the singing mechanical bear there. Simply put, Superpowers are only to be used for "Good" and NOT "Evil".. I mean what if your Superpower should fall into the wrong hands? Well.. we would just have to go and bomb Iraq again.. Ok, I admit bombing Iraq is fun.. but you just gotta know some Mom in Iraq is really gonna get p*ssed.. when she can't get the shrapnel in the wall to shine up.. and well.. you know Moms.. she's gonna call you Mom and say it is all your fault.. and then your Mom is gonna jump on you and say.. "can't you act more like your older brother".. and once again you are going to feel left out. Being a Superhero with an older brother somedays can really be rough.. <sheesh>.

Anyhow.. good luck with your project.. and thank you for enduring my silliness.. <smile>.



0
 
ArkCommented:
Hi
1. Starting Your Application When Windows Boots

Add a string entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Run.  The entry's name should be the name of your application (ex: MyApp).  Its value must be the short path to your application (ex. C:\Windows\MyApp.exe).

2. How to hide programm from task manager and from Ctrl-Alt-Del:
http://www.codearchive.com/vbasic//taskhide.zip or
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=2394 (the easiest one) or
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=2393

3. How to check active Inet connection
http://www.freevbcode.com/ShowCode.Asp?ID=632 - you can choose any of three ways to detect if connection is active. If you use dial up the first way is the easiest

4. How to disconnect from the internet
http://www.vb-world.net/internet/tip21.html

5. Good Luck :-). BTW, take a look at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=2218 (IMPORTANT - read disclaimer first!!!)
Cheers
0
 
Brendt HessSenior DBACommented:
Unless you want your background program to take a significant chunk of processing time, or can tie it into a windows call, so that an event fires off when your program needs to act, then the Sleep() method is usually used.  

During the Sleep interval, your program won't use any significant CPU resources, allowing you to use your PC as normal.  A DoEvents or other type of loop will use a significant chunk of processing time.

I'd bet that a 1 second interval between checks would be often enough for your purpose.
0
 
cdlovesAuthor Commented:
I got the program to run as I wanted.  Thank you all for giving me comments.

Because I used bhess comments the most to write my program so I will give the points to him.

Once again, thank you all for helping me out.

Thanks,
cdloves
0
 
wsh2Commented:
I hope your brother beats the living crap out of ya... nananananannanana <tongue out>.. so there !!! <just kidding.. LOL>.. Good luck with your project !!!! <smile>.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 9
  • 6
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now