Questions tagged [lpcwstr]

LPCWSTR - Pointer to const wchar_t string

62 questions
0
votes
2 answers

Argument of type "LPCWSTR" is incompatible of the parameter of type "LPCSTR"

Can somebody please tell me why i'm getting an error. I've been trying to figure this out for a bit now. LPCWSTR drive2[4] = { L"C:\\", L"D:\\", L"E:\\", L"F:\\" }; int i; UINT test; for (i = 0; i<12; i++) { …
Andy
  • 43
  • 6
0
votes
0 answers

LPCSTR to LPCWSTR converting

I have created implemetation of converting LPCSTR to LPCWSTR LPSTR W2S(LPCWSTR str) { LPSTR strTo; char* szTo = (char*)HeapAlloc(GetProcessHeap(), 0, lstrlenW(str) + 1); szTo[lstrlenW(str)] = '\0'; WideCharToMultiByte(CP_ACP, 0, str,…
korozya
  • 17
  • 6
0
votes
1 answer

Problem with the L prefix ( LPCWSTR typecast) in winAPI

I'm new to winAPI and encountered a problem I can't seem to solve... Couldn't find a solution by google yet, either. My program has several buttons of similar size so I made a macro to hide all the mess. The original macro was: #define _BUTTON(s, x,…
Rosh
  • 21
  • 3
0
votes
2 answers

error C2440: '=': cannot convert from 'const char *' to 'LPCWSTR'

I'm new to using Visual Studio and need to compile an application but I'm getting the error: error C2440: '=': cannot convert from 'const char *' to 'LPCWSTR' on line: std::string open_file_dialog( std::string title, std::string filter) { …
stdcerr
  • 13,725
  • 25
  • 71
  • 128
0
votes
1 answer

C++: Native to Managed String Conversion Problem (Maybe Character Set)?

I'm having a problem returning a native string in the correct character-set. I convert from a string to a wstring to an LPCWSTR to pass back to managed. For the string to wide-string, the s2ws method produces a very small string return because it…
renholder
  • 25
  • 2
0
votes
1 answer

c++ casting string to LPCWSTR in parameter

I can see that i can cast a string type to LPCWSTR in a parameter like this: myfunc(L"mystring"); But suppose i want to pass a string as a variable this time, how would i cast it with ease like above (not converting the variable): string…
jimmy
  • 73
  • 1
  • 7
0
votes
2 answers

LPCWSTR to string conversion issue in code c++ VS 2010

I am trying to find files with specific name and deleting them in c++ as this code works fine if i give direct desktop path to it L"path//" but as path of desktop is different due to different user and system so i what i am doing at the top is to…
0
votes
1 answer

'Cannot add two pointers' adding LPCWSTR with WCHAR

I declared two variable like: WCHAR w_ErrorMessage[256]; LPCWSTR lp_ErrMsg; The first variable is for returned SQLite error message, And the second variable is for MessageBox text. I tried and wrote this code: lp_ErrMsg = L"Database sql error: " +…
0
votes
1 answer

how to convert LPCWSTR and char?

SetTextColor(hdc, RGB(0, 0, 0)); char str[20]=""; sprintf(str, "sorce: %d", sorce); TextOut(hdc, 930, 810, str,strlen(str)); It showed the error that char* cannot be converted to LPCWSTR. How can I solve it?
Michael Tsai
  • 751
  • 2
  • 11
  • 21
0
votes
3 answers

convert a STRING from LPCWSTR and vice versa c++

I want to compare a LPCWSTR with a value to ensure they're equal. And I can't figure out how to compare it. I create a STRING value and tried various conversions but nothing worked. Essentially it would be: request->id // some LPCWSTR value STRING…
revitenthusiast
  • 15
  • 1
  • 1
  • 7
0
votes
1 answer

Manipulate LPCWSTR in c

I have a given LPCWSTR variable, which holds a full path. I want to extract from it only the file name. Any suggestions how can I manipulate the LPCWSTR to achieve that? In addition - How can I get the char in a specific index of the LPCWSTR? Thank…
rrrrr
  • 47
  • 5
0
votes
1 answer

How to use type LPCWSTR in masm

I am new to the msdn library and masm. After invoking NetUserAdd, I am trying to invoke NetLocalGroupAddMembers, but it requires type LPCWSTR for the group name. I think that is why my account I create is not visible and still does not appear after…
jinan
  • 173
  • 1
  • 10
0
votes
1 answer

Defining wstring after calling / concatenating LPCWSTR

I'm tried defining a wstring within a case statement. And trying to access the variable out of the case statement return out of scope. So I'm now trying to declare a wstring outside of the switch() and define it within the switch(). But I don't…
Jean Valjean
  • 747
  • 1
  • 9
  • 30
0
votes
2 answers

argument of type WORD* is incompatible with parameter of type LPCWSTR

The problem is &cursorTile.Attributes. The error I am getting is (argument of type "WORD*" is incompatible with parameter of type "LPCWSTR") I have tried to find some solutions, I am using multi-byte character set. void CMap::Draw(){ SMALL_RECT…
0
votes
2 answers

Expression: string iterators incompatiable, when calling "SetDllDirectory"

I'm receiving following error: Debug Assertion Failed! Expression: string iterators incompatible When trying to run such a code: std::string string_Dir(){return ".\\Dir\\";} std::wstring wstring_Dir=std::wstring( string_Dir().begin() …
Megidd
  • 7,089
  • 6
  • 65
  • 142