using createservice

Posted on 2004-03-30
Last Modified: 2010-04-04
Hi experts,
Has anyone got a code example of how to use CREATESERVICE. I'm getting stuck with the lpDependencies (what the heck do I put in it). :(
Question by:DickJonesOCP
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
  • 3
  • 3
LVL 17

Expert Comment

ID: 10713333
Most probably You should  place there nil meaning that Your service doesn't require any service started before by the system.
LVL 17

Accepted Solution

mokule earned 250 total points
ID: 10713383
example from MSDN in C but its clear enough I think

BOOL CreateSampleService()
    LPCTSTR lpszBinaryPathName =
    schService = CreateService(
        schSCManager,              // SCManager database
        "Sample_Srv",              // name of service
        lpszDisplayName,           // service name to display
        SERVICE_ALL_ACCESS,        // desired access
        SERVICE_WIN32_OWN_PROCESS, // service type
        SERVICE_DEMAND_START,      // start type
        SERVICE_ERROR_NORMAL,      // error control type
        lpszBinaryPathName,        // service's binary
        NULL,                      // no load ordering group
        NULL,                      // no tag identifier
        NULL,                      // no dependencies
        NULL,                      // LocalSystem account
        NULL);                     // no password
    if (schService == NULL)
        printf("CreateService failed.\n");
        return FALSE;
        return TRUE;


Author Comment

ID: 10713511
dependencies doesn't like the value NULL or nil or anything else I've tried. It comes up with a message 'incompatible types STRING and PDWORD' ??

help !
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 17

Expert Comment

ID: 10713574
place empty string

Author Comment

ID: 10713596
tried that, same message :(
and an emtpy pdword

Author Comment

ID: 10713623
Aha worked with a 0, gave you the points coz u came up with a descriptor (even though I had it anyway) but thanks for your help,
All the best,

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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