10-03-17, 05:32 PM
10-03-17, 09:50 PM
السلام عليكم
وجدت هذا الحل في هذا الرابط وحولته لفيجوال بيسيك
how can i disable close button of console window in a visual studio console application?
وجدت هذا الحل في هذا الرابط وحولته لفيجوال بيسيك
how can i disable close button of console window in a visual studio console application?
كود :
Module Module1
Private Const MF_BYCOMMAND As Integer = &H0
Public Const SC_CLOSE As Integer = &HF060
<Runtime.InteropServices.DllImport("user32.dll")> _
Public Function DeleteMenu(hMenu As IntPtr, nPosition As Integer, wFlags As Integer) As Integer
End Function
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Function GetSystemMenu(hWnd As IntPtr, bRevert As Boolean) As IntPtr
End Function
<Runtime.InteropServices.DllImport("kernel32.dll", ExactSpelling:=True)> _
Private Function GetConsoleWindow() As IntPtr
End Function
Sub Main()
DeleteMenu(GetSystemMenu(GetConsoleWindow(), False), SC_CLOSE, MF_BYCOMMAND)
Console.Read()
End Sub
End Module11-03-17, 01:06 AM
(10-03-17, 09:50 PM)مساعدة كتب : [ -> ]السلام عليكم
وجدت هذا الحل في هذا الرابط وحولته لفيجوال بيسيك
how can i disable close button of console window in a visual studio console application?
كود :
Module Module1
Private Const MF_BYCOMMAND As Integer = &H0
Public Const SC_CLOSE As Integer = &HF060
<Runtime.InteropServices.DllImport("user32.dll")> _
Public Function DeleteMenu(hMenu As IntPtr, nPosition As Integer, wFlags As Integer) As Integer
End Function
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Function GetSystemMenu(hWnd As IntPtr, bRevert As Boolean) As IntPtr
End Function
<Runtime.InteropServices.DllImport("kernel32.dll", ExactSpelling:=True)> _
Private Function GetConsoleWindow() As IntPtr
End Function
Sub Main()
DeleteMenu(GetSystemMenu(GetConsoleWindow(), False), SC_CLOSE, MF_BYCOMMAND)
Console.Read()
End Sub
End Module
جزاك الله خير