Link to home
Start Free TrialLog in
Avatar of Loftbug
Loftbug

asked on

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
 




Avatar of BWarmuskerken
BWarmuskerken

Put the shortcut here:

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\RunServices
Avatar of Loftbug

ASKER

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?
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)
Avatar of Loftbug

ASKER

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

Avatar of Loftbug

ASKER

points have been increased...
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.
ASKER CERTIFIED SOLUTION
Avatar of BWarmuskerken
BWarmuskerken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial