Click here to Skip to main content

Clever Code

RSS Feed RSS feed

Showcase your best code, your most elegant solution, or your most hard fought subtle bug you've found and fixed. Please, do not post programming questions in this forum - they will be removed.

 
AnswerHow about doing this instead... PinmemberDaniel Flower2-Nov-09 2:54 
GeneralRe: How about doing this instead... PinmemberPIEBALDconsult2-Nov-09 4:13 
General(C++) Trick or Treat ( Make/Expand our tricks.h file) [modified] PinmemberDaniel L Kelly12-Oct-09 15:24 
GeneralRe: (C++) Trick or Treat ( Make/Expand our tricks.h file) [modified] PinsitebuilderMichael Dunn13-Oct-09 9:13 
For quick loading of string resources:
#define _S(id) (CString(LPCTSTR(id)))
And use it like this:
MessageBox ( hwnd, _S(IDS_TITLE), _S(IDS_MESSAGE), MB_OK );
This constructor trick is actually documented, although I haven't seen it used too often. Note that this macro is the release version; the debug version is a real function that checks whether the LoadString() succeeds.
 
--Mike--
Dunder-Mifflin, this is Pam.
modified on Thursday, October 22, 2009 6:36 PM

GeneralRe: (C++) Trick or Treat ( Make/Expand our tricks.h file) Pinmembersashoalm16-Oct-09 22:10 
GeneralRe: (C++) Trick or Treat ( Make/Expand our tricks.h file) PinmemberJörgen Sigvardsson21-Oct-09 7:04 
GeneralA clever backup... PinmemberRozis12-Oct-09 11:07 
GeneralRe: A clever backup... PinmvpDave Kreskowiak12-Oct-09 16:13 
GeneralRe: A clever backup... PinmemberBizit Deb14-Oct-09 21:26 
GeneralRe: A clever backup... PinmemberLike2Byte18-Oct-09 10:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150123.1 | Last Updated 25 Jan 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid