• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:07
CEST 16:07
KST 23:07
  • 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
Code S Season 1 (2026) - RO4 & Finals Preview4[ASL21] Ro4 Preview: On Course12Code S Season 1 - RO8 Preview7[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13
Community News
Code S Season 1 (2026) - RO8 Results2Weekly Cups (May 4-10): Clem, MaxPax, herO win1Maestros of The Game 2 announcement and schedule !11Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12
StarCraft 2
General
Team Liquid Map Contest #22 - The Finalists Code S Season 1 (2026) - RO4 & Finals Preview Code S Season 1 (2026) - RO8 Results Code S Season 1 (2026) - RO12 Results MaNa leaves Team Liquid
Tourneys
GSL Code S Season 1 (2026) Sparkling Tuna Cup - Weekly Open Tournament KSL Week 89 2026 GSL Season 2 Qualifiers Maestros of The Game 2 announcement and schedule !
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 525 Wheel of Misfortune The PondCast: SC2 News & Results Mutation # 524 Death and Taxes Mutation # 523 Firewall
Brood War
General
vespene.gg — BW replays in browser Pros React to: TvT Masterclass in FlaSh vs Light BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion ASL21 General Discussion
Tourneys
[ASL21] Semifinals B [BSL22] RO8 Bracket Stage + Another TieBreaker [ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2
Strategy
Muta micro map competition Fighting Spirit mining rates [G] Hydra ZvZ: An Introduction Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Path of Exile Stormgate/Frost Giant Megathread Warcraft III: The Frozen Throne Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread YouTube Thread Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1424 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
Next event in 1h 53m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
LamboSC2 181
Railgan 90
elazer 49
Vindicta 44
StarCraft: Brood War
Britney 70784
Sea 14862
Calm 3600
Mini 988
Jaedong 843
EffOrt 761
ggaemo 651
Pusan 349
ToSsGirL 321
actioN 203
[ Show more ]
firebathero 191
Last 112
hero 103
Larva 99
Bonyth 85
Hyun 81
Sea.KH 80
JulyZerg 64
Movie 57
Backho 44
Sharp 39
Barracks 36
Aegong 21
Rock 17
GoRush 13
IntoTheRainbow 9
Icarus 7
Shine 6
Terrorterran 1
Dota 2
Gorgc7188
qojqva1213
syndereN188
Counter-Strike
olofmeister2499
Other Games
Grubby13752
singsing2319
Liquid`RaSZi1220
B2W.Neo604
Beastyqt457
Pyrionflax289
QueenE204
crisheroes179
Hui .145
monkeys_forever140
KnowMe117
XaKoH 112
Organizations
Counter-Strike
PGL97325
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• StrangeGG 59
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• HerbMon 2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis1861
Counter-Strike
• C_a_k_e 2654
Other Games
• WagamamaTV160
Upcoming Events
IPSL
1h 53m
Bonyth vs Napoleon
G5 vs JDConan
BSL
4h 53m
OyAji vs JDConan
DragOn vs TBD
OSC
9h 53m
Replay Cast
18h 53m
Monday Night Weeklies
1d 1h
Replay Cast
1d 9h
The PondCast
1d 19h
Kung Fu Cup
1d 20h
GSL
2 days
Replay Cast
3 days
[ Show More ]
GSL
3 days
WardiTV Spring Champion…
3 days
Replay Cast
4 days
Sparkling Tuna Cup
4 days
WardiTV Spring Champion…
4 days
Replay Cast
5 days
RSL Revival
5 days
Classic vs SHIN
Rogue vs Bunny
BSL
6 days
Replay Cast
6 days
Afreeca Starleague
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Escore Tournament S2: W7
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
SCTL 2026 Spring
RSL Revival: Season 5
Heroes Pulsing #1
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

YSL S3
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
WardiTV Spring 2026
2026 GSL S2
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 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.