Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I read a string from the registry

Status
Not open for further replies.

EzehM

Programmer
Feb 27, 2003
86
GB
Please how can I retrieve the value of "Script" from the registry and store it in a variable in C++

[HKEY_LOCAL_MACHINE\SOFTWARE\ICL\FTMS\Push1\GiroBank\ProcessCtrl]
"Script"="Testfile.txt"

Thanks in Advance
 
use RegOpenKey/RegQueryValue

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Thanks Ion,

I have tried using RegOpenKeyEx & RegQueryValueEx, but I keep on getting C2440 errors (cannot convert * to *). I was really hoping for some sample code that I could use, please.

Thanks
 
put this function in your project and use after each error, to see what you are doing wrong. Also a very good idea is to read more attentive the MSDN and to use debugger.

int _show_last_error_w()
{
wchar_t* x = 0;
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
0,
(wchar_t*)&x,
0,
NULL
);
MessageBoxW(0, x, L"error:", MB_ICONEXCLAMATION);
delete[] x;
return 0;
}

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top