Hi all of you,
I'm using this code in order to remove close button in one Window object.
Imports System.Runtime.InteropServices Imports System.Windows.Interop Partial Public Class Rendimientos Inherits Window Private Const MF_BYPOSITION As Integer = 1024 Private Const MF_DISABLED As Integer = 2 Private Const MF_REMOVE As Integer = 4096<DllImport("user32.dll")> _ Private Shared Function GetSystemMenu(hwnd As IntPtr, revert As Integer) As IntPtr End Function<DllImport("user32.dll")> _ Private Shared Function GetMenuItemCount(hmenu As IntPtr) As Integer End Function<DllImport("user32.dll")> _ Private Shared Function RemoveMenu(hmenu As IntPtr, npos As Integer, wflags As Integer) As Integer End Function<DllImport("user32.dll")> _ Private Shared Function DrawMenuBar(hwnd As IntPtr) As Integer End Function Public Sub Rendimientos() Try InitializeComponent() AddHandler Me.SourceInitialized, AddressOf Rendimientos_SourceInitialized Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Public Sub Rendimientos_SourceInitialized(sender As Object, e As EventArgs) Dim helper As New WindowInteropHelper(Me) Dim windowHandle As IntPtr = helper.Handle Dim hmenu As IntPtr = GetSystemMenu(windowHandle, 0) Dim cnt As Integer = GetMenuItemCount(hmenu) RemoveMenu(hmenu, cnt - 1, MF_DISABLED Or MF_BYPOSITION) RemoveMenu(hmenu, cnt - 2, MF_DISABLED Or MF_BYPOSITION) DrawMenuBar(windowHandle) End Sub End Class
No results for this code when I run my Window object from my page.
Close button keeps visible...
Problem (I think) happen because I do not put "EntryPoint" in every definition.
But, unfortunately If I put EntryPoint Visual Studio compiler denounces:
"EntryPoint is not declared. It may be inaccessible due to its protection level"
I'm stuck with that, help me out!
Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF and SilverLight stuff