Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Making controls appear/disappear according to list selection Pin
kk_vp27-Jan-06 1:47
kk_vp27-Jan-06 1:47 
GeneralRe: Making controls appear/disappear according to list selection Pin
David Crow27-Jan-06 2:54
David Crow27-Jan-06 2:54 
GeneralRe: Making controls appear/disappear according to list selection Pin
kk_vp29-Jan-06 22:43
kk_vp29-Jan-06 22:43 
QuestionGetPrivateProfileString Pin
Nishad S22-Jan-06 22:07
Nishad S22-Jan-06 22:07 
AnswerRe: GetPrivateProfileString Pin
Owner drawn22-Jan-06 22:49
Owner drawn22-Jan-06 22:49 
GeneralRe: GetPrivateProfileString Pin
Nishad S22-Jan-06 22:53
Nishad S22-Jan-06 22:53 
GeneralRe: GetPrivateProfileString Pin
Owner drawn22-Jan-06 22:56
Owner drawn22-Jan-06 22:56 
AnswerRe: GetPrivateProfileString Pin
Rage22-Jan-06 23:29
professionalRage22-Jan-06 23:29 
Three remarks:

1. GetPrivateProfileString is usually used to handle one entry at a time, which entry you of course know the size of.

2. For entries which have no fixed size (strings), you can take a default size for your buffer (MAX_PATH ?) or you can associate another key of size integer which contains the size of the string.

3. Same for keys that contain various amount of subkeys (like most recent used lists, and so), you usually store a parallel key containing the amount of keys to read.

So, if the information has been written properly, there should be a key containing the size you are needing.

If not, you are probably trying to read too much at a time and need to read the keys recursively.

A dirty trick to achieve what you are trying to do, is to do a loop in which you check the returned value dwLen against the buffer size nSize. Increment nSize until it is different from dwLen, in this case you are sure that everything has been read properly. Something like (this is pseudocode):

while (sizeread >= nSize)
{
nSize+=1024
sizeread=ReadKey(nSize)
}



This snippet obviously does not work, but I think you can get the idea.


~RaGE();
GeneralRe: GetPrivateProfileString Pin
Nishad S23-Jan-06 0:13
Nishad S23-Jan-06 0:13 
GeneralRe: GetPrivateProfileString Pin
Rage23-Jan-06 1:20
professionalRage23-Jan-06 1:20 
GeneralRe: GetPrivateProfileString Pin
Nishad S23-Jan-06 1:28
Nishad S23-Jan-06 1:28 
GeneralRe: GetPrivateProfileString Pin
Rage23-Jan-06 1:57
professionalRage23-Jan-06 1:57 
GeneralRe: GetPrivateProfileString Pin
Nishad S23-Jan-06 2:00
Nishad S23-Jan-06 2:00 
GeneralRe: GetPrivateProfileString Pin
Stephen Hewitt23-Jan-06 2:46
Stephen Hewitt23-Jan-06 2:46 
GeneralRe: GetPrivateProfileString Pin
Nishad S23-Jan-06 16:29
Nishad S23-Jan-06 16:29 
GeneralRe: GetPrivateProfileString Pin
David Crow23-Jan-06 3:57
David Crow23-Jan-06 3:57 
GeneralRe: GetPrivateProfileString Pin
David Crow23-Jan-06 3:52
David Crow23-Jan-06 3:52 
AnswerRe: GetPrivateProfileString Pin
David Crow23-Jan-06 3:50
David Crow23-Jan-06 3:50 
Questioneffective permissions Pin
kelprinc22-Jan-06 21:36
kelprinc22-Jan-06 21:36 
QuestionVisuall c Pin
Hamid_RT22-Jan-06 21:17
Hamid_RT22-Jan-06 21:17 
AnswerRe: Visuall c Pin
Rajesh R Subramanian22-Jan-06 21:21
professionalRajesh R Subramanian22-Jan-06 21:21 
GeneralRe: Visuall c Pin
Hamid_RT22-Jan-06 21:27
Hamid_RT22-Jan-06 21:27 
GeneralRe: Visuall c Pin
Cedric Moonen22-Jan-06 21:34
Cedric Moonen22-Jan-06 21:34 
General[Message Deleted] Pin
Hamid_RT22-Jan-06 21:43
Hamid_RT22-Jan-06 21:43 
GeneralRe: Visuall c Pin
Cedric Moonen22-Jan-06 21:54
Cedric Moonen22-Jan-06 21: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.