Click here to Skip to main content
15,910,277 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Fastest way to find a file exists on hard drive? Pin
Anders Molin15-Jul-04 12:33
professionalAnders Molin15-Jul-04 12:33 
AnswerRe: Fastest way to find a file exists on hard drive? Pin
Anonymous15-Jul-04 20:55
Anonymous15-Jul-04 20:55 
AnswerRe: Fastest way to find a file exists on hard drive? Pin
Blake Miller20-Jul-04 12:29
Blake Miller20-Jul-04 12:29 
GeneralGetDC drawing in win32 Pin
jass198115-Jul-04 10:31
sussjass198115-Jul-04 10:31 
GeneralRe: GetDC drawing in win32 Pin
RobJones15-Jul-04 11:23
RobJones15-Jul-04 11:23 
GeneralLPTSTR, LPCTSTR, CString and others... Pin
Kaleb Pederson15-Jul-04 9:22
Kaleb Pederson15-Jul-04 9:22 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Toni7815-Jul-04 9:40
Toni7815-Jul-04 9:40 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Adam Durity15-Jul-04 9:49
Adam Durity15-Jul-04 9:49 
LPTSTR is a pointer to a string, so if you don't initialize it, it doesn't mean anything. Just saying
LPTSTR val;

is not enough, because then it would get allocated and point to some random memory location. You then must specify where it points to so that in your call to QueryStringValue() it has a referenced location to store the string.

One way to do this might be
LPCTSTR strEntry = _T("SOFTWARE\\Microsoft\\...path...");
TCHAR val[1024];
ULONG max_size = 1024;
if((retval = rc->QueryStringValue(strEntry, val &max_size)) != ERROR_SUCCESS
{
// error handling
}


in this you are allocating an array to hold the string, then, you can assign it to a CString.
CString str = val;


Essentially the TCHAR array is a buffer of known length max_size. You use this buffer to collect the value string. Also, it should be noted that in the above example, you can use a CString instead of the LPCTSTR.

-- Adam

"If you can't beat your computer in chess, try kickboxing"
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Antti Keskinen15-Jul-04 9:53
Antti Keskinen15-Jul-04 9:53 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Kaleb Pederson15-Jul-04 11:25
Kaleb Pederson15-Jul-04 11:25 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Antti Keskinen15-Jul-04 11:50
Antti Keskinen15-Jul-04 11:50 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
PJ Arends15-Jul-04 17:14
professionalPJ Arends15-Jul-04 17:14 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
Mike Dimmick15-Jul-04 9:58
Mike Dimmick15-Jul-04 9:58 
GeneralRe: LPTSTR, LPCTSTR, CString and others... Pin
digwizfox15-Jul-04 11:07
digwizfox15-Jul-04 11:07 
Generalabt running exe Pin
jass198115-Jul-04 9:20
sussjass198115-Jul-04 9:20 
GeneralRe: abt running exe Pin
Toni7815-Jul-04 9:42
Toni7815-Jul-04 9:42 
GeneralRe: abt running exe Pin
PJ Arends15-Jul-04 9:47
professionalPJ Arends15-Jul-04 9:47 
GeneralRe: abt running exe Pin
Paul Steane16-Jul-04 1:33
Paul Steane16-Jul-04 1:33 
GeneralIJolietDiscMaster & Joliet & Invalid Naming Convention Pin
epxhi15-Jul-04 9:10
epxhi15-Jul-04 9:10 
GeneralDumb loop question. Pin
RobJones15-Jul-04 9:03
RobJones15-Jul-04 9:03 
GeneralRe: Dumb loop question. Pin
palbano15-Jul-04 9:19
palbano15-Jul-04 9:19 
GeneralRe: Dumb loop question. Pin
RobJones15-Jul-04 9:24
RobJones15-Jul-04 9:24 
GeneralRe: Dumb loop question. Pin
palbano15-Jul-04 9:30
palbano15-Jul-04 9:30 
GeneralRe: Dumb loop question. Pin
RobJones15-Jul-04 9:50
RobJones15-Jul-04 9:50 
GeneralRe: Dumb loop question. Pin
palbano15-Jul-04 17:54
palbano15-Jul-04 17:54 

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

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