Where Is the Message Loop?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U3RldmUgQmVobWFu?=

    Where Is the Message Loop?

    Using Visual C++8.0 Express Edition I created a "Solution " using a "Form"
    (dialog) of my own design.

    Without adding any code of my own I compiled the code generated for me by
    Visual C++. The compiled .exe produced the expected dialog with all the
    function I expected (tabbing, text entry etc.).

    At that point I ran headlong into a huge stone wall -- try as I may I could
    not find the message loop in the generated code so that I could add
    functionality to the dialog.

    I am certain that there is a message loop there (somewhere) because without
    a the minimal function of the dialog box could not be achieved.

    Will some kind soul please tell me how to locate the place in the generated
    code (or elsewhere) where I can add the application functionality.

    Thanks,


  • David Lowndes

    #2
    Re: Where Is the Message Loop?

    >Using Visual C++8.0 Express Edition I created a "Solution " using a "Form"
    >(dialog) of my own design.
    What type of project did you create? .Net, MFC, SDK (presumably not
    the latter from what you say)?

    If it's either of the former 2 types of project the message loop is
    hidden (deeply in the case of .Net).
    >At that point I ran headlong into a huge stone wall -- try as I may I could
    >not find the message loop in the generated code so that I could add
    >functionalit y to the dialog.
    You rarely need to access the message loop directly, the .Net or MFC
    frameworks hide you from that detail.
    >I am certain that there is a message loop there (somewhere) because without
    >a the minimal function of the dialog box could not be achieved.
    If you really want to have a old fashioned message loop, create a
    Win32 (SDK) project.

    Dave

    Comment

    • Ben Voigt [C++ MVP]

      #3
      Re: Where Is the Message Loop?

      David Lowndes wrote:
      >Using Visual C++8.0 Express Edition I created a "Solution " using a
      >"Form" (dialog) of my own design.
      >
      What type of project did you create? .Net, MFC, SDK (presumably not
      the latter from what you say)?
      >
      If it's either of the former 2 types of project the message loop is
      hidden (deeply in the case of .Net).
      >
      >At that point I ran headlong into a huge stone wall -- try as I may
      >I could not find the message loop in the generated code so that I
      >could add functionality to the dialog.
      >
      You rarely need to access the message loop directly, the .Net or MFC
      frameworks hide you from that detail.
      >
      >I am certain that there is a message loop there (somewhere) because
      >without a the minimal function of the dialog box could not be
      >achieved.
      >
      If you really want to have a old fashioned message loop, create a
      Win32 (SDK) project.
      Or simply, in the forms editor, switch the properties editor over to the
      "events" tab and handle Click / BN_CLICKED events or some such.
      >
      Dave

      Comment

      • =?Utf-8?B?U3RldmUgQmVobWFu?=

        #4
        Re: Where Is the Message Loop?

        Dave, thanks for the response.

        I am not sure what type of application was generated but I used the "New
        -Project" dialog from which I selected "Windows Form Application" to do it.
        I, like you, am quite certain that it is not an SDK application.

        When I last programmed, 12 years ago when I became visually impaired, it was
        at the SDK level -- a level which is now entirely too tedious for me.

        I love programming and think that the Visual Studio paradigm will allow me
        to do it again. I would, therefore, really appreciate either a discussion of
        where and how to add the application functionality in the new (to me) way or
        a pointer (URL) to such a discussion. At this point it is just too difficult
        for me to revert to the SDK.

        Thanks again,


        "David Lowndes" wrote:
        Using Visual C++8.0 Express Edition I created a "Solution " using a "Form"
        (dialog) of my own design.
        >
        What type of project did you create? .Net, MFC, SDK (presumably not
        the latter from what you say)?
        >
        If it's either of the former 2 types of project the message loop is
        hidden (deeply in the case of .Net).
        >
        At that point I ran headlong into a huge stone wall -- try as I may I could
        not find the message loop in the generated code so that I could add
        functionality to the dialog.
        >
        You rarely need to access the message loop directly, the .Net or MFC
        frameworks hide you from that detail.
        >
        I am certain that there is a message loop there (somewhere) because without
        a the minimal function of the dialog box could not be achieved.
        >
        If you really want to have a old fashioned message loop, create a
        Win32 (SDK) project.
        >
        Dave

        Comment

        • =?Utf-8?B?U3RldmUgQmVobWFu?=

          #5
          Re: Where Is the Message Loop?

          Ben, .

          As you may surmise from my response to Dave I have not seen the tab that
          you mentioned. It sounds like the answer to maidens prayer if only I could
          find it.

          I would expect that it exists separately for each control and would,
          therefore, think that each control for which I want to specify an action need
          be selected at the time this tab appears. After that, the location of the
          tab is a total mystery -- I just can't find it.

          If you would be so kind, please give me specific instructions to find that
          tab.

          I am waiting breathlessly for your response!

          Thank you so much for the help,
          >"Ben Voigt [C++ MVP]" wrote:
          >Or simply, in the forms editor, switch the properties editor over to the
          >"events" tab and handle Click / BN_CLICKED events or some such.

          Comment

          • David Lowndes

            #6
            Re: Where Is the Message Loop?

            >I am not sure what type of application was generated but I used the "New
            >-Project" dialog from which I selected "Windows Form Application" to do it.
            I, like you, am quite certain that it is not an SDK application.
            That'll be a CLR (.Net) application then.

            You'll have been presented with an empty form that you can then
            drag/drop controls from the Toolbox.

            Let's say you put a push button on the form. Select the button on the
            form and (if it's not already displayed), choose View, Properties
            Window.

            In the property window pane, click the lightning bolt (Events) button.
            You can now add handlers for things like the Click event. Double click
            the handler to go to the code view.

            Dave

            Comment

            • Carl Daniel [VC++ MVP]

              #7
              Re: Where Is the Message Loop?

              Steve Behman wrote:
              Dave, thanks for the response.
              >
              I am not sure what type of application was generated but I used the
              "New
              -Project" dialog from which I selected "Windows Form Application"
              to do it. I, like you, am quite certain that it is not an SDK
              application.
              >
              When I last programmed, 12 years ago when I became visually impaired,
              it was at the SDK level -- a level which is now entirely too tedious
              for me.
              >
              I love programming and think that the Visual Studio paradigm will
              allow me to do it again. I would, therefore, really appreciate
              either a discussion of where and how to add the application
              functionality in the new (to me) way or a pointer (URL) to such a
              discussion. At this point it is just too difficult for me to revert
              to the SDK.
              As Dave correctly replied, you've created a Winforms application. If you
              want to do Winforms, I'd strngly recommend that you switch to C# - it can be
              done in C++, but it's needlessly tedious, and the designers interact better
              with C#.

              If you're going to continue on with Windows Forms using managed C++, you
              might want to get this book:



              Regardless of the language you use, if you're going to continue with Windows
              Forms, you might want to get this book:



              For just "goofing around", it's hard to beat the simplicity of winforms with
              C#. For more serious GUI development, you might want to consider using MFC
              (which unfortunately means that you cannot use VC++ Express, which does not
              include MFC).

              -cd


              Comment

              • =?Utf-8?B?U3RldmUgQmVobWFu?=

                #8
                Re: Where Is the Message Loop?

                Carl, I appreciate your suggestion. I have been programming for 55 years in
                about as many languages as years, I'm afraid that one more language would be
                the straw that breaks this old camel's back.

                If it was not for programs called ZoomText and Dragon NaturallySpeaki ng I
                couldn't read or write anything at all -- but they do not work with paper.

                Most of my own C++ programming was for OS/2 for which I developed the
                equivalent of the MFC (with an interface to DB/2 using the IBM equivalent of
                the SDK.

                As a consequence of the above I will do piecewise development of my
                application with the Visual Studio tool and then port them to the MFC for
                integration into a whole application (that is if I live that long :-).

                Thanks again to all of you, I appreciated the help.



                "Carl Daniel [VC++ MVP]" wrote:
                Steve Behman wrote:
                Dave, thanks for the response.

                I am not sure what type of application was generated but I used the
                "New
                -Project" dialog from which I selected "Windows Form Application"
                to do it. I, like you, am quite certain that it is not an SDK
                application.

                When I last programmed, 12 years ago when I became visually impaired,
                it was at the SDK level -- a level which is now entirely too tedious
                for me.

                I love programming and think that the Visual Studio paradigm will
                allow me to do it again. I would, therefore, really appreciate
                either a discussion of where and how to add the application
                functionality in the new (to me) way or a pointer (URL) to such a
                discussion. At this point it is just too difficult for me to revert
                to the SDK.
                >
                As Dave correctly replied, you've created a Winforms application. If you
                want to do Winforms, I'd strngly recommend that you switch to C# - it can be
                done in C++, but it's needlessly tedious, and the designers interact better
                with C#.
                >
                If you're going to continue on with Windows Forms using managed C++, you
                might want to get this book:
                >

                >
                Regardless of the language you use, if you're going to continue with Windows
                Forms, you might want to get this book:
                >

                >
                For just "goofing around", it's hard to beat the simplicity of winforms with
                C#. For more serious GUI development, you might want to consider using MFC
                (which unfortunately means that you cannot use VC++ Express, which does not
                include MFC).
                >
                -cd
                >
                >
                >

                Comment

                • SvenC

                  #9
                  Re: Where Is the Message Loop?

                  Hi Steve,
                  Carl, I appreciate your suggestion. I have been programming for 55
                  years in about as many languages as years, I'm afraid that one more
                  language would be the straw that breaks this old camel's back.
                  When you stay with Windows Forms projects in VC++ then nevertheless
                  you will need to learn a new flavour of C++ called C++/CLI. It has several
                  C++ extensions needed for programming in the .Net world.
                  So I would still recommend to stick with C# when it comes to pure
                  ..Net programming. C++/CLI is of most use when you want to use your
                  legacy code base in .Net applications or when you want to wrap your
                  legacy API as a .Net class library.
                  Most of my own C++ programming was for OS/2 for which I developed the
                  equivalent of the MFC (with an interface to DB/2 using the IBM
                  equivalent of the SDK.
                  >
                  As a consequence of the above I will do piecewise development of my
                  application with the Visual Studio tool and then port them to the MFC
                  for integration into a whole application
                  If you are going the MFC way then you are in well known C++ land where
                  using C++ makes much more sense than in .Net world. But up to now the
                  VC++ Express edition does neither include MFC nor ATL. So you would
                  have to use at least VC++ Standard Edition

                  --
                  SvenC

                  Comment

                  • Ben Voigt [C++ MVP]

                    #10
                    Re: Where Is the Message Loop?

                    Steve Behman wrote:
                    Ben, .
                    >
                    As you may surmise from my response to Dave I have not seen the tab
                    that
                    you mentioned. It sounds like the answer to maidens prayer if only I
                    could find it.
                    >
                    I would expect that it exists separately for each control and would,
                    therefore, think that each control for which I want to specify an
                    action need be selected at the time this tab appears. After that,
                    the location of the tab is a total mystery -- I just can't find it.
                    We're discussing the properties window (View menu, Properties window,
                    default hotkey F4). I suspect you've already used that, because it's where
                    you set the captions of your buttons and so on.

                    At the top of the properties window is a small toolbar. The second area of
                    the toolbar has two icons, one a grid which is probably highlighted, the
                    second is a lightning bolt. Click the lightning bolt to get the list of
                    events. At this point you can double-click any entry to let Visual Studio
                    use the default function name to handle it, or type in your own preferred
                    name. At this point you're likely to be in the code window.
                    >
                    If you would be so kind, please give me specific instructions to find
                    that tab.
                    >
                    I am waiting breathlessly for your response!
                    >
                    Thank you so much for the help,
                    >
                    >"Ben Voigt [C++ MVP]" wrote:
                    >
                    >Or simply, in the forms editor, switch the properties editor over to
                    >the "events" tab and handle Click / BN_CLICKED events or some such.

                    Comment

                    Working...