473,624 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WndProc

108 New Member
Hi experts,

Can anyone explain to me about the Wndproc? I'm currently doing conversion from Borland C++ to C++.NET and this is my first to encounter this WndProc since i'm not a Windows programmer. Is there anything alternative for this in .net? Please give me some idea about it.

Thanks,
Sep 27 '07 #1
5 2275
Plater
7,872 Recognized Expert Expert
WndProc() is the "message pump" for windows forms (actually I think any windows application can use it)
it gets all the messages like WM_MouseClick and things like that.

Now I'm unsure about the C++ in .NET, but VB.NET/C# don't really have a general use for overriding that function, as it has methods for mouseclicks and everything built in.
Sep 27 '07 #2
vinot85
53 New Member
WndProc is a CALL BACK function used to respond the user events after the window has been created and displayed.It is not the message pump, the message pump is,
while(GetMessag e(&msg, NULL, 0, 0))
{
DispatchMessage (&msg):
}
The GetMessage() will get the message from the system message queue and give it to corresponding WndProc().The WndProc will handle the message accordingly.Sin ce it is a CALLBACK function, Windows Operating system will call the WndProc() not our application.

Regards,

Vinoth
Sep 28 '07 #3
Plater
7,872 Recognized Expert Expert
Hehe I was going to say I got schooled there, but GetMessage() is a win32 api function (or so msdn would claim) and not part of the .NET framework specifically.
For access to windows messages, you would use the WndProc() function
Sep 28 '07 #4
romcab
108 New Member
Thanks to all your response. I have a follow up questions to you guys.

How can I implement the WndProc in .Net? In Win32 it uses HWND as handle to the window but in .Net I think is only the message. If I have a SetTimer function which also need handle as parameter so how can I do that?

example;
//
// Create a timer to schedule updates
//
SetTimer( Handle, // handle to window
TIMER, // timer identifier
ONE_SECOND, // 1-second interval
(TIMERPROC) NULL); // no timer callback

In Wndproc()
...
if ( Message.WParam == TIMER )
...Do this...

What will be the equivalent of Handle??

Hope you can help me guys.
Oct 1 '07 #5
Plater
7,872 Recognized Expert Expert
The Message object in .NET has a property that is the handle to the window.
Oct 1 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
6630
by: Beach Potato | last post by:
Hi: I've searched newsgroups and various archives, including MSDN & MFC sources, but at this point failed to locate an accurate and simple implementation of WndProc function for MSWindows window objects. Something like: class BaseWindow { virtual LRESULT WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
0
2494
by: sshuangw | last post by:
Hello: I am encountering a very weird issue with MDI child, Overriden WndProc function and hidden form. Basically, the application has two forms, Form1(parent form), Form2(Child form), Form2's WndProc method is overriden, if the message is CLOSE message, just hide the form. I first initialize and show the child form, then close it by clicking the Close(X) button, the overriden WndProc method gets invoked, and the form is hidden. Then
2
21456
by: Ed Sutton | last post by:
How can a WndProc be created inside a component? Currently I have a WndProc in my frmMain. It looks for WM_DEVICECHANGE messages for connection and removal events for a USB/Serial device. My frmMain uses a component to communicate with a USB/Serial device. I would prefer that this component handle the WM_DEVICECHANGE messages internally and only fires events to my frmMain when my USB device connects or disconnects. In case anyone...
0
4492
by: cyrille | last post by:
Hello from example from web i did a little code to avoiding columnHeader resize. this code seems to work well, but when I put a 'normal' ListView on the same Form than my overrided ListView it seems to stop working. if I'm resizing 'normal' ListView ColumnHeaders, then I can resizing ColumnHeaders of my overrided ListView. If I don't resizing 'normal' ListView ColumnHeaders, then resizing of my overrided ListView ColumnHeaders is...
2
2457
by: dworthem | last post by:
if I have the compiler option /clr:oldSyntax in a Windows Forms application protected: void WndProc(System::Windows::Forms::Message* m) is called If I remove oldSyntax protected:
2
3917
by: Derrick | last post by:
Hello all; I'm trying to create a UI that's a little atypical. In the main form's Paint event handler, I draw an image on the form - this is what I want to by my "real" UI. I turned off the form border, and set the form's background and transparency key to be the same value. As you know, because of this there is no sign of the form, just the image I painted. So far, so good. Since the form border - and hence the title bar - is...
3
514
by: S Wheeler | last post by:
Hi - I have a vc++ WinForms app. Can I override the WndProc so I can send custom messages to my app. Is there any way to do this? I need to notify the main form of events from a library. How is this done in VC++? Thanks
4
12006
by: Rob | last post by:
I've constructed a user control inherited from ListView so I can handle and respond to scrolling events (to keep 2 listviews scrolling in sync). My user control includes an Overrides of WndProc (I've attached the code at the end of this mail). Is it possible to 'disable' this override until I need it - it's just when I populate the ListViews this sub is called repeatadly. What I'd like to do is populate the listviews and then 'enable'...
0
1326
by: makifsar | last post by:
I am using a comserver to communicate remote equipments. This server gives response via WndProc. First I call READ function to start communication and remote equipment gives response this via WndProc. Mw request is, I want to sleep READ thead and after taking right message from WndProc, wake up this thead return this value to main thead. I am trying some methods using delagate but I can not achive it. My Program like this Public Void...
4
4153
by: Piotrekk | last post by:
Hi I have overriden WndProc to detect when the key is pressed. Because it didnt work i inserted debug code to detect what messages pass through the WndProc exactly.My application is minimized in taskbar and visible via notifyicon. When I run the program : protected override void WndProc(ref Message m) { System.Diagnostics.Debug.WriteLine(m.Msg);
0
8238
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
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8624
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...
0
8478
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
5565
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
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.