Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Creating a service for the Win9x family!

Hi All

I've succeeded in getting my application(tcp/ip) to load on startup  by placing a shortcut to it in the registry. The problem is if I Log OUT of the current profile , windows kills my "service", along with all the other open applications.

Thats no way for my service to behave, as it is vitally important for said application to never be unloaded, much like an NT service.

So to break it up.

I need a way to maintain application existance while logging off and on to different profiles under Win9x operating systems.

cheers,
      L
 




0
Loftbug
Asked:
Loftbug
  • 4
  • 3
1 Solution
 
BWarmuskerkenCommented:
Put the shortcut here:

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\RunServices
0
 
LoftbugAuthor Commented:
Hi BWarmusKerken,

My shortcut is already at that location.
I think, maybe the application might have to be modified some how to avoid being removed when the user logs off.

Any Ideas?
0
 
BWarmuskerkenCommented:
Public Declare Function RegisterServiceProcess Lib "kernel32.dll" (ByVal dwProcessId As Long, ByVal dwType As Long) As Long


Public Declare Function GetCurrentProcessId Lib "kernel32.dll" () As Long


In your Sub Main()
RegisterServiceProcess(GetCurrentProcessID, 1)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LoftbugAuthor Commented:
Much Thanks BWarmuskerken!

It worked!
Consider the 100 points yours.

For another 50 points (totaly your choice and your question), can you tell me how i could write the

"RegisterServiceProcess(GetCurrentProcessID, 1)" so that it will execute only in win9x (95/98/Me) and not (NT/2k/XP)  

An API that simply identifies the OS as being pure 32 bit or a cleverly written if statement that checks the validity of the kernel object being referenced and returns true or false.

As I don't want to use the "on error" trapping method.

Thanks again.
        L

0
 
LoftbugAuthor Commented:
points have been increased...
0
 
BWarmuskerkenCommented:
http://www.mvps.org/vb/

Download the Class OpSys.Zip, it'll give you all you need to determine if it's Win9x/Me/NT/XP.
0
 
BWarmuskerkenCommented:
I forgot to mention that it is in the Samples section.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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