Does C# have windows.h

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dom

    #1

    Does C# have windows.h

    I can't find it anywhere. And if you don't have it, how do you
    override WndProc? Don't you need the window messages?

    Dom

  • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

    #2
    Re: Does C# have windows.h

    Dom wrote:
    I can't find it anywhere. And if you don't have it, how do you
    override WndProc? Don't you need the window messages?
    C# does not have .h files ate all.

    GUI apps in .NET are significantly different from Win32 API C++.

    Usually you do not need to worry about such stuff when you create
    a Form class.

    But actually it has a WndProc you can override, if you so want.

    Arne

    Comment

    • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

      #3
      Re: Does C# have windows.h

      Dom wrote:
      I can't find it anywhere. And if you don't have it, how do you
      override WndProc? Don't you need the window messages?
      Maybe you should start reading a bit about Win Forms in .NET.

      A quick googling finds:

      Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology


      They are a bit old, but should be sufficient to get you on
      the right track.

      Arne

      Comment

      • Peter Duniho

        #4
        Re: Does C# have windows.h

        Dom wrote:
        I can't find it anywhere. And if you don't have it, how do you
        override WndProc? Don't you need the window messages?
        I don't know what windows.h has to do with overriding WndProc. C#
        doesn't use include files; the information is in referenced assemblies.
        You can override things just fine without windows.h.

        As far as overriding WndProc goes, in most cases you should not need to
        write an override for that method, but if you do need to, you do it just
        like you'd override any other method in a class: simply write the
        override into your derived class, making sure that the method signature
        is exactly the same as the method you are overriding (and of course,
        includes the keyword "override") .

        Pete

        Comment

        • Dom

          #5
          Re: Does C# have windows.h

          On Aug 2, 10:32 pm, Dom <dolivas...@gma il.comwrote:
          I can't find it anywhere. And if you don't have it, how do you
          override WndProc? Don't you need the window messages?
          >
          Dom
          I guess I was being a little to coy. I know that C# does not have
          ".h" files, I meant, "what does it use instead." In particular, I
          wanted to know how to get the message codes.

          In C++, when you write a Wndproc, you need the message codes. You
          always write a long switch statement, in which you case out the
          messages you want to handle, such as WM_RBUTTONDOWN. For example, you
          might write:

          switch (msg)
          case WM_RBUTTONDOWN:
          Button1_Click (hwnd, msg, wParam, lParam);
          break;

          and so on. I assumed WM_???? was defined somewhere in C#.

          If I am fundamentally mistaken, and Arne's articles will set me
          straight, then don't bother answering.

          Dom

          Comment

          • Dom

            #6
            Re: Does C# have windows.h

            On Aug 2, 10:32 pm, Dom <dolivas...@gma il.comwrote:
            I can't find it anywhere. And if you don't have it, how do you
            override WndProc? Don't you need the window messages?
            >
            Dom
            I guess I was being a little to coy. I know that C# does not have
            ".h" files, I meant, "what does it use instead." In particular, I
            wanted to know how to get the message codes.

            In C++, when you write a Wndproc, you need the message codes. You
            always write a long switch statement, in which you case out the
            messages you want to handle, such as WM_RBUTTONDOWN. For example, you
            might write:

            switch (msg)
            case WM_RBUTTONDOWN:
            Button1_Click (hwnd, msg, wParam, lParam);
            break;

            and so on. I assumed WM_???? was defined somewhere in C#.

            If I am fundamentally mistaken, and Arne's articles will set me
            straight, then don't bother answering.

            Dom

            Comment

            • Peter Duniho

              #7
              Re: Does C# have windows.h

              Dom wrote:
              I guess I was being a little to coy. I know that C# does not have
              ".h" files, I meant, "what does it use instead." In particular, I
              wanted to know how to get the message codes.
              I recommend that you always do your best to ask the question you
              actually want an answer for.
              In C++, when you write a Wndproc, you need the message codes. You
              always write a long switch statement, in which you case out the
              messages you want to handle, such as WM_RBUTTONDOWN. For example, you
              might write:
              >
              switch (msg)
              case WM_RBUTTONDOWN:
              Button1_Click (hwnd, msg, wParam, lParam);
              break;
              >
              and so on. I assumed WM_???? was defined somewhere in C#.
              Sorry to say, it's not. You have to declare the constants yourself,
              based on the values that are in the various Windows SDK include files.
              Kind of annoying, IMHO.

              Pete

              Comment

              • DeveloperX

                #8
                Re: Does C# have windows.h

                On 3 Aug, 03:58, Dom <dolivas...@gma il.comwrote:
                On Aug 2, 10:32 pm, Dom <dolivas...@gma il.comwrote:
                >
                I can't find it anywhere. And if you don't have it, how do you
                override WndProc? Don't you need the window messages?
                >
                Dom
                >
                I guess I was being a little to coy. I know that C# does not have
                ".h" files, I meant, "what does it use instead." In particular, I
                wanted to know how to get the message codes.
                >
                In C++, when you write a Wndproc, you need the message codes. You
                always write a long switch statement, in which you case out the
                messages you want to handle, such as WM_RBUTTONDOWN. For example, you
                might write:
                >
                switch (msg)
                case WM_RBUTTONDOWN:
                Button1_Click (hwnd, msg, wParam, lParam);
                break;
                >
                and so on. I assumed WM_???? was defined somewhere in C#.
                >
                If I am fundamentally mistaken, and Arne's articles will set me
                straight, then don't bother answering.
                >
                Dom
                Hi, take a look at http://www.pinvoke.net/ which will list everything
                you need in easy to copy and paste format. Hmm, just noticed they've
                got a VS add in as well now. Not played with that, but looks
                interesting :)

                Comment

                Working...