WndProc Help

  • Thread starter Thread starter Newbie Coder
  • Start date Start date
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,
 
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) {
 
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,
 
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
 
Back
Top