Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to declare WindowProc function

How to declare WindowProc function

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++dotnettutorialquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mmhu
    wrote on last edited by
    #1

    In my Form1 (VC++ .NET framework), I first need to add prototype of WindowProc in header file. Which section shall it be added private, protect, or public?? Is following prototype correct?? LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); Is following implementation function header correct?? LRESULT CALLBACK Form1::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { }

    T S V 3 Replies Last reply
    0
    • M mmhu

      In my Form1 (VC++ .NET framework), I first need to add prototype of WindowProc in header file. Which section shall it be added private, protect, or public?? Is following prototype correct?? LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); Is following implementation function header correct?? LRESULT CALLBACK Form1::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { }

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      if the function is a member of a class, you must declare it static, so that it wont have the implicit this parameter... by the way, i may be wrong (i see you're talking about the .NET Framework) but the C++/CLI forum may be more appropriate for your question.


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      1 Reply Last reply
      0
      • M mmhu

        In my Form1 (VC++ .NET framework), I first need to add prototype of WindowProc in header file. Which section shall it be added private, protect, or public?? Is following prototype correct?? LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); Is following implementation function header correct?? LRESULT CALLBACK Form1::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { }

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        it should be either global or public static of a class. SaRath. "Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"


        My Blog | Understanding State Pattern

        Last modified: Wednesday, August 09, 2006 9:20:41 AM --

        T 1 Reply Last reply
        0
        • S Sarath C

          it should be either global or public static of a class. SaRath. "Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"


          My Blog | Understanding State Pattern

          Last modified: Wednesday, August 09, 2006 9:20:41 AM --

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          Sarath. wrote:

          either

          nope. it should be both !!!


          TOXCCT >>> GEII power

          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

          S 1 Reply Last reply
          0
          • T toxcct

            Sarath. wrote:

            either

            nope. it should be both !!!


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            S Offline
            S Offline
            Sarath C
            wrote on last edited by
            #5

            ooops.. sorry man.. it was a mistake I meant either in global or in public static scope. :) I shall correct it

            SaRath.
            _"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"


            My Blog | Understanding State Pattern_

            1 Reply Last reply
            0
            • M mmhu

              In my Form1 (VC++ .NET framework), I first need to add prototype of WindowProc in header file. Which section shall it be added private, protect, or public?? Is following prototype correct?? LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); Is following implementation function header correct?? LRESULT CALLBACK Form1::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { }

              V Offline
              V Offline
              Vipin Aravind
              wrote on last edited by
              #6

              It should be a static function.

              Click here for Vipin's Blog

              T 1 Reply Last reply
              0
              • V Vipin Aravind

                It should be a static function.

                Click here for Vipin's Blog

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                i think answering something that was posted about 2 hours before is not the best thing to do, especially if you don't provide much info...


                TOXCCT >>> GEII power

                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                V 1 Reply Last reply
                0
                • T toxcct

                  i think answering something that was posted about 2 hours before is not the best thing to do, especially if you don't provide much info...


                  TOXCCT >>> GEII power

                  [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                  V Offline
                  V Offline
                  Vipin Aravind
                  wrote on last edited by
                  #8

                  hehe, I did not read the other answers :)

                  Click here for Vipin's Blog

                  M 1 Reply Last reply
                  0
                  • V Vipin Aravind

                    hehe, I did not read the other answers :)

                    Click here for Vipin's Blog

                    M Offline
                    M Offline
                    mmhu
                    wrote on last edited by
                    #9

                    I'm writing VC++ .net framework code. I need to retrieve the windows WM_DEVCHANGE message Shall I use virtual void WndProc( Message* m ) override function or LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) function?? How shall I add either of them to my Form class??? May you write down the format?

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups