473,387 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WndProc

108 100+
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 2243
Plater
7,872 Expert 4TB
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
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(GetMessage(&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.Since it is a CALLBACK function, Windows Operating system will call the WndProc() not our application.

Regards,

Vinoth
Sep 28 '07 #3
Plater
7,872 Expert 4TB
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 100+
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 Expert 4TB
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
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...
0
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),...
2
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...
0
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...
2
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
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...
3
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...
4
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...
0
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.