Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   errorC2664:'StartServiceW':cannot convert paramter from 'const char **' to 'LPCWSTR* (http://www.go4expert.com/forums/errorc2664startservicewcannot-convert-t20032/)

rag84dec 9Nov2009 20:48

errorC2664:'StartServiceW':cannot convert paramter from 'const char **' to 'LPCWSTR*
 
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...owService.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'


Gene Poole 10Nov2009 21:15

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).


All times are GMT +5.5. The time now is 05:02.