Win32 API Calls - LPTSTR and LPCTSTR?

Blitz3D Forums/Blitz3D Programming/Win32 API Calls - LPTSTR and LPCTSTR?

Serpent(Posted 2009) [#1]
I have done a lot of searching and haven't found a lot of answers.

Basically, I am trying to use Win32 API calls to find out the executable name of my Blitz3D program. This is important because it needs to know its own name even when somebody renames it.

Unfortunately, no matter where I look to with the APIs, these two data types - 'LPTSTR' and 'LPCTSTR' - keep appearing.

All that I have been able to find is that - I think - LPTSTRs are 'Null-Terminated' (end in a '0' byte?)

Anyway, two things:
First of all, can anybody explain what these data types are? (format in memory, etc.)
Secondly, is there a way to use them in Blitz3D - i.e. allow the use of API calls with these data types.

Thanks everyone.


xlsior(Posted 2009) [#2]
Does this work in B3D?

http://www.blitzbasic.com/Community/posts.php?topic=49751#560283


Serpent(Posted 2009) [#3]
Thanks for finding that - I'll see if it works.


Serpent(Posted 2009) [#4]
Okay - although this doesn't answer my question about what LPTSTRs and LPCTSTRs are, I know what I did wrong in my code. I didn't know that you used an asterisk in the .decls file for an LPTSTR! I'd already seen using banks somewhere else before.

That works very well - can't believe I couldn't find it. Thanks xlsior.

If anyone knows more about these data types could you please help me understand them? This looks more like a post for the General Discussion forum or something now... Thanks for the help.


SebHoll(Posted 2009) [#5]
LPTSTR

LPTSTR is a 32-bit pointer to a null-terminated string of 16-bit Unicode characters. This type is declared as follows: typedef WCHAR* LPTSTR;



Rroff(Posted 2009) [#6]
EDIT: nm should have read the link above


Rroff(Posted 2009) [#7]
nm


xlsior(Posted 2009) [#8]
That works very well - can't believe I couldn't find it. Thanks xlsior.


It took me a lot longer to dig up than I'd expected too, figured it shouldn't be too hard to find, but I was wrong. :-?

Good to hear that it worked for you, though.


jfk EO-11110(Posted 2009) [#9]
I't amazing how these fundamental infos are sometimes burried deep under tons of stuff.

At least, LPTSTR isn't that cryptic, it's (L)ong (P)oin(T)er to a (STR)ing.