• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 23:21
CET 05:21
KST 13:21
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
SC2 All-Star Invitational: Jan 17-1812Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises1Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4
StarCraft 2
General
SC2 All-Star Invitational: Jan 17-18 Chinese SC2 server to reopen; live all-star event in Hangzhou Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises Starcraft 2 Zerg Coach ComeBackTV's documentary on Byun's Career !
Tourneys
OSC Season 13 World Championship $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion What monitor do you use for playing Remastered? (UMS) SWITCHEROO *New* /Destination Edit/ What are former legends up to these days?
Tourneys
[Megathread] Daily Proleagues [BSL21] LB SemiFinals - Saturday 21:00 CET [BSL21] WB & LB Finals - Sunday 21:00 CET Small VOD Thread 2.0
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Game Theory for Starcraft Current Meta
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mechabellum Beyond All Reason Path of Exile
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 Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread 12 Days of Starcraft Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1100 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
The PiG Daily
21:15
Best Games of SC
SHIN vs sOs
Reynor vs Zoun
herO vs Classic
Solar vs Reynor
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 209
Nina 93
Ketroc 56
StarCraft: Brood War
Leta 208
ZergMaN 48
Noble 36
Hm[arnc] 30
Icarus 8
Dota 2
monkeys_forever413
LuMiX1
League of Legends
JimRising 684
C9.Mang0526
Counter-Strike
summit1g9652
tarik_tv5541
minikerr39
Super Smash Bros
hungrybox1904
Organizations
Other Games
gamesdonequick1238
BasetradeTV18
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH230
• practicex 1
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki10
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Scarra1330
Upcoming Events
OSC
2 days
Korean StarCraft League
2 days
OSC
3 days
IPSL
3 days
Dewalt vs Bonyth
OSC
3 days
OSC
4 days
uThermal 2v2 Circuit
4 days
Replay Cast
5 days
Patches Events
5 days
Liquipedia Results

Completed

Proleague 2025-12-29
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL Season 21
Slon Tour Season 2
CSL 2025 WINTER (S19)
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025

Upcoming

Escore Tournament S1: W2
Escore Tournament S1: W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Thunderfire SC2 All-star 2025
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
Underdog Cup #3
NA Kuram Kup
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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 © 2025 TLnet. All Rights Reserved.