GetProfileString creates a key automatically
-
Hello, I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly. For example; MyApplication Data Data01 I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling. However when i check if Data01 available, GetProfileString creates that entry for me :), if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
CString category(_T("Data\\"));
category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
path = GetProfileString(category,_T("InitPath"));How should i check if an entry there using GetProfileString or how can i do it? Thanks in advance. Bekir.
-
Hello, I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly. For example; MyApplication Data Data01 I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling. However when i check if Data01 available, GetProfileString creates that entry for me :), if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
CString category(_T("Data\\"));
category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
path = GetProfileString(category,_T("InitPath"));How should i check if an entry there using GetProfileString or how can i do it? Thanks in advance. Bekir.
beko wrote:
How should i check if an entry there using GetProfileString or how can i do it?
Use
RegQueryValue()
for the registry."Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
Hello, I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly. For example; MyApplication Data Data01 I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling. However when i check if Data01 available, GetProfileString creates that entry for me :), if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
CString category(_T("Data\\"));
category+=dataCode; // DataCode could be Data01 or Data02 i dont know this before hand.
path = GetProfileString(category,_T("InitPath"));How should i check if an entry there using GetProfileString or how can i do it? Thanks in advance. Bekir.