|
-
Feb 27th, 2000, 03:11 PM
#1
Thread Starter
Member
Hi,
How do I make a program run hidden in the background?? Can't figure out how to do this. Please help.
Thanks,
Kevin
-
Feb 27th, 2000, 03:14 PM
#2
So Unbanned
ambiguous question
Be more clear, do you still want it in ctrl+alt+del menu? etc.
-
Feb 27th, 2000, 03:20 PM
#3
Thread Starter
Member
No, I would like it to be completely hidden, or as hidden as possible. I don't want it in the ctrl, alt, del menu.
Thanks,
Kevin
-
Feb 27th, 2000, 05:21 PM
#4
solution for win9x
to hide you're app on win9X machines in the CTRL+ALT+DEL List, here the code : (dont work on NT machines)
-----------------
Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
Public Sub UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, _
RSP_UNREGISTER_SERVICE)
End Sub
-
Feb 28th, 2000, 01:57 AM
#5
Thread Starter
Member
That did not work. Where do I put it in a module?? What I want to do is completely hide the program. Right, know what I see when I run it in vb5 is the normal form window. I want to make it run in the background at startup, and be hidden, so that it can not be seen.
Thanks,
Kevin
-
Feb 28th, 2000, 02:08 AM
#6
Hyperactive Member
If you want to hide the form, set Visible and ShowInTaskbar to false.
-
Feb 28th, 2000, 02:37 AM
#7
Hyperactive Member
To make it run at startup, add a new key with your executable name as the value in the registry at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
-
Feb 28th, 2000, 04:08 AM
#8
Hyperactive Member
KevDog , taLon has given u the answer , yes u have to put the code he gave u in a module but u have to call the function MakeMeService() from the form_load() .... and as wade told u , u can also put it in the registry so that it runs with windows , but beware if the user Presses Ctrl-Alt-Del just when windows starts , and before "rundll.exe" loads the program will show in the list , but once rundll has completed running the program is practically untracable unless the user has made his own code to list active programs running under windows ....
-
Feb 28th, 2000, 05:36 AM
#9
Addicted Member
I tried taLON's code but get an error msg saying
--
Can't find DLL Entry Point RegisterServiceProcess in Kernel 32
--
And I checked Register... API declare from my API VIEW and find no name match. What am I missing? I am using VB6 pro.
-
Feb 28th, 2000, 05:51 AM
#10
Addicted Member
Oops!, I missed taLon's note : don't work on NT. I am using NT! Is that the reason why there is no RegisterServiceProcess API in my API View?
-
Feb 28th, 2000, 06:25 AM
#11
Thread Starter
Member
I can get the program to not show up in the ctrl + alt + del menu, that codes works great, thanks! However, when I make the program set to not show up in the taskbar and not be visible it will not run, it runs but will not work. it does nothing, However when I change the settings to show in taskbar and be visible it works. Why?? How can I make it work and be hidden at the same time??
Thanks Again,
Kevin
-
Feb 28th, 2000, 11:51 AM
#12
Member
The app is doing nothing b/c it doesn't have any type of focus. If it doesn't have any focus then it's not going to resoond to any events. I'm not sure how to fix it but I'd be interested in hearing. I'm assuming it will be something w/ the API.
-
Feb 28th, 2000, 10:10 PM
#13
Junior Member
i also have a question similiarly to KevDog.
But I want my program to check all the time for specific even.
I know that it is a kind of Hooks but I don't know where to start.
What I can hook just when my form gotfocus not when it lostfocus or minimize.
What I really want to know is like some anti-virus program do. They check all the time for file process or whatever to protect our computer. That great
Anyone know how to do.
Thanks
vbkids
-
Feb 28th, 2000, 11:06 PM
#14
Hyperactive Member
Make a new procedure called Sub Main() and put your form_load code in it. Then make Sub Main your Startup Object (in Project Properties).
-
Feb 28th, 2000, 11:14 PM
#15
Thread Starter
Member
Wade,
How's question are you answering mine or vbkids??
Kevin
-
Feb 28th, 2000, 11:20 PM
#16
Hyperactive Member
Yours Kevin. I made a program recently that closes down an antivirus program, updates a set of files if necessary, and relaunches the antivirus. It's transparent to the user, and I used Sub_Main instead of Form_Load.
-
Feb 29th, 2000, 12:06 AM
#17
Thread Starter
Member
Wade,
Thanks. However, it is still not working, I renamed my Sub_Load to Sub_Main, and set it as startup in properties, but it gives me an invaild outside procedure error when I try to run it. My Sub_Main code looks like this:
Private Sub_Main()
MakeMeService
Dim tdFile As Integer
tdFile = FreeFile
Open "C:\Log.txt" For Append As tdFile
Print #tdFile, ""
Print #tdFile, "Date: " & CStr(Date)
Print #tdFile, "Time: " & CStr(Time)
Close #tdFile
End Sub
Thanks,
Kevin
-
Feb 29th, 2000, 12:11 AM
#18
Hyperactive Member
I didn't declare mine as private. Which line is it giving you the error message for?
-
Feb 29th, 2000, 12:14 AM
#19
Wade,
Thanks. However, it is still not working, I renamed my Sub_Load to Sub_Main, and set it as startup in properties, but it gives me an invaild outside procedure error when I try to run it. My Sub_Main code looks like this:
Private Sub_Main()
MakeMeService
Dim tdFile As Integer
tdFile = FreeFile
Open "C:\Log.txt" For Append As tdFile
Print #tdFile, ""
Print #tdFile, "Date: " & CStr(Date)
Print #tdFile, "Time: " & CStr(Time)
Close #tdFile
End Sub
Thanks,
Kevin
Private Sub_Main() should be
Private Sub Main()
With out the underscore _
-
Feb 29th, 2000, 12:27 AM
#20
Thread Starter
Member
Wade,
Every line that is in the Sub_Main is giving me a error message that same invaild outside procedure error.
Thanks,
Kevin
-
Feb 29th, 2000, 01:07 AM
#21
Hyperactive Member
Kevin, to use a Sub Main, you have to add a module to your program. And place code for it there. Are you doing that?
Larisa
-
Feb 29th, 2000, 01:24 AM
#22
Thread Starter
Member
No, I was not. I put the Sub Main in a new module, and set the properties to load Sub Main at startup, but it still wont work, should I place the sub main code somewhere else also? And should I set the form to be visible or not?
Thanks,
Kevin
-
Feb 29th, 2000, 01:25 AM
#23
Hyperactive Member
Kevin,
Vincent and Larisa are right. In my app, I have a form that I used for testing, but Sub Main() was in a module and it doesn't have an underscore.
-
Feb 29th, 2000, 01:44 AM
#24
Thread Starter
Member
I have was is in my Sub Form_Load in a new module, and also in my form under Sub Main without the underscore. I completely deleted my Form_Load Sub. What loads at startup loads fine, the code is setup to print the date and time to a text file, that works fine, however it will not run any of my other code, it is supposed to send keystrokes to the text file also. When I set my form to run at startup (instead of Sub Main), everything works fine when I set it to visible. But then when I set it to invisible, it only will send the date and time to the text file.
-
Feb 29th, 2000, 02:59 AM
#25
Hyperactive Member
How are you sending the keystrokes?
-
Feb 29th, 2000, 04:28 AM
#26
Thread Starter
Member
Using the Form_KeyDown (keycode As Interger, Shift As Interger)
If keycode = 65 Then
Dim aFile As Interger
aFile = FreeFile
Open C:\Log.txt For Append As aFile
Print #afile, "a";
End If
That is how I am sending keystrokes.
Thanks,
Kevin
-
Feb 29th, 2000, 04:38 AM
#27
Hyperactive Member
Kevin,
Since the form's not visible, the form events (such as Form_KeyDown) are not executed. Are you trying to log what a user types in other programs, since you said you want yours to run in the background?
-
Feb 29th, 2000, 05:10 AM
#28
Thread Starter
Member
Yes, that is what I am trying to do. Why won't it load it when it is not visible??
Thanks,
Kevin
-
Feb 29th, 2000, 05:24 AM
#29
Hyperactive Member
It does load, but your form can't be clicked on if it's not visible. Even if it were visible, if the user was in another program, you wouldn't be able to log their keys. You need to use the API to do this.
-
Feb 29th, 2000, 06:02 AM
#30
Thread Starter
Member
How do I use the API to do it??
Kevin
-
Feb 29th, 2000, 06:09 AM
#31
Hyperactive Member
Kevin,
Email me (or post your email address) and I'll send you a small project.
-
Feb 29th, 2000, 06:23 AM
#32
Thread Starter
Member
Wade,
I posted my e-mail address, and sent you an e-mail.
Thanks,
Kevin
-
Mar 2nd, 2000, 09:31 AM
#33
New Member
Sum it Up
To summ this thread up, for those of you who are just reading along (and don't care about the key capturing part). This is what you should do to create an INVISIBLE program.
1. Add a new module to your program.
2. Create a sub procedure called MAIN() in the new module.
3. Delete the form (if your not using it).
4. Set your startup object to SUB MAIN (see previous message).
If you want to hide the program form the task list, use the API that was talked about previously (for Win95/98). You can probably get one for NT/2000 from the Microsoft Knowledgebase. You'll have to do some searching.
----------------------------------------------------
ButtonWiz - Create Stylish Buttons for your Web Page
Joel Ryan Software
http://www.joelryan.com
----------------------------------------------------
-
Mar 2nd, 2000, 05:02 PM
#34
in vb 6, you can select (at ProjectProperties) UNATTEND EXECUTION ..... (this option is ghosted, if u have a form in you're project, delete all forms , than u can use it)
taLON
btw: if anyone know the code to make a app as service (without rebooting) under NT / Win2k..... please email me 
-
Mar 3rd, 2000, 02:24 AM
#35
New Member
To vbkids,
You can only hook from a really dll, not an activex one, so you can't write it in VB. look to c++, and you want a system hook. you'll get a copy of every event issued. Also, I think you have the option of pooping the message, so other apps don't get it. food for thought
-
Mar 3rd, 2000, 11:10 AM
#36
New Member
I`m trying to do the same thisn :make a program running in the background
what do you mean by
4. Set your startup object to SUB MAIN (see previous message).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|