Need some assistance configuring registry keys

Hi All,

I'm trying to programatically set registry keys to configure a Microsoft Access data source.  One problem I am having is after I set a REG_SZ key's value.  When I look at the key in the registry, the key's value shows up as "my keys value"...

Anyone know why there is a "..." after the key's value?  For some reason, this is not being read by the control panel's data source manager.

Here's my code:
CString dbLocation = "C:\\database.mdb";
CString key = "Software\\ODBC\\ODBC.INI\\MY_DataSource";
HKEY hKey;
DWORD dwType = REG_SZ;

::RegSetValueEx(hKey, "DBQ", 0, REG_SZ, (const unsigned char*)(LPCTSTR)dbLocation, MAX_PATH);

There are other keys but I did not include them as it would be repetitive.

Thanks for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>::RegSetValueEx(hKey, "DBQ", 0, REG_SZ, (const unsigned char*)(LPCTSTR)dbLocation, MAX_PATH);

Here, you need to specify the *exact* length of the string, thus the '...' part. This should be

::RegSetValueEx(hKey, "DBQ", 0, REG_SZ, (const unsigned char*)(LPCTSTR)dbLocation, dbLocation.GetLength());

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StanChartAuthor Commented:
You're the man!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.