Thread: CreateProcess parameters

  1. #1
    Registered User
    Join Date
    May 2006

    CreateProcess parameters

    I just tried compiling a release version of my program in VC++ 2005 express and got the following error:

    .\pconnect.cpp(58) : error C2664: 'CreateProcessW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    It is from this line of code:
    if ((CreateProcess(szPath, pszParam, 0, 0, TRUE,
                                CREATE_DEFAULT_ERROR_MODE|CREATE_NO_WINDOW, 0, 0, &siStartupInfo,
    							&piProcessInfo)) != false)
    this doesnt occur when I compile for debug. Just wondering why this happens and an easy way to fix it. Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > cannot convert parameter 1 from 'char *' to 'LPCWSTR'
    The 'W' means it's expecting a WIDE string, which probably means you've got UNICODE turned on somewhere.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    UNICODE is the default of the compiler...

    go to your project settings and under general the 3rd one from the bottom up change it to "Use Multi-byte character set"
    My Website
    Add Color To Your Code!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 07-21-2008, 06:04 AM
  2. function with variable number of parameters
    By mikahell in forum C++ Programming
    Replies: 3
    Last Post: 07-23-2006, 03:35 PM
  3. Additional parameters for operator delete
    By darksaidin in forum C++ Programming
    Replies: 0
    Last Post: 09-21-2003, 11:46 AM
  4. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM
  5. CreateProcess
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 05-12-2002, 06:45 AM