WndProc Help

N

Newbie Coder

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

<System.Security.Permissions.PermissionSetAttribute(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,
 
B

Ben Voigt

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


<System.Security.Permissions.PermissionSetAttribute(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) {
 
N

Newbie Coder

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 said:
Newbie Coder said:
I am trying to override WndProc like I would in this VB.NET sub. How do I
do
it?


<System.Security.Permissions.PermissionSetAttribute(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 }

__super::WndProc(m);
End Sub }


Thanks in advance,
 
T

Tamas Demjen

Newbie said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top