Questions tagged [lptstr]

L‌ong P‌ointer to a T‌CHAR STR‌ing

L‌ong P‌ointer to a T‌CHAR STR‌ing (A long pointer is the same as a pointer now. There were two flavors of pointers under 16-bit windows.)

LPTSTR = char* or wchar_t* depending on _UNICODE

From B. Kramer on MSDN forum

34 questions
15
votes
8 answers

Convert lptstr to char*

Would anyone happen to know how to convert type LPTSTR to char * in C++?
user37875
  • 13,904
  • 9
  • 37
  • 43
8
votes
2 answers

error C3861: '_tcsdup': identifier not found

This is my first time and I'd like to make a parallel process using the windows CreateProcess function. Based on the example at MSDN I created a LPTSTR "(non-const) TCHAR string" command line argument like this LPTSTR szCmdline[] =…
forest.peterson
  • 755
  • 2
  • 13
  • 30
8
votes
2 answers

Converting from const char * to LPTSTR without USES_CONVERSTION

I am trying to convert const char * to LPTSTR. But i do not want to use USES_CONVERSION to perform that. The following is the code i used to convert using USES_CONVERSION. Is there a way to convert using sprintf or tcscpy,…
Santron Manibharathi
  • 628
  • 5
  • 12
  • 26
7
votes
2 answers

What is Linux equivalent of LPTSTR & LPCSTR?

I am converting windows library to linux. I need to find LPTSTR and LPCSTR in linux. I get to know that i can use wchar_t can be used but I am not really sure about using it. one of the method that uses LPTSTR is as follows: void ErrorExit(LPTSTR…
jparthj
  • 1,606
  • 3
  • 20
  • 44
6
votes
3 answers

How do I convert an LPTSTR to an LPCSTR?

So the output of the function GetUserName() gives the username as a LPTSTR. I need to convert this to a LPCSTR, as I want the username to be the name of the an ftpdirectory. TCHAR id [UNLEN+1]; DWORD size = UNLEN+1; GetUserName(id, &size); // this…
Rob
  • 175
  • 3
  • 3
  • 12
4
votes
3 answers

P/Invoke with [Out] StringBuilder / LPTSTR and multibyte chars: Garbled text?

I'm trying to use P/Invoke to fetch a string (among other things) from an unmanaged DLL, but the string comes out garbled, no matter what I try. I'm not a native Windows coder, so I'm unsure about the character encoding bits. The DLL is set to use…
kodbuse
4
votes
3 answers

How to convert a string to LPTSTR

I need to create a variable to use in the CreateProcess: CreateProcess(z7Cmdline, z7Arg, NULL, NULL, FALSE, NULL, NULL, NULL, &startInfo, &processInfo); The variable z7Arg is a argument list for 7 -zip which contains a file name based on the…
MosheMaurice
  • 41
  • 1
  • 2
3
votes
5 answers

LPTSTR to int (c++)

I'm passing some numeric arguments while creating a process (in VC++) I'm stuck at converting LPTSTR to int. Thanks in advance.
Kamil Zadora
  • 2,367
  • 6
  • 34
  • 43
3
votes
2 answers

How does one convert LPTSTR to LPCTSTR?

I need to convert: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839(v=vs.85).aspx lpstrFileTitle Type: LPTSTR The file name and extension (without path information) of the selected file. This member can be NULL. Even though in…
User
  • 659
  • 2
  • 12
  • 29
3
votes
3 answers

C++: convert LPTSTR to char array

Possible Duplicate: Convert lptstr to char* I need to convert an LPTSTR p to CHAR ch[]. I am new to C++. #include "stdafx.h" #define _WIN32_IE 0x500 #include #include #include #include using namespace…
Oleksandr Fentsyk
  • 5,256
  • 5
  • 34
  • 41
2
votes
2 answers

How to transform const wchar_t type to LPTSTR (C++)

I am trying to modify an old plugin to create a new one (in C++ and Visual Studio 2019). When I compile I get the following error marking TEXT in red. E0144: A value of type "const wchar_t *" cannot be used to initialize an entity of type…
Lluís
  • 55
  • 1
  • 7
2
votes
1 answer

C++ Read file from disk and write it into shared memory

My goal is to achieve the following: I want to read a file from disk (let's say it's an image file) and to write it into shared memory so I can read it from the shared memory from another process. First I followed this msdn tutorial to create a…
Jdv
  • 962
  • 10
  • 34
2
votes
2 answers

AfxMessageBox - Access violation

Here is what is going on. When I try and run an AfxMessageBox from my CDialog extension class, I get an errror (see below). I've googled the internet but come up short. This is the only place the messagebox fails, and I know the rest of the code…
Dan G
  • 165
  • 1
  • 13
2
votes
1 answer

Cannot assign lpCmdLine parameter to a char* pointer

This code check run application this param: INT APIENTRY _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT iShow) { char* szCmdLine = lpCmdLine; ... } Error this lines : error C2440: 'initializing' cannot convert from…
Endy3k
  • 69
  • 2
2
votes
1 answer

C++ LPCTSTR how to pass command line args to child process

LPCTSTR applicationName = NUL // NULL => module name from command line string argument1 = "something"; string argument2 = "anotherthing"; LPTSTR commandLine = "childpath\\child.exe"; success =…
1
2 3