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
2
votes
3 answers

Convert char[] array to LPTSTR in vc++

I want to use the Win API CreateProcess for which accepts 2nd parameter as "LPTSTR". But I've the path to my exe in a char array. My VS2013 project (static library) is Unicode encoding type. Code snippert below. IN this line "appPath =…
codeLover
  • 3,720
  • 10
  • 65
  • 121
2
votes
1 answer

convert LPTSTR to string

I am getting text from a Window and it returns in LPTSTR. I have to turn it into string or else I have to rewrite a lot of my code. Also What is a LPTSTR and how is it different from a string?
user2407956
  • 61
  • 1
  • 1
  • 4
2
votes
1 answer

Converting contents of a byte array to wchar_t*

I seem to be having an issue converting a byte array (containing the text from a word document) to a LPTSTR (wchar_t *) object. Every time the code executes, I am getting a bunch of unwanted Unicode characters returned. I figure it is because I am…
1
vote
2 answers

LPTSTR contains only one letter

I'm creating a DLL for a application. The application calls the DLL and receives a string from 8 to 50 in length. The problem I'm having is that only the first letter of any message the application receives is shown. Below is the GetMethodVersion…
PonWer
  • 87
  • 1
  • 7
1
vote
2 answers

Concatenating LPTSTR with const char* (Win32 C++)

I wish to be able to open a file in my Win32 application. The method I am using is retrieving the root path from an edit box e.g. "C:\MyFolder" (this is assigned to strPathToSource). Then I want to append another string e.g.…
petehallw
  • 1,014
  • 6
  • 21
  • 49
1
vote
1 answer

LPTSTR Losing Scope, work around not working (C++)

EDIT: Solution was to replace LPTSTR to wstring. When Windows API required LPTSTR the wstring is casted with .c_str() My problem is, a variable (LPTSTR) is going out of scope and I can't fix it. I'll explain... In my code I am trying to save the…
Chris Est
  • 17
  • 6
1
vote
0 answers

Creating and Saving New Photos Win32 Webcam Application

I am trying to make my webcam Win32 application save more than one photo at a time i.e. save one photo then another then another etc. To do this, I am appending a string to an integer variable so that each new photo name can be unique and conform to…
user3295336
  • 51
  • 10
1
vote
1 answer

Convert QString to LPTSTR, only first character shows up

I'm trying to convert the following QString : QString nom, prenom, promo; ... QString modelName = nom + "_" + prenom + "_" promo; into a LPTSTR. So far, I've used this: LPTSTR mm = (LPTSTR) modelName.utf16(); But the LPTSTR returned contains only…
Remy San
  • 525
  • 1
  • 4
  • 24
1
vote
2 answers

static LPTSTR variable loses value after function execution

I'm writing C++ dll on Visual studio 2013. My dll should read parameters from ini file. So, I've created a function for this purpose (ReadConnectionSettings()). My static variable serverIP gets value properly during the function working, however…
Nurzhan Aitbayev
  • 797
  • 1
  • 10
  • 23
0
votes
1 answer

strcmp to compare LPCTSTR and string

I'm trying to compare in my C-program a string and a LPCTSTR. Here's what i've done so far (the code has been simplified to only what's problematic) : DWORD main(DWORD ac, LPCTSTR *av) { DWORD cpt = 1; while (++i < ac) { if…
BMN
  • 8,253
  • 14
  • 48
  • 80
0
votes
1 answer

Const Char to LPTSTR

I have looked for similar problems but none are in the context I require. The odd thing with this is that I get this error yet a different project set out in code the same way seems to work perfectly. I am trying to load images into textures in…
Mike Tarrant
  • 291
  • 2
  • 7
  • 19
0
votes
1 answer

Wrong value for LPCTSTR variable (?)

I have this method on a C++ project long CPPProject::CPPMethod(long lValue, LPCTSTR Data){ do something... } But, when I consume the method via a C# project, sometimes the value of Data is '?' For example: C# code: String sText1 = "u0110…
Ferrus
  • 15
  • 6
0
votes
1 answer

Using std::copy with LPTSTR type argument

I'm using Win32 API and I need to copy arguments captured with argv, the problem is, the code has to be compliant with both ASCII and UNICODE and that's a problem with C/C++ in Windows. Beyond that I must use, when possible, C++ instead of C, so I'm…
anastaciu
  • 23,467
  • 7
  • 28
  • 53
0
votes
2 answers

C++ LPTSTR problem calling CreateProcessAsUser with getenv

I am trying to call function CreateProcessAsUser. Passing constant string is fine. Trying to pick up an Environment variable using char* getenv(const char name) is causing me a problem. If I use the following, notepad.exe will…
fred
  • 18
  • 4
0
votes
0 answers

How do I keep percent signs (%) copying from LPCTSTR to LPTSTR?

I am a beginner in this and after a lot of frustration I finally had the courage to ask to all of you, the true professionals. I need to keep all the percent signs (%) I receive from a LPCTSTR when I copy it to a LPTSTR. After some researching and…