For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > cannot convert from 'System::String' to 'LPCSTR'









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cannot convert from 'System::String' to 'LPCSTR'
Owen Corpening

2005-06-07, 3:58 am

I am trying to use Managed C++ to get the dir from which my .msi was
launched and set a property with that value. I am pretty lost. I have no
clue if I am even on the right track, but this all seems so simple. Right
now the last line below - I can't get the 3rd arg right. It needs to be an
LPCSTR.

String *cdromDir = NULL;

if ((status = getInstallProperty(hInstall, "OriginalDatabase",
&imageLocation)) != ERROR_SUCCESS) return status;

cdromDir = Path::GetDirectoryName(imageLocation);

USES_CONVERSION;

MsiSetProperty(hInstall, "CDROMDIR", A2W(*cdromDir));



Thanks,

owen


Doug Harrison [MVP]

2005-06-07, 3:58 am

On Mon, 6 Jun 2005 23:25:32 -0500, Owen Corpening wrote:

> I am trying to use Managed C++ to get the dir from which my .msi was
> launched and set a property with that value. I am pretty lost. I have no
> clue if I am even on the right track, but this all seems so simple. Right
> now the last line below - I can't get the 3rd arg right. It needs to be an
> LPCSTR.
>
> String *cdromDir = NULL;
>
> if ((status = getInstallProperty(hInstall, "OriginalDatabase",
> &imageLocation)) != ERROR_SUCCESS) return status;
>
> cdromDir = Path::GetDirectoryName(imageLocation);
>
> USES_CONVERSION;
>
> MsiSetProperty(hInstall, "CDROMDIR", A2W(*cdromDir));


See:

How To Convert from System::String* to Char* in Visual C++ .NET
http://support.microsoft.com/?kbid=311259

--
Doug Harrison
Microsoft MVP - Visual C++
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com