选项 Strict 给我一个Late Binding错误,我总是将对象转换为正确的类型,但在这种特定情况下,我不知道如何转换该对象。
警告出现在指令中Shell.ToggleDesktop()
这是代码:
''' <summary>
''' "Shell" CLASSID.
''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776890%28v=vs.85%29.aspx
''' </summary>
Private Shared ReadOnly CLSIDShell As New Guid("13709620-C279-11CE-A49E-444553540000")
''' <summary>
''' Gets the objects in the Shell.
''' Methods are provided to control the Shell and to execute commands within the Shell.
''' There are also methods to obtain other Shell-related objects.
''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/bb774094%28v=vs.85%29.aspx
''' </summary>
Private Shared ReadOnly Property Shell As Object
Get
If _Shell Is Nothing Then
_Shell = Activator.CreateInstance(Type.GetTypeFromCLSID(CLSIDShell))
Return _Shell
Else
Return _Shell
End If
End Get
End Property
Private Shared _Shell As Object = Nothing
''' <summary>
''' Shows or hides the desktop.
''' </summary>
Friend Shared Sub ToggleDesktop()
Shell.ToggleDesktop()
End Sub