By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,836 Members | 1,696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,836 IT Pros & Developers. It's quick & easy.

WndProc Help

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a

"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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.