Questions tagged [lpcwstr]

LPCWSTR - Pointer to const wchar_t string

62 questions
1
vote
3 answers

LPCWSTR ERROR C++ argument of type is incompatible with parameter of type

#include #include #include "sharedmemory.h" #pragma comment (lib, "ws2_32.lib") using namespace std; #define MAP_OBJECT_NAME "$pcars2$" void main(int argc, char* argv[]) { HANDLE fileHandle =…
1738Booth
  • 13
  • 2
1
vote
1 answer

Anybody know a non-ascii encoding?

'1' use two bytes 20 and 0; '2' use two bytes 21 and 0; 'a' use two bytes 68 and 0; 'b' use two bytes 69 and 0; I'm hook func ExtTextOutW from GDI32.dll(windowsapi) ,and read from str(unsigned char); such as abc123... while got:68 0 69 0 70 0 20 0…
mouwang
  • 31
  • 4
1
vote
3 answers

LPCWSTR to char* and vice versa

I'm working on a simple project with DirectX9. I'm having a little snag with some conversion of data types, and I've done some research, but haven't found anything particularly useful. Let's start with the code: LPDIRECT3DSURFACE9 LoadSurface(char…
Uchiha Itachi
  • 1,251
  • 1
  • 16
  • 42
1
vote
3 answers

CGO: Convert between LPCWSTR and string

I'm writing CGO bindings for a library which uses LPCWSTR for all of its string types. How do I convert from C.LPCWSTR to string and vice-versa?
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160
1
vote
5 answers

Visual Studio 2015 WinAPI error on MessageBox

I created a basic Windows C++ application in Visual Studio 2015 and I have a few errors: #include #include #include #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR…
Vento
  • 37
  • 3
  • 9
1
vote
1 answer

Am I correctly pointing a PCWSTR to a string literal?

I'm a bit rusty with C++ so I'm looking for help with a string pointer question. First, let's consider some pointer basics with an integer: void SetBob(int* pBob) { *pBob = 5; } int main(int argc, _TCHAR* argv[]) { int bob = 0; …
Craig
  • 1,890
  • 1
  • 26
  • 44
1
vote
4 answers

Check if file existing or not in c

prgchDirPath is char pointer. But expected is LPCWSTR. How to change this? prgchDirPath is a directory path. File is not existed. But I want to make sure if directory/path exists or not. Can the API below helps me? if yes, how? unsigned char…
SHRI
  • 2,406
  • 6
  • 32
  • 48
1
vote
1 answer

C++ lpcwstr to wstring

I would like to convert a LPCWSTR to wstring in C++ (VS 2010). I want to use this in OutputDebugStringW(). Thank you.
tmighty
  • 10,734
  • 21
  • 104
  • 218
1
vote
1 answer

store a variable that holds user input data in sapi5 speak function

I am developing an application that uses the Microsoft SAPI5 speech engine. However, I have hit a wall. I've been trying to use the data from the variable that stores the input from the user so the TTS engine can repeat it. But the sapi5 speech…
S3pHiRoTh
  • 103
  • 5
1
vote
0 answers

Wsutil.exe (Native Web Services Compiler): WCHAR* vs LPCWSTR for xsd:string type

Is there a good reason for the native web services compiler to generate a WCHAR * for an xsd:string vs a const wchar_t* (or LPCWSTR in short)? The reason I state this question is that ours is a native c++ application which has std::wstrings…
Raghu
  • 21
  • 3
0
votes
1 answer

How convert LPCWSTR to wchar_t*?

I require to convert a LPCWSTR data to wchar_t*. I tried a bunch of methods, and some work, but when I try to get their code page, they are showing different values. Code overview: std::string ChineseCharacter(LPCWSTR Data) //Data value: "丂\n" { …
Ferrus
  • 15
  • 6
0
votes
2 answers

Why do I get "argument of type "LPCSTR" is incompatible with parameter of type "LPCWSTR" error when code compiles fine?

I am working on the following function: int initSerialPort(HANDLE* hSerialPort, LPCSTR portName){ *hSerialPort = CreateFile( portName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, …
user16541120
0
votes
1 answer

I am getting this error message - a value of type "const char *" cannot be assigned to an entity of type"LPCWSTR"

These are the lines of code that are causing the error: WndClass.lpszClassName = "WinProg"; and hWindow = CreateWindow("WinProg", "Window", WS_OVERLAPPEDWINDOW, 0, 0, 400, 400, NULL, NULL, hInstance, NULL); I don't know how to "fix" this…
KenReid
  • 1
  • 1
0
votes
1 answer

Converting LPCSTR to LPCWSTR in C++, ATL not available

Before I start, Please do understand that this question is not a duplicate. There are questions out there with the same header : Convert LPCSTR to LPCWSTR However, I did some research before asking this question and came across ATL or Active…
0
votes
0 answers

C++ path and file management with Regex

Does anybody knows why it is not extracting the mp3 from the path. szFile is a complete path to the file. Is there a more secure way to convert the data type ? I am new to coding in C++ and I do not know hot to manage well the data types conversion,…
Miguel Estrada
  • 31
  • 1
  • 1
  • 8