Help Using MFC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ProgrammerMatt
    New Member
    • Jun 2007
    • 9

    Help Using MFC

    I have used MFC in MSVC++ 6.0, but I am overwhelmed by what happens when I try to start a new MFC project in Visual Studio 2005.

    My program is very simple and only needs to get the coordinates of the mouse in realtime as I position a box on the screen.

    When I started a project in MSVC++ 6.0, the extra files could essentially be ignored. In Visual Studio, I try to create the simplest project possible using MFC, and I get several files that I don't understand. I also don't want the MFC window to appear when I run my application (not at this stage, at any rate). I would great appreciate some help in getting this going either in MFC or with another another library in C++.
    Thanks!
    -Matt
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    There is not requirement to show any of your windows. Just call ShowWindow() using your window handle and SW_HIDE. Check your docset for more options.

    What files are don't you understand?

    Any Windows application will have a stdafx.h, a resource.h, the resources themselves will be in a .rc file plus you will have various .cpp files for your source code.

    Any other files are Visual Studio files used to manage your project.

    Comment

    • ProgrammerMatt
      New Member
      • Jun 2007
      • 9

      #3
      When I started the project, 4 source files and 4 header files were created; most of that code has little meaning to me. I also could not find a main anywhere in the code. I have a running program already built, but I want to add mouse functionality to it. Do I just paste the main function in the MFC source file? Once I get that working, I would appreciate the exact code I can use in my functions to get the cursor coordinates.
      Thanks!
      -Matt

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Read this for information about your main().

        Also, do you have a copy of "Programmin g Windows using MFC" by Jeff Prosisi?

        Most of MFC is a wrapper of Win32, so you may want to get "Programmin g Windows" by Charles Petzold.

        Most of your MFC classes have a HitTest() method you can use to see of the control has been clicked.

        Comment

        • ProgrammerMatt
          New Member
          • Jun 2007
          • 9

          #5
          I realized my mistake regarding MFC being classes and all; my question now is how to make the basic text input window appear (just like it would in a simple Hello World program). MFC seems to prevent it from opening somehow.
          Thanks!
          Matt

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            You need Prosisi's book.

            Comment

            Working...