By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,385 Members | 847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,385 IT Pros & Developers. It's quick & easy.

Does C# have windows.h

P: n/a
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

Aug 3 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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

Aug 3 '07 #2

P: n/a
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:
http://www.codeproject.com/csharp/winfileinfo.asp
http://www.ondotnet.com/pub/a/dotnet.../template.html

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

Arne
Aug 3 '07 #3

P: n/a
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
Aug 3 '07 #4

P: n/a
Dom
On Aug 2, 10:32 pm, Dom <dolivas...@gmail.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

Aug 3 '07 #5

P: n/a
Dom
On Aug 2, 10:32 pm, Dom <dolivas...@gmail.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

Aug 3 '07 #6

P: n/a
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
Aug 3 '07 #7

P: n/a
On 3 Aug, 03:58, Dom <dolivas...@gmail.comwrote:
On Aug 2, 10:32 pm, Dom <dolivas...@gmail.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 :)

Aug 3 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.