• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:51
CEST 13:51
KST 20:51
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt2: News Flash8[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy13ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research6Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool49Weekly Cups (March 9-15): herO, Clem, ByuN win4
StarCraft 2
General
Weekly Cups (March 23-29): herO takes triple Aligulac acquired by REPLAYMAN.com/Stego Research Team Liquid Map Contest #22 - Presented by Monster Energy What mix of new & old maps do you want in the next ladder pool? (SC2) herO wins SC2 All-Star Invitational
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
Mutation # 519 Inner Power The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat
Brood War
General
Pros React To: SoulKey vs Ample BW General Discussion Build Order Practice Maps [ASL21] Ro24 Preview Pt2: News Flash BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro24 Group F [ASL21] Ro24 Group E 🌍 Weekly Foreign Showmatches [ASL21] Ro24 Group B
Strategy
Fighting Spirit mining rates What's the deal with APM & what's its true value Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread General RTS Discussion Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8664 users

[H] A quick C++(win32) question

Blogs > Ethenielle
Post a Reply
Ethenielle
Profile Blog Joined December 2005
Norway1006 Posts
September 16 2008 16:41 GMT
#1
Hello thar,

I'm learning to program Windows(still) and it's going ok - finally got the grasp on UNICODE(I think!). But I'm wondering a bit about functions that accept a pointer as an argument, CreateWindow for instance:

hwnd = CreateWindow (LPCTSTR lpClassName, LPCTSTR lpWindowName, ...);

As far as I've understood, LPCTSTR is a long pointer to a string, so I'd expect to pass it something like this:

TCHAR hi[] = TEXT("hello");
hwnd = CreateWindow(&hi, &hi, ...);

Or a pointer to that variable. But instead I can just pass the TCHAR variable and that's what works. What am I missing here?

Thanks in advance for any help!

Theres a fine line between fishing and just standing on the shore like an idiot.
Darthdrunken
Profile Joined January 2006
Germany50 Posts
Last Edited: 2008-09-16 17:03:25
September 16 2008 16:59 GMT
#2
As far as i remember LPCTSTR isn't a pointer but an actual String, so your definition of the variable hi is exactly the correct data-type(sorry i only know this expression in german but i think you'll get what i mean).
1a2a3atttgg
Aerox
Profile Blog Joined September 2004
Malaysia1213 Posts
September 16 2008 17:07 GMT
#3
LPCTSTR = Long Pointer to a Const TCHAR STRing ^^
"Eyes in the sky."
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
Last Edited: 2008-09-16 18:40:31
September 16 2008 18:38 GMT
#4
I think c++ has an implicit convert from an array of char(I think that's the type of a string literal) to a PChar
LiquipediaOne eye to kill. Two eyes to live.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
September 16 2008 18:39 GMT
#5
lmaooo xD
"come korea next time... FXO house... 10 korean, 10 korean"
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
Last Edited: 2008-09-16 18:46:55
September 16 2008 18:46 GMT
#6
Stroustrup on string literals:
The type of a string literal is ‘‘array of the appropriate number of const characters,’’ so "Bohr" is
of type "const char [5]".
A string literal can be assigned to a char *. This is allowed because in previous definitions of C
and C++ , the type of a string literal was char *. Allowing the assignment of a string literal to a
char* ensures that millions of lines of C and C++ remain valid. It is, however, an error to try to
modify a string literal through such a pointer
LiquipediaOne eye to kill. Two eyes to live.
Ethenielle
Profile Blog Joined December 2005
Norway1006 Posts
September 16 2008 19:11 GMT
#7
Aha, so that's how it is Thanks a lot for the help!

On September 17 2008 03:39 HeavOnEarth wrote:
lmaooo xD


Happy to entertain I guess ...?
Theres a fine line between fishing and just standing on the shore like an idiot.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
September 17 2008 04:35 GMT
#8
oh i was just like "lmao ( I DONT GET ANYTHING OF THIS) xD "
of course i didn't feel it necessary to post the parenthesis' part at the time!
"come korea next time... FXO house... 10 korean, 10 korean"
haduken
Profile Blog Joined April 2003
Australia8267 Posts
September 17 2008 05:07 GMT
#9
it's one of those C miseries that survived through the ages. You shouldn't really base your code on something like this but it's quite neat to know and it's one of the major causes of errors in code.
Rillanon.au
araav
Profile Blog Joined September 2004
Armenia1590 Posts
September 17 2008 07:00 GMT
#10
TCHAR hi[] = TEXT("hello");

&hi is a pointer to an array of TCHARs, which is not a pointer to TCHARs, which is expected by CreateWindow.
Instead, you would use hi, as it's an array, which is implicitely converted to TCHAR *.
Or you would use &hi[0] to explicitely state what you really want..

btw, an advice: use const for everything that are not going to change (hi).
The flower that blooms in adversity is the most rare and beautiful of all.
Divinek
Profile Blog Joined November 2006
Canada4045 Posts
September 17 2008 07:09 GMT
#11
On September 17 2008 13:35 HeavOnEarth wrote:
oh i was just like "lmao ( I DONT GET ANYTHING OF THIS) xD "
of course i didn't feel it necessary to post the parenthesis' part at the time!


Yeah, then the post might have some relevance to it. God forbid
Never attribute to malice that which can be adequately explained by stupidity.
Oh goodness me, FOX tv where do you get your sight? Can't you keep track, the puck is black. That's why the ice is white.
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
11:00
2026 Week 3
WardiTV359
RotterdaM338
IndyStarCraft 104
TKL 95
Rex73
SteadfastSC49
Liquipedia
Afreeca Starleague
10:00
Ro24 Group F
BeSt vs Leta
Queen vs Jaedong
Afreeca ASL 9383
StarCastTV_EN319
LiquipediaDiscussion
Replay Cast
09:00
KungFu Cup 2026 Week 2
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 338
Lowko244
SortOf 154
ProTech129
IndyStarCraft 104
TKL 95
Rex 73
SteadfastSC 49
StarCraft: Brood War
Britney 25175
Calm 12055
Bisu 5034
Flash 3346
EffOrt 764
Mini 459
Soma 448
Stork 339
actioN 306
Hyuk 280
[ Show more ]
Zeus 274
PianO 223
Hyun 170
Dewaltoss 154
Soulkey 147
Last 122
Killer 116
Snow 114
Mind 113
Rush 104
ggaemo 102
Sharp 100
hero 86
JYJ 65
ToSsGirL 54
JulyZerg 37
Barracks 36
sSak 34
Shine 34
Icarus 20
scan(afreeca) 20
yabsab 19
Sacsri 18
Shinee 18
Hm[arnc] 18
GoRush 13
Noble 13
soO 12
Movie 9
Terrorterran 8
ajuk12(nOOB) 8
Dota 2
XaKoH 628
canceldota272
Counter-Strike
olofmeister2225
zeus684
byalli586
x6flipin313
edward94
Other Games
singsing1714
B2W.Neo371
crisheroes242
Sick174
Organizations
StarCraft: Brood War
UltimateBattle 248
lovetv 16
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 25
• CranKy Ducklings SOOP3
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota259
League of Legends
• Jankos1738
Other Games
• WagamamaTV323
Upcoming Events
Replay Cast
12h 9m
The PondCast
22h 9m
OSC
1d 12h
RSL Revival
1d 22h
TriGGeR vs Cure
ByuN vs Rogue
Replay Cast
2 days
RSL Revival
2 days
Maru vs MaxPax
BSL
3 days
RSL Revival
3 days
uThermal 2v2 Circuit
4 days
BSL
4 days
[ Show More ]
Replay Cast
5 days
Sparkling Tuna Cup
5 days
Liquipedia Results

Completed

CSL Season 20: Qualifier 1
WardiTV Winter 2026
NationLESS Cup

Ongoing

BSL Season 22
CSL Elite League 2026
ASL Season 21
CSL Season 20: Qualifier 2
RSL Revival: Season 4
Nations Cup 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

Escore Tournament S2: W1
CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
StarCraft2 Community Team League 2026 Spring
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.