errorC2664:'StartServiceW':cannot convert paramter from 'const char **' to 'LPCWSTR*

Discussion in 'C' started by rag84dec, Nov 9, 2009.

  1. rag84dec

    rag84dec New Member

    Joined:
    Jul 17, 2007
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    HI all,

    I have problem while compiling the following code which i copied from the
    below location. i downloaded the source code and opened in visual studio 2008
    and compiled , it worked fine. but i tried creating my own project of Win32
    console application type but i started getting the following error...

    Downloaded the code from the below link...
    http://www.codeproject.com/KB/system/Sund_WindowService.aspx


    I included following header files.
    Code:
    #pragma once
    
    
    #include <process.h>
    #include <iostream>
    #include <tchar.h>
    #include <stdio.h>
    #include <windows.h>
    #include <winbase.h>
    #include <winsvc.h>
    

    Code:
    error C2664: 'StartServiceW' : cannot convert parameter 3 from 'const char **' to 'LPCWSTR *'
    error C2664: 'OpenServiceW' : cannot convert parameter 2 from 'char *' to 'LPCWSTR'
    error C2664: 'OpenServiceW' : cannot convert parameter 2 from 'char *' to 'LPCWSTR'
    error C2440: 'initializing' : cannot convert from 'CHAR [501]' to 'LPWSTR'
    
     
    Last edited: Nov 9, 2009
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    Re: errorC2664:'StartServiceW':cannot convert paramter from 'const char **' to 'LPCWS

    You're using a UNICODE build. You need wide strings (wchar_t) instead of multi-byte strings (or turn off UNICODE in your project).
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice