c++ add to registry -


so, code barking @ me, need bit of help. error: char * incompatible cost byte *. it's barking at: regsetvalueexa(hkey, "my app", 0, reg_sz, buffer, sizeof(buffer)); buffer.

error message(vstudio): error 3 error c2664: 'regsetvalueexa' : cannot convert parameter 5 'char [500]' 'const byte *' {snip}\visual studio 2010\projects\reg\reg\reg.cpp 74

my code (note: stemres = full path executable, in lpcwstr, convert char):

hkey hkey; regopenkeyexa(hkey_current_user, "software\\microsoft\\currentversion\\run", 0, key_write, &hkey); // stemres = executable path char buffer[500]; wcstombs(buffer,stemres,500); regsetvalueexa(hkey, "my app", 0, reg_sz, buffer, sizeof(buffer)); regclosekey(hkey); cout << "added registry."; 

the fifth parameter regsetvalueexa() const byte * should synonym const unsigned char * , try pass char * it. afraid have convert it:

 regsetvalueexa(hkey, "my app", 0, reg_sz, reinterpret_cast<const byte *>(buffer), sizeof(buffer)); 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -