Click here to Skip to main content
16,011,685 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: equivalent vc++ class for a vb class Pin
lahom3-May-08 12:49
lahom3-May-08 12:49 
GeneralRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac3-May-08 13:35
professionalOzer Karaagac3-May-08 13:35 
GeneralRe: equivalent vc++ class for a vb class Pin
lahom3-May-08 14:13
lahom3-May-08 14:13 
GeneralRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac3-May-08 14:49
professionalOzer Karaagac3-May-08 14:49 
GeneralRe: equivalent vc++ class for a vb class Pin
lahom4-May-08 3:25
lahom4-May-08 3:25 
QuestionRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac4-May-08 13:05
professionalOzer Karaagac4-May-08 13:05 
AnswerRe: equivalent vc++ class for a vb class Pin
lahom4-May-08 13:28
lahom4-May-08 13:28 
AnswerRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac4-May-08 15:05
professionalOzer Karaagac4-May-08 15:05 
First of all, you aren't already using the functions that I've provided via my first reply in this thread.
You should find them and copy&paste to your source file before the line void CForm1::OnCommand1().

Then, replace that function with the one below.
void CForm1::OnCommand1()
{
  // TODO: Add your control notification handler code here
  CComVariant retval; // - "AutoDim"
  CString exten="ccc_ext";
  CString app_path = GetExeName();
  CString Icon = GetExeFolder() + "\\book.ico";

  retval = Associate_File(".ccc", app_path, exten, "My own extension", Icon);
  AfxMessageBox(("Associated the file extension .ccc with this application!"));
}

I didn't want to post whole Associate_File() function that might mess up the board.
So, please find and replace all commented lines below with uncommented ones in Associate_File() function.

//lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (const unsigned char*)&Identifier, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Identifier, lsize);

//lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (const unsigned char*)&Description, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Description, lsize);

//lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (const unsigned char*)&Icon, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Icon, lsize);

//commandline = (Str(CString(char(34)))+Application+Str(CString(char(34)))+" "+Str(CString(char(34)))+"%1"+Str(CString(char(34))));
commandline = '\"' + Application + "\" \"%1\"";

//lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (const unsigned char*)&commandline, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)commandline, lsize);


It worked well in my system.

BTW, strings are not UNICODE.
GeneralRe: equivalent vc++ class for a vb class Pin
lahom4-May-08 15:28
lahom4-May-08 15:28 
GeneralRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac4-May-08 15:36
professionalOzer Karaagac4-May-08 15:36 
GeneralRe: equivalent vc++ class for a vb class Pin
Ozer Karaagac3-May-08 15:47
professionalOzer Karaagac3-May-08 15:47 
GeneralRe: equivalent vc++ class for a vb class Pin
Hamid_RT29-Apr-08 1:23
Hamid_RT29-Apr-08 1:23 
GeneralDebug Assertion Failed! help :( Pin
DADADADAD26-Apr-08 11:49
DADADADAD26-Apr-08 11:49 
GeneralRe: Debug Assertion Failed! help :( Pin
Saurabh.Garg26-Apr-08 15:29
Saurabh.Garg26-Apr-08 15:29 
GeneralRe: Debug Assertion Failed! help :( Pin
DADADADAD28-Apr-08 8:51
DADADADAD28-Apr-08 8:51 
QuestionAny tool to make a patch which can decide which application to patch? Pin
followait26-Apr-08 8:59
followait26-Apr-08 8:59 
AnswerRe: Any tool to make a patch which can decide which application to patch? Pin
Saurabh.Garg26-Apr-08 18:00
Saurabh.Garg26-Apr-08 18:00 
AnswerRe: Any tool to make a patch which can decide which application to patch? Pin
Hamid_RT29-Apr-08 1:23
Hamid_RT29-Apr-08 1:23 
Questionwhich c++ stl is right? Pin
Jim Crafton26-Apr-08 6:52
Jim Crafton26-Apr-08 6:52 
AnswerRe: which c++ stl is right? Pin
Saurabh.Garg26-Apr-08 7:37
Saurabh.Garg26-Apr-08 7:37 
GeneralRe: which c++ stl is right? Pin
Jim Crafton26-Apr-08 7:55
Jim Crafton26-Apr-08 7:55 
GeneralRe: which c++ stl is right? Pin
Saurabh.Garg26-Apr-08 9:52
Saurabh.Garg26-Apr-08 9:52 
GeneralRe: which c++ stl is right? Pin
peterchen27-Apr-08 0:47
peterchen27-Apr-08 0:47 
Generalbest book or refernce for Visual c++ Pin
mostafa_h26-Apr-08 6:25
mostafa_h26-Apr-08 6:25 
GeneralRe: best book or refernce for Visual c++ Pin
bob1697226-Apr-08 6:34
bob1697226-Apr-08 6:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.