نوشته شده توسط
ACorvinus
سلام دوباره .
من نگفتم تمام پروژه رو Upload کنین .
فقط ماژول رو بزارین و بگین در Form_Load چی کار می کنین که این اتفاق می افته ؟
همین .
موفق باشین .
دويت عزيز به همه توابع Error ميده. فكر كنم با خود ماژول مشكل داره.
فكر كنم شما فكر ميكنيد كه روتين من ايراد داره؟
باشه اينم روتين و رويداد فرم :
Module
Module1
Public blnAdd AsBoolean = False
Public MEShamsi AsNew MEShamsiDate.ShamsiDate
Public objConnection As SqlConnection
Public StrVahed AsString
'
PrivateDeclareFunction RemoveMenu Lib"user32" (ByVal hMenu As IntPtr, ByVal nPosition AsInteger, ByVal wFlags AsLong) As IntPtr
PrivateDeclareFunction GetSystemMenu Lib"user32" (ByVal hWnd As IntPtr, ByVal bRevert AsBoolean) As IntPtr
PrivateDeclareFunction GetMenuItemCount Lib"user32" (ByVal hMenu As IntPtr) AsInteger
PrivateDeclareFunction DrawMenuBar Lib"user32" (ByVal hwnd As IntPtr) AsBoolean
'
PrivateConst MF_BYPOSITION = &H400
PrivateConst MF_REMOVE = &H1000
PrivateConst MF_DISABLED = &H2
PublicSub DisableCloseButton(ByVal hwnd As IntPtr)
Dim hMenu As IntPtr
Dim menuItemCount AsInteger
'
'Obtain the handle to the form's system menu
hMenu = GetSystemMenu(hwnd,
False)
'
'Obtain the number of items in the menu
menuItemCount = GetMenuItemCount(hMenu)
'
'Remove the system menu Close menu item.
'The menu item is 0-based, so the last
'item on the menu is menuItemCount - 1
Call RemoveMenu(hMenu, menuItemCount - 1, _
MF_DISABLED Or MF_BYPOSITION)
'
'Remove the system menu separator line
Call RemoveMenu(hMenu, menuItemCount - 2, _
MF_DISABLED Or MF_BYPOSITION)
'
'Force a redraw of the menu. This
'refreshes the titlebar, dimming the X
Call DrawMenuBar(hwnd)
EndSub
End Module
اينم رويداد فرم
Private
Sub frmMain_HandleCreated(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.HandleCreated
DisableCloseButton(Me.Handle)
EndSub