Does C# have windows.h

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

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
 
Dom said:
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
 
Dom said:
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
 
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
 
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
 
Dom said:
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
 
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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top