?
Solved

Creating a service for the Win9x family!

Posted on 2003-03-04
7
Medium Priority
?
193 Views
Last Modified: 2010-05-01
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
Comment
Question by:Loftbug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:BWarmuskerken
ID: 8064323
Put the shortcut here:

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\RunServices
0
 
LVL 4

Author Comment

by:Loftbug
ID: 8064657
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
 
LVL 1

Expert Comment

by:BWarmuskerken
ID: 8064782
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
Industry Leaders: 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!

 
LVL 4

Author Comment

by:Loftbug
ID: 8064991
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
 
LVL 4

Author Comment

by:Loftbug
ID: 8065005
points have been increased...
0
 
LVL 1

Expert Comment

by:BWarmuskerken
ID: 8065170
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
 
LVL 1

Accepted Solution

by:
BWarmuskerken earned 600 total points
ID: 8065189
I forgot to mention that it is in the Samples section.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question