473,406 Members | 2,633 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,406 software developers and data experts.

WndProc Help

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

<System.Security.Permissions.PermissionSetAttribut e(System.Security.Permissi
ons.SecurityAction.Demand, Name:="FullTrust")_
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_QUERYENDSESSION 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 3322

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:Ol**************@TK2MSFTNGP03.phx.gbl...
>I am trying to override WndProc like I would in this VB.NET sub. How do I
do
it?
>
<System.Security.Permissions.PermissionSetAttribut e(System.Security.Permissi
ons.SecurityAction.Demand, Name:="FullTrust")_
[/*permission stuff goes here*/]
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
virtual void WndProc( System::Windows::Forms::Message% m ) override

{
If m.Msg = WM_QUERYENDSESSION Then
if (m.Msg == WM_QUERYENDSESSION) {
ShutDownWindows = True
ShutDownWindows = true;
End If
}
MyBase.WndProc(m)
__super::WndProc(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.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:Ol**************@TK2MSFTNGP03.phx.gbl...
I am trying to override WndProc like I would in this VB.NET sub. How do I
do
it?

<System.Security.Permissions.PermissionSetAttribut e(System.Security.Permissi
ons.SecurityAction.Demand, Name:="FullTrust")_
[/*permission stuff goes here*/]
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

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

{
If m.Msg = WM_QUERYENDSESSION Then
if (m.Msg == WM_QUERYENDSESSION) {
ShutDownWindows = True
ShutDownWindows = true;
End If
}
MyBase.WndProc(m)
__super::WndProc(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
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...
6
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...
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),...
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...
0
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,...
2
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...
3
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...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
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...
0
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,...

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.