473,498 Members | 1,815 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 2252
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(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 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
6617
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
2476
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
21440
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
4477
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
2450
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
3899
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
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...
4
11956
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
1310
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
4132
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
7126
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
7005
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...
0
7381
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...
0
5465
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,...
1
4916
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...
0
4595
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...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
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 ...

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.