473,785 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WndProc Help

I am trying to override WndProc like I would in this VB.NET sub. How do I do
it?

<System.Securit y.Permissions.P ermissionSetAtt ribute(System.S ecurity.Permiss i
ons.SecurityAct ion.Demand, Name:="FullTrus t")_
Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
If m.Msg = WM_QUERYENDSESS ION Then
ShutDownWindows = True
End If
MyBase.WndProc( m)
End Sub

Thanks in advance,

--
Newbie Coder
(It's just a name)
Mar 19 '07 #1
3 3340

"Newbie Coder" <ne*********@sp ammeplease.comw rote in message
news:Ol******** ******@TK2MSFTN GP03.phx.gbl...
>I am trying to override WndProc like I would in this VB.NET sub. How do I
do
it?
>
<System.Securit y.Permissions.P ermissionSetAtt ribute(System.S ecurity.Permiss i
ons.SecurityAct ion.Demand, Name:="FullTrus t")_
[/*permission stuff goes here*/]
Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
virtual void WndProc( System::Windows ::Forms::Messag e% m ) override

{
If m.Msg = WM_QUERYENDSESS ION Then
if (m.Msg == WM_QUERYENDSESS ION) {
ShutDownWindows = True
ShutDownWindows = true;
End If
}
MyBase.WndProc( m)
__super::WndPro c(m);
End Sub
}
>
Thanks in advance,

--
Newbie Coder
(It's just a name)


Mar 20 '07 #2
The Virtual keyword causes compiler errors so, I don't know how to get
around it

--
Newbie Coder
(It's just a name)

"Ben Voigt" <rb*@nospam.nos pamwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>
"Newbie Coder" <ne*********@sp ammeplease.comw rote in message
news:Ol******** ******@TK2MSFTN GP03.phx.gbl...
I am trying to override WndProc like I would in this VB.NET sub. How do I
do
it?

<System.Securit y.Permissions.P ermissionSetAtt ribute(System.S ecurity.Permiss i
ons.SecurityAct ion.Demand, Name:="FullTrus t")_
[/*permission stuff goes here*/]
Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)

virtual void WndProc( System::Windows ::Forms::Messag e% m ) override

{
If m.Msg = WM_QUERYENDSESS ION Then
if (m.Msg == WM_QUERYENDSESS ION) {
ShutDownWindows = True
ShutDownWindows = true;
End If
}
MyBase.WndProc( m)
__super::WndPro c(m);
End Sub
}

Thanks in advance,

--
Newbie Coder
(It's just a name)


Mar 20 '07 #3
Newbie Coder wrote:
The Virtual keyword causes compiler errors so, I don't know how to get
around it
What do you have right before the virtual keyword? Do you by any chance
have "protected virtual"? In that case a ':' is missing after protected.
Change your code to protected: virtual [...].

Otherwise you should post us your code, including at least 1-2 lines
before and after the problematic line, and quote the exact error message
too.

Also tell us if you're using the VS 2003 MC++ syntax, or the VS 2005's
C++/CLI.

Tom
Mar 21 '07 #4

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

Similar topics

6
6636
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);
6
3622
by: Turbo_King | last post by:
Hi, I am trying to write a class which creates a window and then assigns a method of the class as the wndproc function for the window so that each instance of the class can handle the messages for its repective form. I am trying to do the following: class myWinClass {
0
2510
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
0
4500
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...
0
4116
by: han.phony | last post by:
Hi, I am trying to intercept the message sent back by winmm.dll's mciSendString method when playback is finished. I tried to override the WndProc in the form but I didn't get/intercept the message, here is the code fragment: public const int MM_MCINOTIFY = 953; public const int MM_NOTIFY_ABORTED = 4; public const int MCI_NOTIFY_FAILURE = 8; public const int MCI_NOTIFY_SUCCESSFUL = 1; public const int MCI_NOTIFY_SUPERSEDED = 2;
2
2886
by: Phuff | last post by:
I have an application that should run in the system tray while open. It is supposed to be open at all times and I need it to dissapear when the "X" button is pushed on the form...but without closing the app. I've tried overriding the closing event > Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As > System.ComponentModel.CancelEventArgs) Handles MyBase.Closing > 'Don't close this form > e.Cancel = True
3
3820
by: mike2036 | last post by:
Hi all, I'm seeing cases running my application outside the debugging environment where WndProc is running in a separate thread context from the form and mainline. This is causing issues trying to post messages from the middleware since the windows handle is in a different context and therefore the PostMessage() call returns an INVALID_WINDOW_HANDLE error. Has anyone else experienced this? Is there a way to force WndProc, the form,...
2
3931
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
0
9643
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
9480
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
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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
9946
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
8968
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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
3
2877
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.