hey everyone,
im making a program that controls my cube using GCNRD.
but shellexecute is being a tard to me
the code should work like this:
enter a value and the program starts gcnrd to poke the value
i got that in these lines

string CButton;
            string CoButton;
            cout << "please enter the button/analoge value [a good one lol] \nby default{no action}: 0000FF01\n";
            cin >> CoButton;
            CButton = "poke 8058E8A0 " + CoButton;
            CButton.c_str() = const char;
            cout << "value to poke: " << CButton;

            ShellExecuteA( NULL, "open", "/gcnrd.exe", CButton , NULL, SW_HIDE );

problem is that CButton needs to be a const char. with this code it gives a C-error, syntax error : 'const'
removing the conversion isn't an option too cause it'll give me this error:
Error 1 error C2664: 'ShellExecuteW' : cannot convert parameter 2 from 'const char [5]' to 'LPCWSTR'

any help?

line 6 does nothing -- delete it.

>>problem is that CButton needs to be a const char
No, it needs to be const wchar_t* because you are calling the UNICODE version of ShellExecute. You will have to convert c_str() to wchar_t* which requires another function to make that conversion.

thx for the reply but i forgot that my bro was testing some crap, im using ShellexecuteA =)

in that case just change line 9 to pass CButton.c_str() and it will compile ok.

WHY DIDNT I THINK OF THAT <_<
thx ^^;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.