473,775 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows messages - dead, or just hiding?

I've spent the last 3 years programming VC++, and learnt that Windows
programming is all about messages.

Now I'm doing C#, and there isn't a windows message to be seen! Now, I don't
miss those messages at all - in fact I'm very glad to see the end of them,
but I am puzzled as to where they've gone. Has .Net got rid of windows
messages, or are they just hidden inside the CLR, where windows windows (to
use the VC++ term for the real "window" which is actually on the screen) are
sending messages around they way they always did?

Cheers,

Javaman
Nov 17 '05 #1
3 1572

"Javaman59" <Ja*******@disc ussions.microso ft.com> wrote in message
news:15******** *************** ***********@mic rosoft.com...
I've spent the last 3 years programming VC++, and learnt that Windows
programming is all about messages.

Now I'm doing C#, and there isn't a windows message to be seen! Now, I
don't
miss those messages at all - in fact I'm very glad to see the end of them,
but I am puzzled as to where they've gone. Has .Net got rid of windows
messages, or are they just hidden inside the CLR, where windows windows
(to
use the VC++ term for the real "window" which is actually on the screen)
are
sending messages around they way they always did?


They are still hiding, certainly. .NET's windowing system is a facade over
Win32 controls, for the most part. You can still access windows messages by
overriding the protected WndProc member on any control, atleast on the full
framework.
However, for the most part you'll never need to bother with them.
Nov 17 '05 #2
Thanks Daniel.

I tried out a simple WndProc override to catch messages. It was very easy.
The only hard part was finding the actual message constants (eg WM_PAINT =
0x000F), which aren't visible anywhere in C#. (the doco says they are in
windows.h, but I found them in WinUser.h)

I also followed the trail from WndProc, and found that each Control has an
HWND Handle associated with it (a "windows window" as in my first post). I am
guessing that window at the other end of the handle is an unmanaged part of
the application.

- Javaman
"Daniel O'Connell [C# MVP]" wrote:

"Javaman59" <Ja*******@disc ussions.microso ft.com> wrote in message
news:15******** *************** ***********@mic rosoft.com...
I've spent the last 3 years programming VC++, and learnt that Windows
programming is all about messages.

Now I'm doing C#, and there isn't a windows message to be seen! Now, I
don't
miss those messages at all - in fact I'm very glad to see the end of them,
but I am puzzled as to where they've gone. Has .Net got rid of windows
messages, or are they just hidden inside the CLR, where windows windows
(to
use the VC++ term for the real "window" which is actually on the screen)
are
sending messages around they way they always did?


They are still hiding, certainly. .NET's windowing system is a facade over
Win32 controls, for the most part. You can still access windows messages by
overriding the protected WndProc member on any control, atleast on the full
framework.
However, for the most part you'll never need to bother with them.

Nov 17 '05 #3

"Javaman59" <Ja*******@disc ussions.microso ft.com> wrote in message
news:A9******** *************** ***********@mic rosoft.com...
Thanks Daniel.

I tried out a simple WndProc override to catch messages. It was very easy.
The only hard part was finding the actual message constants (eg WM_PAINT =
0x000F), which aren't visible anywhere in C#. (the doco says they are in
windows.h, but I found them in WinUser.h)

I believe windows.h includes WinUser.h, and thus windows.h is the proper
include(though I could be wrong). Unfortunatly the runtime doesn't offer
constants for those, I know.
I also followed the trail from WndProc, and found that each Control has an
HWND Handle associated with it (a "windows window" as in my first post). I
am
guessing that window at the other end of the handle is an unmanaged part
of
the application.

Effectivly it is. Its the same basic type of thing internally as any win32
application, HWND's and all.
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1600
by: piyush | last post by:
Sorry for repeated posting but I couldnt get things right/completely in the first post. I am in the process of deciding the IPC mechanisms to use for communication between 1) An application API (which would be set up as a NT service). It could be C++ or C#. The API as such might be talking to the underlying application (UA) via WM_COPYDATA messages.
24
2570
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office if you don't have Word. Classes <url: http://home.no.net/dubjai/win32cpptut/w32cpptut_02_01.zip> Introduces the C++ language feature used to define new types, namely classes. The focus in on creating safe and reusable classes. As a main
14
4916
by: Brian Keating EI9FXB | last post by:
I wonder can anyone reccomment a solution to this problem. Let me explain, I've services running on my system, my application receives diagnostic messages from these services, what i want to do is create an MDIChild window for each service that is sending messages. Ok so far so good, but I get problems if one service is constantly sending messages to it's window because, this window is very busy updating it's view, hence because it's...
8
16348
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware of? Thanks for any help Brian
20
383
by: Moty Michaely | last post by:
Hello, Can anyone please help me finding a good way to develop a c# winforms application client for a pre-developed windows service? Should I use wse2 with tcp protocol? Bu I still have win98 clients. mmm.. Please help. Thanks, Moty.
14
4111
by: | last post by:
Hi All, I am little confused here, hope you can help me. While processing WM_POWERBROADCAST (wParam=PBT_APMQUERYSUSPEND), I MUST to do some lengthy operation(30 sec) before system Suspends or hibernates. To achieve this, in my message handler when processing PBT_APMQUERYSUSPEND, I create another thread which takes care of making this lengthy operation, and when its done I
8
1665
by: Bob | last post by:
This is a bug that affects all controls, not just the ones that it's screwing up in my app. I really need a workaround. Anyone? Please? Before I regret letting my MSDN subscription run out and pay the hundred bucks or so to get MS tech support so they can tell me how to get around their own bug? Bob P.S. I meant to say "there are only two messages for mouse <movement> events" "Bob" <noemail@nospam.net> wrote in message
1
1539
by: Ron Bremmers | last post by:
Hello, I have a Windows Service which executes some code each 2 seconds. Every 2 seconds I want to log the result in a Windows Forms application. What is the best approach? I think it is .NET remoting, but when the "client" application is not started, no logging has to be done. So the service has to know if there is a client application to log to. How can I do
2
2690
by: Pierre Rouleau | last post by:
Hi all, I have a consistent test case where os.popen3() hangs in Windows. The system hangs when retrieving the lines from the child process stdout. I know there were several reports related to os.popen3() hanging under Windows in this group before. I stumbled on a case where a piece of code works in some occasions and hangs consistently given different data. It performs exactly the same on 3 different computers running Windows:
0
9622
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10107
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10048
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9916
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.