Questions tagged [lpcwstr]

LPCWSTR - Pointer to const wchar_t string

62 questions
0
votes
4 answers

Memory reference scope issue: Variable value getting reset, How to Assign value to LPCWSTR?

I am a beginner cpp programmer. I am converting string value to LPCWSTR. When i am trying to access this value, it is giving a null value. Please check this code attached below. I think this is because of memory reference value is clearing out after…
jaguar
  • 25
  • 3
0
votes
3 answers

Using, StringCchCat

I'm trying to use the StringCchCat function: HRESULT X; LPWSTR _strOutput = new wchar_t[100]; LPCWSTR Y =L"Sample Text"; X = StringCchCat(_strOutput, 100, Y); But for some reason I keep getting the "E_INVALIDARG One or more…
Math4123
  • 1,267
  • 4
  • 12
  • 23
0
votes
2 answers

Can't set windows name

So I tried to put together a window, but when I needed to name the window I told me. (Error: argument of type “const char*” is incompatible of type “LPCWSTR”) Programming for the CreateWindow method is underneath. Error should be in line 2. hwnd =…
10emil10
  • 11
  • 4
0
votes
1 answer

Have a PCWSTR and need it to be a WCHAR[]

I am re-writing a C++ method from some code I downloaded. The method originally took a PCWSTR as a parameter and then prompted the user to enter a file name. I modified the method to take two parameters (both PCWSTR) and not to prompt the user. I am…
Nick O
  • 39
  • 4
0
votes
2 answers

cannot convert cont char* to LPCWSTR

I am stuck with an error in QT compiler however it works fine with VS2010. the error states that I have seen other posts related to the same error but non has resolved my problem in QT. I have tried _T,L or TEXT but still not working bq. error:…
habbas33
  • 37
  • 3
  • 8
0
votes
2 answers

Retrieving VolumeDetails of WINDOWS Drives - stuck with 'char []' to 'LPCWSTR' conversion

I am trying to get the VolumeDetails of my WINDOWS system- Drive label plus its respective Volume Serial number. I've tried since an hour and built a code which gone wrong in syntax. At present I am getting the following error with it- error C2664:…
highlander141
  • 1,683
  • 3
  • 23
  • 48
0
votes
2 answers

LPCWSTR error; is there a better solution?

I have the following c++ code, and it seems like everywhere I attempt to put a string, I have to convert it in order to avoid a `Cannot conver parameter 2 from 'const char[x] to LPCWSTR. I know I can fix this issue by doing a simple conversion, but…
Volearix
  • 1,573
  • 3
  • 23
  • 49
0
votes
1 answer

LPCWSTR will not Cast Correctly on TextOut() Method

Entire Code snippet... #include #include #include using namespace std; //========================================================= // Globals. HWND ghMainWnd = 0; HINSTANCE ghAppInst = 0; struct TextObj { string s;…
Volearix
  • 1,573
  • 3
  • 23
  • 49
0
votes
1 answer

C++ Pointer to substring

I want to get the wstring from a pointer to a text for which an offset and a length is given. typedef struct SPVTEXTFRAG { struct SPVTEXTFRAG *pNext; SPVSTATE State; LPCWSTR pTextStart; ULONG ulTextLen; ULONG ulTextSrcOffset; }…
tmighty
  • 10,734
  • 21
  • 104
  • 218
0
votes
1 answer

c++ RegCreateKeyEx LPCWSTR from std::string

I'm writting few operations in registry and I got stuck for two days at this. Really don't know how to solve that. So, its my code: HKEY hkey; DWORD dwDisposition; string address =…
pablo7890
  • 65
  • 9
0
votes
1 answer

MessageBoxW cannot convert

I am using wxWidgets 2.9.4 in Visual Studio 2012 and I keep getting these two error messages: Error 1 error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR' IntelliSense: argument of type "const char *" is…
0
votes
1 answer

C win32 api unicode to ascii

Possible Duplicate: How do you convert LPCWSTR to const char *? I have a function that gets a LPCWSTR string for win32 api usage. Now I have a function that sends data in ASCII to the IRC server. So now I need to convert it to ASCII, I haven't…
TryTech
  • 41
  • 2
  • 3
0
votes
2 answers

Corrupted vector entries with LPCWSTR vector

I ahve the following piece of code. I get a correctly filled vector. But I am unable to print or use the vector contents which are file names from a directory. As soon as I do enter the first iteration. Everything gets lost. What am I doing…
user349026
-1
votes
1 answer

C++ How do I create a timestamped directory using a filepath held in a string?

I am trying to set up a program which can create a new directory every time it is used to fill with data. I want the name of the folder to be a timestamp of when it was created. I have already written a function which creates the timestamp and…
UoM Dan
  • 15
  • 4
-1
votes
1 answer

How to use FindFirstFile

I keep getting compile errors with the line at the bottom hFind = FindFirstFile(fileFilter.c_str()), &FindFileData); The compiler keeps throwing error C2664 back at me, : cannot convert argument 1 from 'const char *' to 'LPCWSTR' How do I create…