تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
سؤال فى console application
#1
هل يمكن اخفاء زر الاخلاق فى console application  ؟ او جعل console application  لا تغلق عند الضغط على زر الاغلاق ؟
الرد }}}
تم الشكر بواسطة:
#2
السلام عليكم


وجدت هذا الحل في هذا الرابط وحولته لفيجوال بيسيك
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
الرد }}}
تم الشكر بواسطة: Mohamed20
#3
(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

جزاك الله خير
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم