• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:08
CET 14:08
KST 22:08
  • 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
Behind the Blue - Team Liquid History Book15Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8herO wins SC2 All-Star Invitational14
Community News
ACS replaced by "ASL Season Open" - Starts 21/0218LiuLi Cup: 2025 Grand Finals (Feb 10-16)23Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker10PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)13
StarCraft 2
General
How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker Terran Scanner Sweep Behind the Blue - Team Liquid History Book Weekly Cups (Jan 12-18): herO, MaxPax, Solar win
Tourneys
RSL Season 4 announced for March-April LiuLi Cup: 2025 Grand Finals (Feb 10-16) PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) RSL Revival: Season 4 Korea Qualifier (Feb 14) Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth Mutation # 510 Safety Violation
Brood War
General
Which units you wish saw more use in the game? StarCraft player reflex TE scores [ASL21] Potential Map Candidates Gypsy to Korea ACS replaced by "ASL Season Open" - Starts 21/02
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Fighting Spirit mining rates Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta
Other Games
General Games
Path of Exile Diablo 2 thread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion
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
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Ask and answer stupid questions here! European Politico-economics QA Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ADHD And Gaming Addiction…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1853 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
uThermal 2v2 Circuit
12:00
Bonus Cup #3
uThermal308
Liquipedia
LiuLi Cup
11:00
2025 Grand Finals Playoffs
Clem vs MaruLIVE!
Rogue vs TriGGeR
ByuN vs Serral
ComeBackTV 1856
RotterdaM1845
PiGStarcraft555
IndyStarCraft 372
BRAT_OK 222
Rex161
3DClanTV 64
IntoTheiNu 28
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 1845
PiGStarcraft555
IndyStarCraft 372
uThermal 308
BRAT_OK 222
Rex 161
goblin 84
StarCraft: Brood War
Britney 45238
Barracks 6530
Jaedong 1540
Flash 1489
Hyuk 980
Soma 607
Stork 567
firebathero 440
Light 407
Soulkey 327
[ Show more ]
Snow 246
Rush 199
Last 170
Leta 142
Pusan 115
Killer 60
Aegong 57
sorry 53
Movie 49
Bonyth 39
Free 38
ToSsGirL 32
Sharp 31
Hm[arnc] 31
soO 29
Terrorterran 28
yabsab 25
Shine 23
JulyZerg 23
IntoTheRainbow 20
910 20
zelot 17
Shinee 17
HiyA 15
ivOry 11
Calm 0
Dota 2
Gorgc2894
singsing2120
XcaliburYe167
febbydoto9
Counter-Strike
olofmeister3295
fl0m1891
byalli440
Super Smash Bros
Mew2King94
Heroes of the Storm
Khaldor281
Other Games
B2W.Neo1043
crisheroes436
KnowMe55
ArmadaUGS45
Organizations
Counter-Strike
PGL22208
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH118
• Adnapsc2 7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• FirePhoenix7
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2855
Upcoming Events
PSISTORM Gaming Misc
3h 47m
RSL Revival
4h 52m
AI Arena Tournament
6h 52m
Replay Cast
10h 52m
Sparkling Tuna Cup
20h 52m
LiuLi Cup
21h 52m
Ladder Legends
1d 4h
Replay Cast
1d 10h
Replay Cast
1d 19h
Wardi Open
1d 22h
[ Show More ]
Monday Night Weeklies
2 days
OSC
2 days
WardiTV Winter Champion…
2 days
Replay Cast
3 days
WardiTV Winter Champion…
3 days
Replay Cast
4 days
PiG Sty Festival
4 days
The PondCast
4 days
KCM Race Survival
4 days
WardiTV Winter Champion…
4 days
Replay Cast
5 days
PiG Sty Festival
5 days
Epic.LAN
5 days
Replay Cast
6 days
PiG Sty Festival
6 days
CranKy Ducklings
6 days
Epic.LAN
6 days
Liquipedia Results

Completed

Escore Tournament S1: W8
Rongyi Cup S3
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
LiuLi Cup: 2025 Grand Finals
Nations Cup 2026
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

Escore Tournament S1: King of Kings
[S:21] ASL SEASON OPEN 1st Round
[S:21] ASL SEASON OPEN 1st Round Qualifier
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
WardiTV Winter 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
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.