Saving that for oleexp v6.9 :eek:
Printable View
Saving that for oleexp v6.9 :eek:
Looks like if there is an error in exp_explrvw.odl for IExplorerPaneVisibility. If I try to implement the interface in a class module I get a 'bad interface implementation' error due to the out-parameter.
I changed the declaration for GetPaneState to
and recompiled the tlb. I can then implement IExplorerPaneVisibility - e.g. in your Explorer Sample/frmBasic. Nevertheless the method is never called.Code:HRESULT GetPaneState(
[in] UUID *ep,
[in, out] EXPLORERPANESTATE *peps);
What's wrong? The declaration? Or is something missing to get the implemnt to work?
(I didn't fully understand the related MSDN information for this interface as they talk about an additional implementation of IServiceProvider for the hosting class...)
How is it going with x64 support? I couldn't succeed even with x86 version build on my machine. Even with older tools versions. Could you please provide detailed HOWTO to build your TLB? I mean, environment, commands, etc.? It would be very helpful!
modify mkex4.bat to point to your copy of mktyplib.exe
mine looks more like this.
then run it. Or just run the full command from a console.Code:REM C:\PROGRA~2\MIB055~1\VC98\Bin\MKTYPLIB.exe oleexp.odl
"C:\Program Files\Microsoft Visual Studio\Common\Tools\VB\typlib\mktyplib.exe" oleexp.odl
Now a question for you - What ODL type is used for pointers in VBA x64 ?
fafalone might need to convert this to MIDL before supporting 64bit.
Last I checked he didn't know how to "redefine" built in types.
In order to do that, you need to copy some of the base files like "unknwn.idl"
into the project directory so that those are included instead of the ones from the SDK/DDK folder.
Then you can modify the definitions in those files directly to get around MIDL's redefinition error.
Credit goes to Bruce McKinney for figuring that out (although he had help from MS). he created WinU.tlb
My typelibs all use MIDL also.
An example of this: http://vb.mvps.org/hardweb/mckinney2a.htm
As for converting the interfaces and APIs to VBA x64 - it's ground seldom tread.
You are better off starting a typelib from scratch than using oleexp.tlb.
and then there's the issue of distributing your source - unless you replace all the MS code, you can't distribute it legally.
Bruce McKinney (and then the company who took over the typelib) worked out licensing with MS.
Well, I have already tried that. I get
--------------------Code:Microsoft (R) Type Library Generator Version 2.20.4230
Copyright (c) Microsoft Corp. 1993-1995. All rights reserved.
fatal error M0006: unable to pre-process input file
Finally I managed to compile it. The reason for M0006 was missing mspdb60.dll on my OS. Placing it next to cl.exe did the job. It builds now.
Can you please clarify what you expect a 64-bit compilation to provide?
This TLB is exclusively for VB. The only 64-bit scenario is if you're using 64-bit VBA in MS Office. The TLB works as-is in 64-bit VBA; the vast majority of types aren't 64-bit types to begin with, in the event there is a LongLong etc other types substitute. Refer to this post earlier in this thread.
These aren't original interfaces; what differences exist between the original 32-bit and 64-bit versions? IIRC there aren't two separate versions or major differences in the SDK the original defs are copied from.
==
Building the normal x86 version is just a matter of using MKTYPLIB from the Visual Studio 6 install; as DEXWERX mentioned there's a compile shortcut you can just edit the path for. There's no setting changes from the default install.
===
My problem with compiling with MIDL is that MIDL.EXE simply does not work. Period. For anything. Either oaidl is missing, and absolutely nothing, even a blank typelib, will compile without it, some other file is missing, or there's errors in oaidl or another pre-existing dpend file, whether precompiled or not, no matter which SDK version it comes from, no matter which SDK version MIDL.EXE comes from. Just can't get it to work even for a 'hello world' empty typelib, not a problem specific to oleexp. Fresh install of new VS version, no help. Running vcvarsall that came with the fresh install, no help. Every permutation of options and versions all has some excuse or another for not compiling at all.
It's extraordinarily frustrating, never in my life have I encountered a program so dedicated to not working.
the biggest difference is pointers. These obviously are 64-bit as opposed to 32-bit pointers in 32-bit windows. It's not just the returns from subs and the addresses of subs but also all handles. Microsoft says that to-date pointers are all of values that would fit in 32-bit variables even though addresses passed to/from function calls need the full 64 bits of space.
Here is what MSDN says regarding a call to the CopyFileEx function:
BOOL WINAPI CopyFileEx(
_In_ LPCTSTR lpExistingFileName,
_In_ LPCTSTR lpNewFileName,
_In_opt_ LPPROGRESS_ROUTINE lpProgressRoutine,
_In_opt_ LPVOID lpData,
_In_opt_ LPBOOL pbCancel,
_In_ DWORD dwCopyFlags
);
5 of the 6 parameters are 64-bit pointers to variables and a pointer to a callback routine. If the tlb says these are 32-bit pointers to be on the stack like in VB6 and Office 64 is making a call that 64-bit Windows expects to have 5 64-bit pointers then bad things are going to happen.
Forgive me for not being too familiar with this, but are you saying the 32-bit and 64-bit difference occurs in the same type? That on a 64-bit VBA a DWORD is no longer 4 bytes, instead of a new definition with an 8-byte variable?
How does the original source for declares like that handle things; is any change applied besides the 64-bit option for MIDL.exe?
If there's no changes and it's simply a compiler option, and someone can do that, I'd be happy to include the 64-bit version in the download, but honestly I've spent dozens of hours trying to compile anything with midl.exe and aren't really up to risking my sanity to keep fighting with it myself. I mean it's telling me an unmodified file from the official MS SDK is so full of errors it can't compile just by itself, and not one of the countless solutions found from googling the errors has helped... I'm just a poor old school VB programmer who never grew up into the more advanced languages and dev tools so it's already a challenge :blush:
MS defines a DWord the same in 32 and 64-bit programs. the difference is in pointers and handles. They even use the same words for handles and pointers but the compiler knows the difference. For example, in the previous example I posted a few minutes ago, I showed this:
LPCTSR lpExistingFileName is a pointer to the string holding the pathname of the file we want to copy. The "LP" in the name generally tells us that it is a pointer. In fact, it is is the equivalent of passing a parameter ByRef in VB6 or VBA since that passes the address on the stack instead of the actual variable itself. The compiler knows from switches that are set whether to treat the variable address as a 32 or 64-bit address.Code:BOOL WINAPI CopyFileEx(
_In_ LPCTSTR lpExistingFileName,
_In_ LPCTSTR lpNewFileName,
_In_opt_ LPPROGRESS_ROUTINE lpProgressRoutine,
_In_opt_ LPVOID lpData,
_In_opt_ LPBOOL pbCancel,
_In_ DWORD dwCopyFlags
);
My main exposure to the tlb-like world is via API Declare statements at the top of our code. Since in 32-bit VB or VBA there is no separate variable type for a handle, pointer or address everyone uses Long just like they do when they reference a DWord type which is our (VB) normal Long data type. That's fine in 32-bit but when we allow 64-bit then some of the Longs now have to become 64-bit instead of 32-bit. MS chose in 64-bit Office to cal this new variable type LongPtr and the compiler decides to make it 32 or 64 bit depending on whether the programmer is running 32 or 64-bit Office. So I don't know about type library code compilers but I am going to guess that the older ones that pre-date 64-bit OS's may not have a separate data type for handles, pointers and addresses but just show them as Longs. If so, then someone has a task to go back through the source and separate the DWords from the pointers and change all of the pointers to that new type (if there is one). I am hoping that this problem had come up in the shift from 16 to 32 bit and had been solved way back then but maybe not.
I'm certainly not a tlb wizard but I think the tlb info is static; I don't think it changes itself if it is being used in a 64 or 32-bit environment. I suppose it is possible for the type library file to adjust itself depending on whether the code is being compiled as a 32 or 64 bit program. My gut feel is that we need 2 separate type libraries and you make a reference to the appropriate one for whichever environment you are coding to.
Well, as you mentioned - I needed a few interfaces to be used in 64-bit VBA in MS Office. As other colleagues mentioned all the problems come from different pointers size. Namely, datastructure members and datapointers to data. It can be done by modifying ODL definitions. That's why I asked you to help with the build. Anyway, the problems with the build I had has been solved, so, no need to worry about that anymore.
Regarding using COM\OLE staff in Office VBA - it makes VBA programs bound to Windows platform. To support Office VBA on other platforms (like MAC) it's a very bad decision. So, I think it doesn't make much worth paying much attention to x64 bit COM\OLE staff.
Thanks to everyone for your replies and thoughts!
Well as mentioned when this first came up, in 64-bit VBA you can use a regular Long instead of LongPtr and the interfaces would work...
I'm still not entirely clear on the key point:
If you're using the interface natively, that is included from the original header/idl and not oleexp, are the arguments modified such that the ones expecting pointers now expect an 8-byte variable? Because recall the way things work, it matters, because if you change one argument to more bytes and it's not expected, then it breaks all the other arguments because there's no true separation.
To me it seems that if it *was* going to take 8-bytes in one argument that was previously 4, by the same principle you'd always have to pass 8 bytes or the rest of the alignment would be off too.
Honestly I think the first step here would be to find an API or interface in oleexp that does not work when called from 64-bit VBA. If one could be identified it would be a lot easier to figure things out.
@fafalone I run midl from the "VS x86 Tools Command Prompt" shortcut that automatically runs vcvarsall.bat passing x86 as a parameter
(Sorry for my bad language i m from germany and i have no english in school)
Hallo i need a lot of help..... please
I create a Url process Action ..... in VB6 with webbrowser control.
In the debug mode it runs fine by these url www.web.de.....
in executefile it crashes by these url www.web.de....
(a lot of other urls working fine)
i dont no whats wrong in the page ------ www.web.de ------ by execute or wrong in my code
i thing i make a lot of misstakes in my code or??????
thanks for your help
Implements oleexp.IInternetSecurityManager
Implements oleexpimp.IServiceProvider
Private SID_SProfferService As UUID
Private IID_IProfferService As UUID
Private IID_IInternetSecurityManager As UUID
Private ps As IProfferService
Private cookie As Long
Private sp As IServiceProvider
Public Function AddInternetSecurityManager() As Boolean
CLSIDFromString SIDSTR_SProfferService, IID_IProfferService
CLSIDFromString SIDSTR_SProfferService, SID_SProfferService
CLSIDFromString IIDSTR_IInternetSecurityManager, IID_IInternetSecurityManager
Set sp = wb.object
sp.QueryService SID_SProfferService, IID_IProfferService, ps
Call ps.ProfferService(IID_IInternetSecurityManager, Me)
End Function
Private Sub InternetSecurityManager_ProcessUrlAction(ByVal pwszUrl As Long, ByVal dwAction As oleexp.URLACTIONS, ByVal pPolicy As Long, ByVal cbPolicy As Long, pContext As Byte, ByVal cbContext As Long, ByVal dwFlags As oleexp.PUAF, ByVal dwReserved As Long)
Dim sURL As String
Dim i As Long
Dim B As Boolean
sURL = lpwstrPtrToString(pwszUrl)
If dwAction = URLACTION_SCRIPT_MIN Then
For i = 1 To ADS_SRC_COL.Count
If InStrB(LCase(sURL), ADS_SRC_COL(i)) > 0 Then
MoveMemory ByVal pPolicy, URLPOLICY_DISALLOW, 4&
B = True
Exit For
End If
Next i
If B = False Then 'Call MoveMemory(ByVal pPolicy, URLPOLICY_ALLOW&, 4&)
If RunningInIDE = False Then
Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End If
End If
Else
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End If
End Sub
Private Sub IServiceProvider_QueryService(guidService As oleexp.UUID, riid As oleexp.UUID, ppvObject As Long)
Dim objUnknown As IUnknown
Dim lngResult As Long
Dim objISM As IInternetSecurityManager
If GetStringFromGUID(guidService) = UCase(IIDSTR_IInternetSecurityManager) Then
Set objUnknown = Me
objUnknown.AddRef
Set objISM = Me
MoveMemory ppvObject, objISM, 4&
Set objUnknown = Nothing
Set objISM = Nothing
Else
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.E_NOINTERFACE
End If
End Sub
Hallo from Germany,
I need help ....
in debug mode it runs by these side --- www.web.de --- perfect...
in execute it crashes i dont no why...
I test it with vbMHWB control crash project.exe (run in debug mode)
I test it with WB control olelib / olelib2 crash project.exe (run in debug mode)
and now with WB control oleexp / oleexpimp crash project.exe (run in debug mode)
please can any one help me to solve this problem?
Other sides run in debug mode and in execute mode perfect
I use vb6 SP6
here is the code... i do for testing
Regards Frank Tabacchi
Implements oleexp.InternetSecurityManager
Implements oleexpimp.IServiceProvider
Private SID_SProfferService As UUID
Private IID_IProfferService As UUID
Private IID_IInternetSecurityManager As UUID
Private ps As IProfferService
Private cookie As Long
Private sp As IServiceProvider
Private Sub Form_Load()
CLSIDFromString SIDSTR_SProfferService, IID_IProfferService
CLSIDFromString SIDSTR_SProfferService, SID_SProfferService
CLSIDFromString IIDSTR_IInternetSecurityManager, IID_IInternetSecurityManager
Set sp = wbBrowser.object
DoEvents
sp.QueryService SID_SProfferService, IID_IProfferService, ps
DoEvents
cookie = ps.ProfferService(IID_IInternetSecurityManager, Me)
wbBrowser.Silent = False
wbBrowser.Navigate "http://www.web.de"
End Sub
Private Sub Form_Unload(Cancel As Integer)
If cookie <> 0 Then
ps.RevokeService cookie
End If
End Sub
Public Function GetStringFromGUID(X As UUID) As String
Dim s As String
Dim L As Long
s = String(100, 0)
L = StringFromGUID2(X, s, Len(s))
GetStringFromGUID = UCase(Left(s, L - 1))
End Function
Private Function lpwstrPtrToString(ByVal lpwstrPtr As Long) As String
Dim lSize As Long
If lpwstrPtr <> 0 Then
lSize = lstrlenW(ByVal lpwstrPtr)
If lSize > 0 Then
ReDim b(0 To (lSize * 2) - 1) As Byte
MoveMemory b(0), ByVal lpwstrPtr, lSize * 2
lpwstrPtrToString = b
End If
End If
End Function
Private Function RunningInIDE() As Boolean
On Error Resume Next
Debug.Print 1 / 0
RunningInIDE = (Err <> 0)
End Function
Private Sub InternetSecurityManager_GetSecurityId(ByVal pwszUrl As Long, ByVal pbSecurityId As Long, pcbSecurityId As Long, ByVal dwReserved As Long)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Function InternetSecurityManager_GetSecuritySite() As oleexp.IInternetSecurityMgrSite
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Function
Private Sub InternetSecurityManager_GetZoneMappings(ByVal dwZone As Long, ppenumString As oleexp.IEnumString, ByVal dwFlags As Long)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub InternetSecurityManager_MapUrlToZone(ByVal pwszUrl As Long, pdwZone As Long, ByVal dwFlags As Long)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub InternetSecurityManager_ProcessUrlAction(ByVal pwszUrl As Long, ByVal dwAction As oleexp.URLACTIONS, ByVal pPolicy As Long, ByVal cbPolicy As Long, pContext As Byte, ByVal cbContext As Long, ByVal dwFlags As oleexp.PUAF, ByVal dwReserved As Long)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub InternetSecurityManager_QueryCustomPolicy(ByVal pwszUrl As Long, guidKey As oleexp.UUID, ppPolicy As Long, pcbPolicy As Long, pContext As Byte, ByVal cbContext As Long, Optional ByVal dwReserved As Long = 0&)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub InternetSecurityManager_SetSecuritySite(ByVal pSite As oleexp.IInternetSecurityMgrSite)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub InternetSecurityManager_SetZoneMapping(ByVal dwZone As Long, ByVal lpszPattern As Long, ByVal dwFlags As oleexp.SZM_FLAGS)
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End Sub
Private Sub IServiceProvider_QueryService(guidService As oleexp.UUID, riid As oleexp.UUID, ppvObject As Long)
Dim objUnknown As oleexp.IUnknown
Dim lngResult As Long
Dim objISM As InternetSecurityManager
If GetStringFromGUID(guidService) = UCase(IIDSTR_IInternetSecurityManager) Then
Set objUnknown = Me
objUnknown.AddRef
Set objISM = Me
MoveMemory ppvObject, objISM, 4&
Else
If RunningInIDE = False Then Err.Raise oleexp.HRESULTS.INET_E_DEFAULT_ACTION
End If
End Sub
I'm unable to replicate the problem; the compiled EXE does not crash on my system, Win7, although web.de does throw 100 javascript error messages at me in both IDE and EXE. What version of Windows are you on? Or do I need to do more than just run the code to trigger the crash? Or other references/module and in what order?
Can you identify the line or at least procedure where it crashes? It's hard to locate the problem since IDE vs EXE issues aren't clearly visible errors; they're generally caused by the difference in memory handling.
I can identify a couple considerations however... you're returning entirely different values for RunningInIDE=False. Err.Raise, in some but not all COM interfaces, gets reported back as the HRESULT, so you're essentially returning S_OK (0) in the IDE and INET_E_DEFAULT_ACTION (0x800C0011) in the EXE, in a lot of subs.
----
PS- Please enclose code in tags: [CODE]'code here[/CODE]
Hallo again,
thanks for answer here... i had a attachment where the crash starts
Unfortunately, I'm not as deep in the topic as you
So I can not find a solution without your help here
Thanks again fore your help....
reguards Frank
What do I need to do to trigger a crash? I ran the exe, and also compiled it again, and clicked the button, it did not crash either time:
http://i.imgur.com/23vo0vD.jpg?1
I tested in Windows 8.1 as well, it did not crash then either.
----
Is this what you mean:
http://i.imgur.com/eCHNeZp.jpg?1
???
I get that in the IDE too but it's an issue with the browser control, not with VB code.
Hallo again,
My system is Win7 home premium SP1 / (IE11) and VB6 SP6
it is crazy... in my system the execute file is crashed...
TEST: I open the project.exe file and then i click the test button Web.de and then Win7 show
a msgbox the project1 is not functional do you want to send the problem to mircosoft......
By click the button i dont get any script errors and i dont see the webside on my screen i get the system (win7) message immediately
and then good by project1.exe but in debug mode it runs i dont no wat is going on, have you any idee or a sample that working in Win7?
I get this crash in Win XP / Win Vista and in Win7 (IE 11) all systems are german.
Help I'm too stupid to understand that... by test with the vbMHWB control (from www.codeproject.com) it is the same problem!
And they are more professional than me but it is crash to and ohter side are working.....
Can it be, that the crash coming because the site checks if jawascrict is active and that causes the crash?
Is this a zone security problem with german Windows (IE 9 10 11)?
When I comment out the code lines then the Webbrowser control working fine with the side but when i implements the function
then it crashed in execute mode.
this was killing me i testing a long time to solve this problem but i am have not any idee and any solution fore this...
that makes me sick.
Thanks for all writing and helping hands
Frank
Can you describe your security settings? I changed my Internet Options control panel Internet zone to High with no change. Is JavaScript active for you? I could not locate the setting to change it (I don't use IE). I'm on Win7 as well and your code works for me, so I'm going to need to replicate the settings on your system that lead to the crash, but first, we can narrow down where the problem lies:
Please compile and run the ZIP I'm attaching. I have modified your project to log detailed debug information. After, please attach the resulting log file to your reply. I'm also attaching the output from when I run it in case you want to compare it yourself. One thing I've noticed; you know you're zeroing out security id and zone values that weren't zero right? Just wanted to make sure you intended to change them.
Any problems with using both this and the standard OLE Automation (stdole2.dll) reference that is set by default on any new project?
No, there's no conflict, except that it has a couple hidden members, so you need to specify oleexp.IUknown and oleexp.IDispatch if you're using those... IIRC it's only those two, but in any case definitely not any of the knownfolder stuff.
Hi fafalone. Please fix ITransferSource interface.
Thank for advance.
Oh wow that's a bad one. I'll have the update out by tonight. Sorry about that.
Update released with fix and completed new things.
Take note of a change to IContextMenu as it's very commonly used:
Quote:
-IContextMenu and IContextMenu2: .InvokeCommand has been changed to a Long, so that both CMINVOKECOMMANDINFO and CMINVOKECOMMANDINFOEX can be used. Use VarPtr(yourcommandinfovar) instead of just yourcommandinfovar.
------------------------
TheTrick - I'd be very interested to see ITransferSource in action in VB; if possible, share code of it being used if you use it?
Thanks for the new version!
I just wanted to mention that not all methods of KnownFolderManager can be called. I tried to retreive a list of registered known folders using GetFolderIds but the type definition for this method is not compatible with VB6, so it refused to compile.
So I changed the definition in exp_main.odl like this:
Now we are able to get the list using this demo snippet:Code:// HRESULT GetFolderIds(
// [out] KNOWNFOLDERID ** ppKFId,
// [in, out] UINT *pCount);
HRESULT GetFolderIds(
[out] UINT *ppKFId,
[in, out] UINT *pCount);
Code:Sub TestKnownFolders()
Dim oMngr As oleexp.KnownFolderManager
Dim IFld As oleexp.IKnownFolder
Dim uid() As oleexp.UUID
Dim lUIDs As Long
Dim sGUID As String, sPath As String
Dim ret As Long, n As Long, i As Long
Dim lPath As Long, cnt As Long
Set oMngr = New oleexp.KnownFolderManager
oMngr.GetFolderIds lUIDs, n
If n > 0 Then
ReDim uid(n - 1)
For i = 0 To n - 1
oleexp.MoveMemory uid(i), ByVal (lUIDs + (i * 16)), 16&
sGUID = String(255, 0)
ret = oleexp.StringFromGUID2(uid(i), sGUID, 255)
If ret > 0 Then
sGUID = Left(sGUID, ret)
Set IFld = Nothing
oMngr.GetFolder uid(i), IFld
If Not IFld Is Nothing Then
On Error Resume Next
IFld.GetPath KF_FLAG_DEFAULT_PATH, lPath
On Error GoTo 0
If lPath <> 0 Then
cnt = cnt + 1
sPath = SysAllocString(lPath)
CoTaskMemFree lPath
Debug.Print cnt, sGUID, sPath
End If
End If
End If
Next i
End If
End Sub
Thanks for pointing that out, the fix will be included in the next release.
Note too you can copy all the IDs at once, saving MoveMemory calls,
Code:Dim ct As Long
Dim tpkd As KnownFolderManager
Set tpkd = New KnownFolderManager
Dim kfptr As Long
Dim arfldr() As UUID
tpkd.GetFolderIds kfptr, ct
ReDim arfldr(ct - 1)
CopyMemory arfldr(0), ByVal kfptr, Len(arfldr(0)) * ct
Retrieving Portable Device Shell Icons
Hey fafalone, oleexp.tlb works just fine for enumerating Portable Devices, thanks a lot for that!
This line retrieves an array of pointers to Device IDs:
Walking the array I turn the pointers into strings, the so-called "PNP Device IDs":Code:ret = MyPortableDeviceManager.GetDevices(ByVal VarPtr(pPnpDeviceIDs(0)), cPnPDeviceIDs)
Such a "PNP Device ID" looks for example like this:Code:For i = 0 To cPnPDeviceIDs - 1
sPnpDeviceID(i) = PointerToStringW(pPnpDeviceIDs(i))
Next
I can retrieve the display name (e.g. "Moto G (4)" or "Nexus 10") like this:Code:\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
But how to retrieve the shell icon (the icon displayed in File Explorer)??? TheCode:ret = MyPortableDeviceManager.GetDeviceDescription(sPnpDeviceID(i), VarPtr(bBuffer(0)), lenBuffer)
Portable Device API does not seem to provide anything here, at least I don't see
it.
Now in Win8.1 and earlier there is a way to retrieve the icon and some other
shell info using SHGetFileInfoW with a pidl (it does not work with a string,
only with pidl):
The desired icon is here now:Code:Call SHGetFileInfoW(pidlItem, 0&, sfiW, Len(sfiW), _
SHGFI_PIDL Or SHGFI_SYSICONINDEX Or SHGFI_TYPENAME Or SHGFI_DISPLAYNAME)
I can retrieve the needed pidl using SHParseDisplayName on the "PNP Device ID"Code:sfiW.iIcon
(prefixed with the This PC GUID "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and
one backslash):
Now the problem is: Retrieving that pidl stopped working with Windows 10 versionCode:sPnpDeviceID(i) = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" & "\" & sPnpDeviceID(i)
ret = SHParseDisplayName(StrPtr(sPnpDeviceID(i)), ByVal 0&, pidlItem, ByVal 0&, ByVal 0&)
1703 (Creators Update) and later! I found no way to turn that "PNP Device ID"
into a pidl. BTW, I think that is a Windows bug and reported it to MS a year
ago, but never got any reply or fix.
So, how can I get my shell icon now in all Windows versions?
Thanks,
Don
Can you create an IShellItem? SHCreateItemFromParsingName. If it's visible with an icon in Explorer (and more importantly, check to see if my shell browser shows its icon), you should be able to get one. The first method my browser tries doesn't go through SHGetFileInfo (that's a fallback), it first tries getting the IShellIcon interface, and in the process gets pidls in a different way...
If Explorer shows the icon, that will almost certainly work. Worst case scenario, you could enumerate the Computer folder and match it.Code:Dim uPI As IParentAndItem
Dim psf As IShellFolder
Dim pIcon As IShellIcon
Dim pidlPar As Long, pidlRel As Long
Dim lpIcon As Long
Dim hr As Long
'[...]
Set uPI = siChild 'Your IShellItem
uPI.GetParentAndItem pidlPar, psf, pidlRel
On Error Resume Next
If (psf Is Nothing) = False Then
Set pUnk = psf
hr = pUnk.QueryInterface(IID_IShellIcon, pIcon)
' DebugAppend "QueryInterface=0x" & Hex$(hr)
If hr = S_OK Then
pIcon.GetIconOf pidlRel, GIL_FORSHELL, lpIcon
Else
Dim pidlcb As Long
pidlcb = ILCombine(pidlPar, pidlRel)
lpIcon = GetFileIconIndexPIDL(pidlcb, SHGFI_SMALLICON)
End If
If lpIcon = -1 Then lpIcon = 0
End If
If Explorer doesn't, you're left with manually doing it. The documentation indicates there might be a DevIcon.fil file in the device root, which is a standard icon file you can load. Or, use the device resource key WPD_RESOURCE_ICON. If both of those fail, query for the generic type (WPD_DEVICE_TYPE), and load the default icon for that type.
(If 'all Windows versions' means even XP or earlier, the interface methods won't work)
No, SHCreateItemFromParsingName fails with 0x80070057 (E_INVALIDARG).
It's the same error as SHParseDisplayName returns when trying to get the pidl.
So I think something about the PNP Device ID might be wrong.
The pidl is correctly returned for this path (it's the PNP Device ID of "Moto G (4)"):
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
But it fails with E_INVALIDARG for the 2 subfolders of "Moto G (4)":
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{C8DB0001,,63831015424}
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
In Win8.1 these paths are no problem.
I ran your ucShellBrowse41 project both in Win8.1 and in Win10, each time using my Moto G phone as device to be browsed. Below you see the debug output. To me it looks like your project met exactly the same problem that made me post here: "No IShellItem" So your shell browser cannot browse those folders in Win10 (but it can in Win8.1).
What's happening there? Windows bug? Can it be worked around?
Code:Win 8.1
~~~~~~~
Select device "Moto G (4)" in your Tree:
[20:49:53] CBD->SelChange
[20:49:53] DirNavigate item=9,sup=Falsch
[20:49:53] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},m_sCurPath=C:\Users\Donald\Desktop\Desk\ucShellBrowse41\Demo,sPrevPath=,GrpMode=0
[20:49:53] PathAttrib=SFGAO_CANLINK,SFGAO_CANRENAME,SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGEANCESTOR,
[20:49:53] ProcessColumns pathidx=9
[20:49:53] ub=37last=C:\Users\Donald\Desktop\Desk\ucShellBrowse41\Demo,cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:49:53] MyComp::Get ShellView
[20:49:53] MyComp::Get FolderView
[20:49:53] Got colmgt,ct=4
[20:49:53] NameLookup=System.ItemNameDisplay
[20:49:53] NameLookup=System.ItemTypeText
[20:49:53] NameLookup=System.Size
[20:49:53] NameLookup=System.FreeSpace
[20:49:53] SetColumns(9)=
[20:49:53] SetColumns->Finished reconcile
[20:49:53] SetColumns->Remove System.DateModified
[20:49:53] InsertListColumn System.FreeSpace
[20:49:53] excol defwidth=160
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:49:53] idxCB=9,lp=9
[20:49:53] pvCreateDetailPaneBkg.pidlPar=114425896,pidlrel=113577680
[20:49:53] pbh=56
[20:49:53] btm=56,cx=58,icn=58,sys=32
[20:49:53] Draw from JM
[20:49:53] Loaded 0 files and 2 folders
[20:49:53] MonitorPidl=116732936 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
Select subfolder of device:
[20:50:38] Set IC flag = TRUE, item=0
[20:50:38] LVSetSelection full path=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:50:38] pvCreateItemDetailPane()
[20:50:38] ucWndProc->Error: Typen unverträglich, 0xD
[20:50:38] LVItemClick 0
[20:50:38] InfoTip Cnt=2
[20:50:38] PropsList=prop:System.FreeSpace;System.Capacity
[20:50:38] Prop=Freier Speicherplatz: 46,6 GB
[20:50:38] Prop=Gesamtgröße: 54,5 GB
Dbl-click subfolder of device:
[20:52:37] Got dblclk/ret
[20:52:37] LVSetSelection full path=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] LVDoubleClick idx=0,lp=1,file=Interner gemeinsamer Speicher
[20:52:37] LVDoubleClick.OpenFolder
[20:52:37] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},m_sCurPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},sPrevPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},GrpMode=0
[20:52:37] PathAttrib=SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGE,SFGAO_STORAGEANCESTOR,
[20:52:37] ProcessColumns pathidx=38
[20:52:37] ub=38last=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] MyComp::Get ShellView
[20:52:37] MyComp::Get FolderView
[20:52:37] Got colmgt,ct=8
[20:52:37] NameLookup=System.ItemNameDisplay
[20:52:37] NameLookup=System.ItemTypeText
[20:52:37] NameLookup=System.Size
[20:52:37] NameLookup=System.Music.TrackNumber
[20:52:37] NameLookup=System.Music.Artist
[20:52:37] NameLookup=System.Music.AlbumTitle
[20:52:37] NameLookup=System.Media.Year
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 6}
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 13}
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 14}
[20:52:37] NameLookup=
[20:52:37] SetColumns(38)=
[20:52:37] SetColumns->Finished reconcile
[20:52:37] SetColumns->Remove System.FreeSpace
[20:52:37] InsertListColumn System.Media.Year
[20:52:37] excol defwidth=80
[20:52:37] InsertListColumn System.Music.AlbumTitle
[20:52:37] excol defwidth=136
[20:52:37] InsertListColumn System.Music.Artist
[20:52:37] excol defwidth=120
[20:52:37] InsertListColumn System.Music.TrackNumber
[20:52:37] excol defwidth=40
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] idxCB=10,lp=38
[20:52:37] pvCreateDetailPaneBkg.Error->Typen unverträglich, 0xD
[20:52:37] Loaded 0 files and 15 folders
[20:52:37] MonitorPidl=123149952 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:41] terminate event
========================================================================
Win 10
~~~~~~
Select device "Moto G (4)" in your Tree:
[20:57:45] CBD->SelChange
[20:57:45] DirNavigate item=9,sup=Falsch
[20:57:45] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},m_sCurPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},sPrevPath=C:\Users\Public\ucShellBrowse41\Demo,GrpMode=0
[20:57:46] PathAttrib=SFGAO_CANLINK,SFGAO_CANRENAME,SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGEANCESTOR,
[20:57:46] ProcessColumns pathidx=9
[20:57:46] ub=21last=C:\Users\Public\ucShellBrowse41\Demo,cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:57:46] MyComp::Get ShellView
[20:57:46] MyComp::Get FolderView
[20:57:46] Got colmgt,ct=4
[20:57:46] NameLookup=System.ItemNameDisplay
[20:57:46] NameLookup=System.ItemTypeText
[20:57:46] NameLookup=System.Size
[20:57:46] NameLookup=System.FreeSpace
[20:57:46] SetColumns(9)=
[20:57:46] SetColumns->Finished reconcile
[20:57:46] ucShellBrowse.SetColumns->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:57:46] idxCB=9,lp=9
[20:57:46] pvCreateDetailPaneBkg.pidlPar=122406272,pidlrel=121952800
[20:57:46] pbh=56
[20:57:46] btm=56,cx=58,icn=58,sys=32
[20:57:46] Draw from JM
[20:57:46] Loaded 0 files and 2 folders
[20:57:46] MonitorPidl=139257568 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
Select subfolder of device:
[20:55:37] Set IC flag = TRUE, item=0
[20:55:37] LVSetSelection->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
[20:55:37] pvCreateItemDetailPane()
[20:55:37] LVItemClick 0
[20:55:38] No IShellItem
Dbl-click subfolder of device:
[20:56:36] Got dblclk/ret
[20:56:36] LVSetSelection->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
[20:56:36] LVDoubleClick idx=0,lp=1,file=Interner gemeinsamer Speicher
[20:56:36] LVDoubleClick->Failed to get IShellItem from parsing name
[20:56:36] No IShellItem
I thought the issue was the device icon? Does the device icon show? It should, since that output looks like the device is present in the Computer folder and the dropdown. It looks like the problem is just with subfolders; do their icons show when you navigate to the device root?
Wondering because if the root works ok, can we work around by using resolving with an IShellFolder always for the root and an relative pidl from there.
If it's working in Win8.1, it definitely sounds like a bug in the APIs though. Just one other thought... what about passing the display names 'Internet...' instead of 'SID-...' after the root?
I'll check it out myself in a bit, it's a cell phone or tablet right? Connected mine (also Android) as both file transfer and camera and could go as deep as I wanted without issue on Win7 too; I'll have to check on my roomies Win10 laptop later.
I need the pidl for the icon and also for other things, my post was indead misleading here, sorry.
Yes, in your browser the device icon shows, and also the icons in the next sub level. But then it does not go down any deeper.
> Just one other thought... what about passing the display names 'Internet...' instead of 'SID-...' after the root?
I don't know what inspired you to this but it's exactly what I found out yesterday night by a mixture of internet and conincidence. It looks promising! I'll report back later...
BTW, although I subscribed to the topic I never get email notifications from this forum. Is this normal?
Problem solved!
Display path:
This device path works in Win10 (but not in Win8.1):Code:Moto G (4)\SD-Karte von SanDisk\Test\IMG_0001.JPG
This device path works in Win8.1 (but not in Win10):Code:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SD-Karte von SanDisk\Test\IMG_0001.JPG
So the workaround of this apparent Windows 10 bug is a simple string replacement.Code:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{C8DB0001,,63831015424}\{00000CAE-0001-C8DB-0000-000000000000}\{00000CB1-0001-C8DB-0000-000000000000}
Thanks for your help and your invaluable typelib!
Don
Glad it worked out. I'll have to exceptions to handle this all over now too :mad:
Had the idea because of a vaguely similar issue with recycle bin files a while back; can't recall the specifics.
PS- For notifications, is the master option to receive e-mails enabled?
Excuse me, why can't you reference it in VB.NET? Is it my way?
@fafalone:
MSDN for IPortableDeviceManager::GetDevices says on pPnPDeviceIDs: "To learn the required size for this parameter, first call this method with this parameter set to NULL and pcPnPDeviceIDs set to zero".
I think I have to pass 0& ByVal, right?
Or should it be like this:Code:ret = MyPortableDeviceManager.GetDevices(ByVal 0&, cPnPDeviceIDs)
Thanks,Code:ret = MyPortableDeviceManager.GetDevices(0&, cPnPDeviceIDs)
Don
@voxy That parameter is ByVal so it wouldn't matter either way.
@ChenLin, you can't reference the TLB in .NET? Is it this specific typelib or all the typelibs specifically designed for VB6? I don't have time to try running code right now but I did add the TLB as a reference without error in a VB.NET project in VS2015... I'll try to run some code with it tonight.Code:interface IPortableDeviceManager : stdole.IUnknown {
long GetDevices(
[in] long pPnPDeviceIDs,
[in] long *pcPnPDeviceIDs);
OK, just saw that apparently function parameters in typelibs never show "ByVal" even if they are ByVal. So one cannot know what they are, ByVal or ByRef, without looking into the source code of the typelib?
“The system can't find a specified reference“
Can be added to a reference but not working properly.
Both VB 2005 and 2017 show this error. Is it my WINDOWS system problem?
@voxy, that's unfortunately true. Sometimes there's clues in the naming conventions; and as a general rule, almost always the convention oleexp uses is to replace ByRef's for strings with ByVal and string pointers, for Unicode purposes, which is why the naming convention is broken here (it's byref in the original source as is the convention for vars prefixed with 'p').
@ChenLin, so not when you add the TLB but when you try to run the code? Are you calling an interface not available on the current version of Windows?
@fafalone,Change the computer test to confirm that there is no problem, it is the computer windows system problem.
It's wrong. The 3.7 edition was just tested, and 4.443 is still not acceptable.
Of the typelib?
Can you be more specific about what exactly the error message is and when it appears?
The only difference between 3.7 and 4.43 are added interfaces/types; there haven't been any changes to the TLB structure itself since long before that.
Attachment 160255
Please look at the picture。
Debug error prompt:
Severity Code Description Project File Line Suppression State
Error Could not resolve COM reference "f9015e81-caac-45c0-94e8-42b7da5d7557" version 4.43. The type library importer encountered an error during type verification. Try importing without class members.
It looks like the file is in a different location than its registered to. Perhaps try unregistering then reregistering? This problem could arise if earlier 4.x versions in a different location were ever used.
Hi, fafalone!
Do you know why IDE time-by-time can point me this error by pressing Ctrl+F5:
Code:Static iid As UUID
in mIID.basQuote:
"Compile error:
Fixed or static data can't be larger than 64K"
(after close / re-open whole project the problem disappears)
fafalone, can I ask you please about adding the following missed FOLDER IDs to your mIID.bas? :
https://docs.microsoft.com/en-us/win.../knownfolderidQuote:
FOLDERID_AccountPictures
GUID {008ca0b1-55b4-4c56-b8a8-4de4b299d3be}
FOLDERID_AppDataDesktop
GUID {B2C5E279-7ADD-439F-B28C-C41FE1BBF672}
FOLDERID_ApplicationShortcuts
GUID {A3918781-E5F2-4890-B3D9-A7E54332328C}
FOLDERID_AppsFolder
GUID {1e87508d-89c2-42f0-8a7e-645a0f50ca58}
(virtual)
FOLDERID_CameraRoll
GUID {AB5FB87B-7CE2-4F83-915D-550846C9537B}
FOLDERID_DeviceMetadataStore
GUID {5CE4A5E9-E4EB-479D-B89F-130C02886155}
FOLDERID_DocumentsLibrary
GUID {7B0DB17D-9CD2-4A93-9733-46CC89022E7C}
FOLDERID_HomeGroupCurrentUser
GUID {9B74B6A3-0DFD-4f11-9E78-5F7800F2E772}
(virtual)
FOLDERID_ImplicitAppShortcuts
GUID {BCB5256F-79F6-4CEE-B725-DC34E402FD46}
FOLDERID_Libraries
GUID {1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}
FOLDERID_MusicLibrary
GUID {2112AB0A-C86A-4FFE-A368-0DE96E47012E}
FOLDERID_Objects3D
GUID {31C0DD25-9439-4F12-BF41-7FF4EDA38722}
FOLDERID_PicturesLibrary
GUID {A990AE9F-A03B-4E80-94BC-9912D7504104}
FOLDERID_PublicLibraries
GUID {48DAF80B-E6CF-4F4E-B800-0E69D84EE384}
FOLDERID_PublicRingtones
GUID {E555AB60-153B-4D17-9F04-A5FE99FC15EC}
FOLDERID_PublicUserTiles
GUID {0482af6c-08f1-4c34-8c90-e17ec98b1e17}
FOLDERID_RecordedTVLibrary
GUID {1A6FDBA2-F42D-4358-A798-B74D745926C5}
FOLDERID_Ringtones
GUID {C870044B-F49E-4126-A9C3-B52A1FF411E8}
FOLDERID_RoamedTileImages
GUID {AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}
FOLDERID_RoamingTiles
GUID {00BCFC5A-ED94-4e48-96A1-3F6217F21990}
FOLDERID_SavedPictures
GUID {3B193882-D3AD-4eab-965A-69829D1FB59F}
FOLDERID_SavedPicturesLibrary
GUID {E25B5812-BE88-4bd9-94B0-29233477B6C3}
FOLDERID_Screenshots
GUID {b7bede81-df94-4682-a7d8-57a52620b86f}
FOLDERID_SearchHistory
GUID {0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}
FOLDERID_SearchTemplates
GUID {7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}
FOLDERID_SkyDrive
GUID {A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}
FOLDERID_SkyDriveCameraRoll
GUID {767E6811-49CB-4273-87C2-20F355E1085B}
FOLDERID_SkyDriveDocuments
GUID {24D89E24-2F19-4534-9DDE-6A6671FBB8FE}
FOLDERID_SkyDrivePictures
GUID {339719B5-8C47-4894-94C2-D8F77ADD44A6}
FOLDERID_UserPinned
GUID {9E3995AB-1F9C-4F13-B827-48B24B6C7174}
FOLDERID_UserProgramFiles
GUID {5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}
FOLDERID_UserProgramFilesCommon
GUID {BCBD3057-CA5C-4622-B42D-BC56DB0AE516}
FOLDERID_UsersLibraries
GUID {A302545D-DEFF-464b-ABE8-61C8648D939B}
FOLDERID_VideosLibrary
GUID {491E922F-5643-4AF4-A7EB-4E7A138D8174}
There was also some IDs from Win10 version 1709, but I didn't list them because I think they are useless since they marked as:
Quote:
Originally Posted by MSDN
I'm not sure about that error with static data; haven't encountered it before myself. My first thought would be a potential problem with referencing too many at once... is it happening in a project where you're using a whole lot of them? It would have to really be a lot some of my bigger projects use a few dozen of them.
FOLDERIDs Added; will be in next release. Give me a couple days, going to add the interface set you mentioned, a couple shell extention service interfaces I missed, and was going to look at possibly adding the ITbS.. remote desktop services and virtual disk services.
If you want to copy/paste for now I already ran them through my IID function builder:
Code:Public Function FOLDERID_AccountPictures() As UUID
'{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H008ca0b1, CInt(&H55b4), CInt(&H4c56), &Hb8, &Ha8, &H4d, &He4, &Hb2, &H99, &Hd3, &Hbe)
FOLDERID_AccountPictures = iid
End Function
Public Function FOLDERID_AppDataDesktop() As UUID
'{B2C5E279-7ADD-439F-B28C-C41FE1BBF672}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HB2C5E279, CInt(&H7ADD), CInt(&H439F), &HB2, &H8C, &HC4, &H1F, &HE1, &HBB, &HF6, &H72)
FOLDERID_AppDataDesktop = iid
End Function
Public Function FOLDERID_ApplicationShortcuts() As UUID
'{A3918781-E5F2-4890-B3D9-A7E54332328C}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA3918781, CInt(&HE5F2), CInt(&H4890), &HB3, &HD9, &HA7, &HE5, &H43, &H32, &H32, &H8C)
FOLDERID_ApplicationShortcuts = iid
End Function
Public Function FOLDERID_AppsFolder() As UUID
'{1e87508d-89c2-42f0-8a7e-645a0f50ca58}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1e87508d, CInt(&H89c2), CInt(&H42f0), &H8a, &H7e, &H64, &H5a, &H0f, &H50, &Hca, &H58)
FOLDERID_AppsFolder = iid
End Function
Public Function FOLDERID_CameraRoll() As UUID
'{AB5FB87B-7CE2-4F83-915D-550846C9537B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HAB5FB87B, CInt(&H7CE2), CInt(&H4F83), &H91, &H5D, &H55, &H08, &H46, &HC9, &H53, &H7B)
FOLDERID_CameraRoll = iid
End Function
Public Function FOLDERID_DeviceMetadataStore() As UUID
'{5CE4A5E9-E4EB-479D-B89F-130C02886155}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H5CE4A5E9, CInt(&HE4EB), CInt(&H479D), &HB8, &H9F, &H13, &H0C, &H02, &H88, &H61, &H55)
FOLDERID_DeviceMetadataStore = iid
End Function
Public Function FOLDERID_DocumentsLibrary() As UUID
'{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H7B0DB17D, CInt(&H9CD2), CInt(&H4A93), &H97, &H33, &H46, &HCC, &H89, &H02, &H2E, &H7C)
FOLDERID_DocumentsLibrary = iid
End Function
Public Function FOLDERID_HomeGroupCurrentUser() As UUID
'{9B74B6A3-0DFD-4f11-9E78-5F7800F2E772}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H9B74B6A3, CInt(&H0DFD), CInt(&H4f11), &H9E, &H78, &H5F, &H78, &H00, &HF2, &HE7, &H72)
FOLDERID_HomeGroupCurrentUser = iid
End Function
Public Function FOLDERID_ImplicitAppShortcuts() As UUID
'{BCB5256F-79F6-4CEE-B725-DC34E402FD46}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HBCB5256F, CInt(&H79F6), CInt(&H4CEE), &HB7, &H25, &HDC, &H34, &HE4, &H02, &HFD, &H46)
FOLDERID_ImplicitAppShortcuts = iid
End Function
Public Function FOLDERID_Libraries() As UUID
'{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1B3EA5DC, CInt(&HB587), CInt(&H4786), &HB4, &HEF, &HBD, &H1D, &HC3, &H32, &HAE, &HAE)
FOLDERID_Libraries = iid
End Function
Public Function FOLDERID_MusicLibrary() As UUID
'{2112AB0A-C86A-4FFE-A368-0DE96E47012E}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H2112AB0A, CInt(&HC86A), CInt(&H4FFE), &HA3, &H68, &H0D, &HE9, &H6E, &H47, &H01, &H2E)
FOLDERID_MusicLibrary = iid
End Function
Public Function FOLDERID_Objects3D() As UUID
'{31C0DD25-9439-4F12-BF41-7FF4EDA38722}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H31C0DD25, CInt(&H9439), CInt(&H4F12), &HBF, &H41, &H7F, &HF4, &HED, &HA3, &H87, &H22)
FOLDERID_Objects3D = iid
End Function
Public Function FOLDERID_PicturesLibrary() As UUID
'{A990AE9F-A03B-4E80-94BC-9912D7504104}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA990AE9F, CInt(&HA03B), CInt(&H4E80), &H94, &HBC, &H99, &H12, &HD7, &H50, &H41, &H04)
FOLDERID_PicturesLibrary = iid
End Function
Public Function FOLDERID_PublicLibraries() As UUID
'{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H48DAF80B, CInt(&HE6CF), CInt(&H4F4E), &HB8, &H00, &H0E, &H69, &HD8, &H4E, &HE3, &H84)
FOLDERID_PublicLibraries = iid
End Function
Public Function FOLDERID_PublicRingtones() As UUID
'{E555AB60-153B-4D17-9F04-A5FE99FC15EC}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HE555AB60, CInt(&H153B), CInt(&H4D17), &H9F, &H04, &HA5, &HFE, &H99, &HFC, &H15, &HEC)
FOLDERID_PublicRingtones = iid
End Function
Public Function FOLDERID_PublicUserTiles() As UUID
'{0482af6c-08f1-4c34-8c90-e17ec98b1e17}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H0482af6c, CInt(&H08f1), CInt(&H4c34), &H8c, &H90, &He1, &H7e, &Hc9, &H8b, &H1e, &H17)
FOLDERID_PublicUserTiles = iid
End Function
Public Function FOLDERID_RecordedTVLibrary() As UUID
'{1A6FDBA2-F42D-4358-A798-B74D745926C5}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1A6FDBA2, CInt(&HF42D), CInt(&H4358), &HA7, &H98, &HB7, &H4D, &H74, &H59, &H26, &HC5)
FOLDERID_RecordedTVLibrary = iid
End Function
Public Function FOLDERID_Ringtones() As UUID
'{C870044B-F49E-4126-A9C3-B52A1FF411E8}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HC870044B, CInt(&HF49E), CInt(&H4126), &HA9, &HC3, &HB5, &H2A, &H1F, &HF4, &H11, &HE8)
FOLDERID_Ringtones = iid
End Function
Public Function FOLDERID_RoamedTileImages() As UUID
'{AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HAAA8D5A5, CInt(&HF1D6), CInt(&H4259), &HBA, &HA8, &H78, &HE7, &HEF, &H60, &H83, &H5E)
FOLDERID_RoamedTileImages = iid
End Function
Public Function FOLDERID_RoamingTiles() As UUID
'{00BCFC5A-ED94-4e48-96A1-3F6217F21990}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H00BCFC5A, CInt(&HED94), CInt(&H4e48), &H96, &HA1, &H3F, &H62, &H17, &HF2, &H19, &H90)
FOLDERID_RoamingTiles = iid
End Function
Public Function FOLDERID_SavedPictures() As UUID
'{3B193882-D3AD-4eab-965A-69829D1FB59F}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H3B193882, CInt(&HD3AD), CInt(&H4eab), &H96, &H5A, &H69, &H82, &H9D, &H1F, &HB5, &H9F)
FOLDERID_SavedPictures = iid
End Function
Public Function FOLDERID_SavedPicturesLibrary() As UUID
'{E25B5812-BE88-4bd9-94B0-29233477B6C3}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HE25B5812, CInt(&HBE88), CInt(&H4bd9), &H94, &HB0, &H29, &H23, &H34, &H77, &HB6, &HC3)
FOLDERID_SavedPicturesLibrary = iid
End Function
Public Function FOLDERID_Screenshots() As UUID
'{b7bede81-df94-4682-a7d8-57a52620b86f}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &Hb7bede81, CInt(&Hdf94), CInt(&H4682), &Ha7, &Hd8, &H57, &Ha5, &H26, &H20, &Hb8, &H6f)
FOLDERID_Screenshots = iid
End Function
Public Function FOLDERID_SearchHistory() As UUID
'{0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H0D4C3DB6, CInt(&H03A3), CInt(&H462F), &HA0, &HE6, &H08, &H92, &H4C, &H41, &HB5, &HD4)
FOLDERID_SearchHistory = iid
End Function
Public Function FOLDERID_SearchTemplates() As UUID
'{7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H7E636BFE, CInt(&HDFA9), CInt(&H4D5E), &HB4, &H56, &HD7, &HB3, &H98, &H51, &HD8, &HA9)
FOLDERID_SearchTemplates = iid
End Function
Public Function FOLDERID_SkyDrive() As UUID
'{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA52BBA46, CInt(&HE9E1), CInt(&H435f), &HB3, &HD9, &H28, &HDA, &HA6, &H48, &HC0, &HF6)
FOLDERID_SkyDrive = iid
End Function
Public Function FOLDERID_SkyDriveCameraRoll() As UUID
'{767E6811-49CB-4273-87C2-20F355E1085B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H767E6811, CInt(&H49CB), CInt(&H4273), &H87, &HC2, &H20, &HF3, &H55, &HE1, &H08, &H5B)
FOLDERID_SkyDriveCameraRoll = iid
End Function
Public Function FOLDERID_SkyDriveDocuments() As UUID
'{24D89E24-2F19-4534-9DDE-6A6671FBB8FE}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H24D89E24, CInt(&H2F19), CInt(&H4534), &H9D, &HDE, &H6A, &H66, &H71, &HFB, &HB8, &HFE)
FOLDERID_SkyDriveDocuments = iid
End Function
Public Function FOLDERID_SkyDrivePictures() As UUID
'{339719B5-8C47-4894-94C2-D8F77ADD44A6}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H339719B5, CInt(&H8C47), CInt(&H4894), &H94, &HC2, &HD8, &HF7, &H7A, &HDD, &H44, &HA6)
FOLDERID_SkyDrivePictures = iid
End Function
Public Function FOLDERID_UserPinned() As UUID
'{9E3995AB-1F9C-4F13-B827-48B24B6C7174}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H9E3995AB, CInt(&H1F9C), CInt(&H4F13), &HB8, &H27, &H48, &HB2, &H4B, &H6C, &H71, &H74)
FOLDERID_UserPinned = iid
End Function
Public Function FOLDERID_UserProgramFiles() As UUID
'{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H5CD7AEE2, CInt(&H2219), CInt(&H4A67), &HB8, &H5D, &H6C, &H9C, &HE1, &H56, &H60, &HCB)
FOLDERID_UserProgramFiles = iid
End Function
Public Function FOLDERID_UserProgramFilesCommon() As UUID
'{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HBCBD3057, CInt(&HCA5C), CInt(&H4622), &HB4, &H2D, &HBC, &H56, &HDB, &H0A, &HE5, &H16)
FOLDERID_UserProgramFilesCommon = iid
End Function
Public Function FOLDERID_UsersLibraries() As UUID
'{A302545D-DEFF-464b-ABE8-61C8648D939B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA302545D, CInt(&HDEFF), CInt(&H464b), &HAB, &HE8, &H61, &HC8, &H64, &H8D, &H93, &H9B)
FOLDERID_UsersLibraries = iid
End Function
Public Function FOLDERID_VideosLibrary() As UUID
'{491E922F-5643-4AF4-A7EB-4E7A138D8174 }
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H491E922F, CInt(&H5643), CInt(&H4AF4), &HA7, &HEB, &H4E, &H7A, &H13, &H8D, &H81, &H74)
FOLDERID_VideosLibrary = iid
End Function
Hi, fafalone!
Nice! Thank you for that. BTW. I checked all of your another FOLDERID_* IDs. All of them are correct.
Right after adding to my project I used maybe only 1-2 of them. That compilation error began to happen randomly and not very often, but only after I already ran project at least once.Quote:
I'm not sure about that error with static data; haven't encountered it before myself. My first thought would be a potential problem with referencing too many at once... is it happening in a project where you're using a whole lot of them? It would have to really be a lot some of my bigger projects use a few dozen of them.
I also using many Static in my proj. However, I don't think they could be greater than even 1 KB in sum.
New release is up (v4.5). There's a whole other set of new FOLDERID_ values not in the list posted above, so I've got both those and the new ones in mIID now. TaskScheduler interfaces added; there were actually a few VB6 incompatibilities that had to be changed; a couple arguments were 'unsigned long' and another had a double-pointer to an array (the same bug pointed out for IKnownFolderManager.GetFolderIds... I went through the entire project and found a bunch of these that needed changing, so extra thanks for finding that Dragokas).
PS- Per issue raised in PM, the base ITaskService interface is there, you just don't see it in Object Browser because it's the default interface for the TaskScheduler coclass.
fafalone, thank you! I didn't see it yet but i wanted to ask does it include both TaskScheduler 1.0 and TaskScheduler 2.0 interfaces?
Yes to both; 1.0 was part of the original olelib. 2.0/3 are the new additions for this version.
Hi,
I wanted to know has VB6 appropriate compatible type for replacing HRESULT.
Since, you didn't replace it e.g. in KnownFolderManager -> GetFolderIds, so maybe due the some reason?
I used that code and my version of tlb* and after several attempts I got IDE crash on program unload, so I added red warning.
I didn't try your new tlb yet, however plan to make more tests.
*sorry can't add hyperlink ("Something went wrong), it's a link to your "Code snippet: KnownFolders made easy with IKnownFolderManager" topic, my post #14.
You can replace any HRESULT with a long (byval, just long, not long*); I generally just leave it except where you really can't get by without knowing that return value, because while it's not applicable to IKnownFolderManager, switching it means you cannot use the interface with Implements, which is why oleexpimp and olelib2 before it exist. The vast majority of the time you can just check the expected output, like with GetFolderIds it failed if either the count or pointer are zero. But that's in general, here I had really forgotten that you wanted it changed to examine the specific return.. though it's not failing right? The return will be S_OK (0) unless it fails.
If there's a memory leak, it's not because HRESULT was changed to long. The most likely suspect is the array; MSDN says you need to 'free these resources' plural, so maybe just freeing the pointer isn't enough? Though first I'd check if there's still an issue when compiled.
Thank you for detail explanation.
Not understant. It's already implemented. What you mean?Quote:
because while it's not applicable to IKnownFolderManager, switching it means you cannot use the interface with Implements
Yes, it's not important, bacause all of that methods can be checked by return values, as you already mentioned. So, in fact I have 2-level check.Quote:
here I had really forgotten that you wanted it changed to examine the specific return.
I will be grateful.Quote:
MSDN says you need to 'free these resources' plural, so maybe just freeing the pointer isn't enough?
I used your FreeKnownFolderDefinitionFields() to free each element of array and CoTaskMemFree on ptr to that array. So, I dunno, what else can be wrong. My project just silently crash on pressing "X". I lost that my version, but I'll try to reproduce.
Ok, I was able to reproduce.
Look like, it's 2 my mistakes.
I set FreeKnownFolderDefinitionFields under "if" scope that check only first member.
However, FreeKnownFolderDefinitionFields is not need at all, because CoTaskMemFree + ptr to array free whole resourse.
Crash happened because I tried to free it twice.