As a Kinder Egg 3 in 1 Progress Dialogs Plus One Extra
I did find in MSDN that shell32 are using three (four) different progress interfaces (derived from the first one) for same things.
Here are they listed as code snippets
Code:
'<---From here is from Fafalone's mIID.bas module
Public Sub DEFINE_UUID(name As UUID, L As Long, w1 As Integer, w2 As Integer, B0 As Byte, b1 As Byte, b2 As Byte, B3 As Byte, b4 As Byte, b5 As Byte, b6 As Byte, b7 As Byte)
With name
.Data1 = L: .Data2 = w1: .Data3 = w2: .Data4(0) = B0: .Data4(1) = b1: .Data4(2) = b2: .Data4(3) = B3: .Data4(4) = b4: .Data4(5) = b5: .Data4(6) = b6: .Data4(7) = b7
End With
End Sub
Public Function IID_IProgressDialog() As UUID
'{EBBC7C04-315E-11d2-B62F-006097DF5BD4}
Static IID As UUID
If (IID.Data1 = 0&) Then Call DEFINE_UUID(IID, &HEBBC7C04, CInt(&H315E), CInt(&H11D2), &HB6, &H2F, &H0, &H60, &H97, &HDF, &H5B, &HD4)
IID_IProgressDialog = IID
End Function
'---> End here
Public Const sCLSID_ProgressDialog As String = "{F8383852-FCD3-11d1-A6B9-006097DF5BD4}"
Public Declare Function CoCreateInstance Lib "ole32.dll" (ByRef rclsid As Any, ByVal pUnkOuter As Long, ByVal dwClsContext As Long, riid As Any, ByRef ppv As Any) As Long
Public Declare Function GuidFromStringA Lib "shell32.dll" Alias "#703" (ByVal pszGUID As String, ByRef pguid As GUID) As Long
Public Declare Function GuidFromStringW Lib "shell32.dll" Alias "#704" (ByVal pszGUID As Long, ByRef pguid As GUID) As Long
Public Function ShCreateIProgressDialog(pIPD As IProgressDialog) As Long
Static CLSID_ProgressDialog As GUID
Dim hr As Long
hr = GuidFromStringW(StrPtr(sCLSID_ProgressDialog), CLSID_ProgressDialog) '<-- This always returns success if you got correct A or W version
hr = CoCreateInstance(CLSID_ProgressDialog, 0, CLSCTX_INPROC_SERVER, IID_IProgressDialog, pIPD)
If hr = S_OK Then
ShCreateIProgressDialog = S_OK
Else
ShCreateIProgressDialog = hr
End If
End Function
Public Function ShCreateIOperationsProgressDialog(pIOPD As IOperationsProgressDialog) As Long
Dim hr As Long
Dim pIPD As IProgressDialog
hr = ShCreateIProgressDialog(pIPD)
If hr = S_OK Then
Set pIOPD = pIPD
ShCreateIOperationsProgressDialog = S_OK
Else
ShCreateIOperationsProgressDialog = hr
End If
Set pIPD = Nothing
End Function
Public Function ShCreateIActionProgressDialog(pIAPD As IActionProgressDialog) As Long
Dim hr As Long
Dim pIPD As IProgressDialog
hr = ShCreateIProgressDialog(pIPD)
If hr = S_OK Then
Set pIAPD = pIPD
ShCreateIActionProgressDialog = S_OK
Else
ShCreateIActionProgressDialog = hr
End If
Set pIPD = Nothing
End Function
Public Function ShCreateIActionProgress(pIAP As IActionProgress) As Long '**
Dim hr As Long
Dim pIPD As IProgressDialog
hr = ShCreateIProgressDialog(pIPD)
If hr = S_OK Then
Set pIAP = pIPD
ShCreateIActionProgress = S_OK
Else
ShCreateIActionProgress = hr
End If
Set pIPD = Nothing
End Function
** The fourth one is regarding to MSDN not implemented by applications.
https://learn.microsoft.com/en-us/wi...actionprogress
Re: As a Kinder Egg 3 in 1 Progress Dialogs Plus One Extra
Actually IFileOperation Interface is using one the above interfaces - IOperationsProgressDialog (the second one) in this method IFileOperation::SetProgressDialog(IOperationsProgressDialog *popd);
Code:
Public Const sCLSID_FileOperation As String = "{3ad05575-8857-4850-9277-11b85bdb8e09}"
Public Function IID_IFileOperation() As UUID
'{947aab5f-0a5c-4c13-b4d6-4bf7836fc9f8}
Static IID As UUID
If (IID.Data1 = 0&) Then Call DEFINE_UUID(IID, &H947AAB5F, CInt(&HA5C), CInt(&H4C13), &HB4, &HD6, &H4B, &HF7, &H83, &H6F, &HC9, &HF8)
IID_IFileOperation = IID
End Function
Public Function ShCreateIFileOperation(pIFO As IFileOperation) As Long
Static CLSID_FileOperation As GUID
Dim hr As Long
hr = GuidFromStringW(StrPtr(sCLSID_FileOperation), CLSID_FileOperation) '<-- This always returns success if you got correct A or W version
hr = CoCreateInstance(CLSID_FileOperation, 0, CLSCTX_INPROC_SERVER, IID_IFileOperation, pIFO)
If hr = S_OK Then
ShCreateIFileOperation = S_OK
Else
ShCreateIFileOperation = hr
End If
End Function
Re: As a Kinder Egg 3 in 1 Progress Dialogs Plus One Extra
IActionProgress is used by INamespaceWalker-- as you might gather from being able to use CoCreateInstance to get any of these; the system progress dialog class implements them all for various levels of detail and control.
Set prog = New ProgressDialog
and Set fileop = New FileOperation
can replace all the GUID/IID/CoCreateInstance.
See also:
[VB6] Class to display a standard Explorer-style progress window (showing how to actually use the interfaces)
[VB6] Use IFileOperation to replace SHFileOperation for modern Copy/Move box/prompts