keitaro42

I try to create a wizard that acts like MFC class wizard

And my template dialog resouce(MyWizard\Templates\1033\dialog.rc) looks like this:

DIALOGEX 0, 0, 257, 200
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Tahoma", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,92,181,50,14
PUSHBUTTON "Cancel",IDCANCEL,147,181,50,14
PUSHBUTTON "&Apply",IDC_APPLY_BUTTON,202,181,50,14,WS_DISABLED
PUSHBUTTON "Help",IDC_HELP_BTN,5,181,16,14,BS_ICON
END

But in the OnFinish function:

var strSymbolValue = oResHelper.AddResource(strDialogID, strRCTemplFile, "DIALOG");

I have an error message IDC_APPLY_BUTTON and IDC_HELP_BTN are not define.

How can I resolve this

Regards.



Re: Visual C++ General Resource Helper

Feng Chen - MSFT

Hi keitaro42,

Are you using Visual Studio 2005 And I'd like to know when did you get that error message.

Thanks!






Re: Visual C++ General Resource Helper

keitaro42

Hi,

I'm using VS 2005.

I got the message error when I clicked on MyWizard's finish button.

And the exact message error is :"error RC2104 : undefined keyword or key name: IDC_APPLY_BUTTON"

Thank you.





Re: Visual C++ General Resource Helper

Feng Chen - MSFT

Hi keitaro42,

Please check the resource.h file that must be missing definition (#define) for theIDC_APPLY_BUTTON and IDC_HELP_BTN name.

Thanks!






Re: Visual C++ General Resource Helper

keitaro42

Hi,

Is it possible to add "#define IDC_APPLY_BUTTON" programmatically via ResourceHelper

How to do this if it's possible

Thank you.





Re: Visual C++ General Resource Helper

keitaro42

Hi,

I also added manually("#define IDC_APPLY_BUTTON 120 #define IDC_HELP_BTN 121")

those defines into the resource.h without success, I still have the error message when I run MyWizard.

My goal is to create template dialog with extra controls.

Thank you.





Re: Visual C++ General Resource Helper

Feng Chen - MSFT

Hi keitaro42,

Id appreciate if you can post here a simplest sample to reproduce the problem.

Thanks for your understanding!






Re: Visual C++ General Resource Helper

keitaro42

Hi,

Sorry for inconvenience.

I didn't see how to attach files to this post, so if you have some email that I can send it.

The sample is just a custom wizard that can be called when you have a project opened and do "Add/Class" in Visual Studio and choose MyWizard.

MyWizard will add a class NewClassName that inherit from CDialog and add a dialog into the opened project.

After filling expected fields and press Finish button I got an error message(IDC_APPLY_BUTTON undefined).

Here's OnFinish method

Code Snippet

//default.js

function OnFinish(selProj, selObj)

{

var oCM;

try

{

oCM = selProj.CodeModel;

if (strCreateDialog == true)

{

var bDBCSCodePage =IsDBCSCharSet(wizard);

var strRCTemplFile = strTemplatePath;

strRCTemplFile += "\\dialog.rc ;

oResHelper.OpenResourceFile(strProjectRC);

var strSymbolValue = oResHelper.AddResource(strDialogID, strRCTemplFile, "DIALOG");

if (strSymbolValue == null) return;

oResHelper.CloseResourceFile();

wizard.AddSymbol("IDD_DIALOG", strSymbolValue.split("=").shift());

}

RenderAddTemplate(wizard, strTemplateHeader, strHeaderFile, selObj, true);

RenderAddTemplate(wizard, strTemplateImpl, strImplFile, selObj, false);


oCM.CommitTransaction();

.StartPoint.TryToShow(vsPaneShowTop);


}

catch(e)

{

if (oCM)

oCM.AbortTransaction();

if (e.description.length != 0)

SetErrorInfo(e);

return e.number

}

}

And here's MyWizard\templates\1033\dialog.rc

Code Snippet

DIALOGEX 0, 0, 257, 200
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Tahoma", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,92,181,50,14
PUSHBUTTON "Cancel",IDCANCEL,147,181,50,14
PUSHBUTTON "&Apply",IDC_APPLY_BUTTON,202,181,50,14,WS_DISABLED
PUSHBUTTON "Help",IDC_HELP_BTN,5,181,16,14,BS_ICON
END

Is it possible to add extra controls in dialog.rc

Thank you.