سؤال فى console application - Mohamed20 - 10-03-17
هل يمكن اخفاء زر الاخلاق فى console application ؟ او جعل console application لا تغلق عند الضغط على زر الاغلاق ؟
RE: سؤال فى console application - مساعدة - 10-03-17
السلام عليكم
وجدت هذا الحل في هذا الرابط وحولته لفيجوال بيسيك
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
RE: سؤال فى console application - Mohamed20 - 11-03-17
(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
جزاك الله خير
|