عرض مشاركة واحدة
قديم 06-04-2019, 08:51 PM   #1
تاريخ التسجيل: Feb 2019
المشاركات: 1,010
التقييم: 10
تاريخ التسجيل: Feb 2019
المشاركات: 1,010
التقييم: 10
افتراضي كود لفتح واغلاق السيدي

كود لفتح واغلاق السيدي
ضع هذا في الفورم
كود:
'Option Explicit

Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type

Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim t As NOTIFYICONDATA

Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
'Dim returnstring As String
'Dim retvalue As Long

Private Sub Form_Load()
t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
t.ucallbackMessage = WM_MOUSEMOVE
t.hIcon = Picture1.Picture
t.szTip = "CD Open/Close by Rinolds Kaòeps" & Chr$(0)
Shell_NotifyIcon NIM_ADD, t
Me.Hide
App.TaskVisible = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
Shell_NotifyIcon NIM_DELETE, t
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'If Hex(X) = "1E3C" Then
'	Me.PopupMenu mnuFile

'End If

Dim lMsg As Long
Static bInHere As Boolean
lMsg = X / Screen.TwipsPerPixelX
Select Case lMsg
'	Case WM_LBUTTONDBLCLK:
'
' On Mouse DoubleClick - Restore the window

'On Error Resume Next
'Me.Show
'	retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0)

'If Me.WindowState = vbMinimized Then
'	Me.WindowState = vbDefault
'End If
'Me.ZOrder
Case WM_LBUTTONDOWN:
retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0)
Case WM_RBUTTONDOWN:
retvalue = mciSendString("set CDAudio door closed", returnstring, 127, 0)

End Select


End Sub


الفارس غير متواجد حالياً   اقتباس