Click here to Skip to main content
15,902,715 members
Articles / Desktop Programming / MFC
Article

Visual Studio .NET- Old style member function wizard

Rate me:
Please Sign up or sign in to vote.
3.80/5 (3 votes)
23 Jul 2002 66K   15   9
Modifies the new VS7 Member Function wizard to add a member function without using the parameter list

Sample Image - memwiz.jpg

Introduction

I switched from VS6 to VS7 and I wondered if it can be true that i can only add a member function by using the new "Add member function" Wizard. I searched for the sourcecode of the add member function wizard and found it in my Visual Studio directory in \Program Files\Microsoft Visual Studio .NET\VC7\VCWizards\MemFunctionWiz\HTML\default.html. I changed a few values and tested my changes in a new opened instance of VS7 and it worked. I added a checkbox, and changed a few things, and now I can enter a name of a function into the function name textbox like this "TestFunction(int nTest, BOOL bTest)", like good old VS6. It saves a lot of time. The checkbox exists to switch from old-style to new-style. If it is disabled I have to use the param list to define a new function.

  1. Open the default.html in notepad.exe

  2. Scroll to:

    <TR>
    <TD VALIGN="MIDDLE" HEIGHT="23" WIDTH="12">
     
    </TD>
    <TD VALIGN="TOP" HEIGHT="23">
    
    //Add this
    <input ID="CHECKBOXOLDSTYLE" type="checkbox" CHECKED>
    <LABEL FOR="CHECKBOXOLDSTYLE" 
    ID="OLDSTYLE_LABEL">Enter old-style function name</LABEL>
    //<-- end add
    
     
    </TD>
    <TD VALIGN="MIDDLE" HEIGHT="23" WIDTH="75">
    <BUTTON CLASS="BUTTONS" ID="FinishBtn" 
    onClick="OnFinish(document);">Fertig stellen</BUTTON>
    </TD>
    <TD VALIGN="MIDDLE" HEIGHT="23" WIDTH="4">
     
    </TD>
    <TD VALIGN="MIDDLE" HEIGHT="23" WIDTH="75">
    <BUTTON CLASS="BUTTONS" ID="CancelBtn" 
    onClick="window.external.Finish(document, 'cancel');">Abbrechen</BUTTON>

    If you save the default.htm and start a new instance of VS7, a checkbox appears on the bottom-left.

  3. Scroll to:

    JavaScript
    function Validate(obj)
    {
        try
        {
            var bValid = true;
            switch(obj.id)
            {
                case "FUNCTION_NAME":
                {
    // Change the code to:
                    var strNameWithParamList = "";
                    if( CHECKBOXOLDSTYLE.checked )
                    {
                        strNameWithParamList = FUNCTION_NAME.value;
                    }
                    else
                    {
                        strNameWithParamList = FUNCTION_NAME.value + "(" +
                                               strParameters + ")";
                    }
    // <- end change
                    window.external.AddSymbol("FUNCTION_FULLNAME", 
                                              strNameWithParamList);
                    bValid = window.external.ParentObject.ValidateMember.....
  4. Save the file and try in VS7

  5. Finished, now you can enter a member function the old way.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralI'll stay away from VC7 only because of the bugs Pin
Davidi4-Aug-02 7:31
Davidi4-Aug-02 7:31 
GeneralGood article, but... Pin
Abin24-Jul-02 11:46
Abin24-Jul-02 11:46 
GeneralRe: Good article, but... Pin
KarstenK24-Jul-02 21:12
mveKarstenK24-Jul-02 21:12 
GeneralRe: Good article, but... Pin
Anonymous25-Jul-02 11:58
Anonymous25-Jul-02 11:58 
GeneralRe: Good article, but... Pin
Abin25-Jul-02 12:05
Abin25-Jul-02 12:05 
GeneralRe: Good article, but... Pin
Anonymous25-Jul-02 20:25
Anonymous25-Jul-02 20:25 
GeneralRe: Good article, but... Pin
Michael P Butler25-Jul-02 12:06
Michael P Butler25-Jul-02 12:06 
GeneralRe: Good article, but... Pin
Jörgen Sigvardsson25-Jul-02 13:56
Jörgen Sigvardsson25-Jul-02 13:56 
1) Create function using wizard. Select function in class view, set the IsConstant property in the properties view to True. Voilà!
2) Tied member variables? Well if you mean ordinary "int m_x" variables, yes unfortunately you'd have to remove them by hand. But you can rename them..
3) For MFC-projects you always have the Properties/Event views. I can add handlers and remove them without having to touch the keyboard..

2 out of 3 aint that bad isn't it?

I have to say that I am very pleased with VS.NET. The editor is pretty much the same. The GUI-centric parts as adding functions using a wizard doesn't really attract my attention for anything other than COM-projects (add an interface function and it'll add an implementation in all classes which implements the interface - this is nice!).

What really kicks butt is the very much enhanced scripting capabilities. It's *easy* to script the environment in VS.NET - especially now that it uses VB.NET which is a lot nicer to people who are used to somewhat orthogonal and homogenous programming languages.

All in all: VS is dead. Long live VS.NET!

FreeBSD is sexy.
Getting closer and closer to actually submit an article...
GeneralRe: Good article, but... Pin
Abin25-Jul-02 14:28
Abin25-Jul-02 14:28 

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.