Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
I was planning on adding it at one point, can't recall at the moment why I stopped the effort since it looks like was a year ago but it's just the prelimary copy of the SDK, it won't compile in MKTYPLIB and modification to avoid VB6 incompatible arguments isn't complete (looks like I stopped half way on line 886). Left the source in for possible inclusion in the future or if someone else was interested.
Last edited by fafalone; Aug 31st, 2018 at 08:36 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Non-final report: I removed some includes, gave it a new GUID, compiled it, copied it over to SysWOW64, had to re-reference it in VB IDE (probably because of the new GUID), and everything worked just fine. So I did not exclude anything I needed, good. oleexp.tlb is now 989.352 bytes, so roughly 200 KB smaller. Don't know about the inner counts. So far I had no "Out of memory" error, but it's too early to say. Give me some days...
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Update: I now think reducing the size of the typelib did not have such a large effect. The error is coming back even with the smaller typelib.
I currently assume it might have to do with the Undo/Redo cache of the VB6 IDE. When I get the error I can simply close and reopen the IDE and work on for some hours.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Thanks, but my error is not "Fixed or static data can't be larger than 64K". It's not a compile error at all. It pops while typing or pasting into the IDE, usually when I declare a new variable.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Hi fafalone.
Can you fix the STGOPTIONS structure definition? Also make StgCreateStorageEx to has the optional parameter.
It should contain the two short fields instead long, and the long one instead ULONG.
Thank you in advance!
Last edited by The trick; Feb 13th, 2019 at 12:47 PM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Sure thing. Will finish a couple other things and update this weekend.
Edit: Sorry I haven't updated yet. Forgot what a massive mess of other partially finished things were in the current dev version, was gone for a week, then got wrapped up in something else. Will definitely get it done over the next few days.
Last edited by fafalone; Mar 1st, 2019 at 02:33 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
It's not defined as PROPVARIANT, it's defined as Variant, which should be used in place of PROPVARIANT, which never works right. Use VB's Variant type then PropVariantToVariant (to another VB Variant); you can use the propvariant API's to change types if needed.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Well in this particular case, that's how it was defined in the original olelib that this project expanded.
But more generally, VB doesn't support user-defined structures with unions, so you can't define a real PROPVARIANT period, and always having it as a long pointer to a variable has always failed wherever I've tried it. I've even tried specifically defined propvar structs for certain data types, and things still failed every time. After many hours, using a Variant instead is the only way I've ever been able to use functions that require PROPVARIANT, and they've always worked just about perfectly-- because Variant and PROPVARIANT have very similar internal structures.
Last edited by fafalone; Jun 21st, 2019 at 01:19 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by The trick
Hi fafalone.
Can you fix the STGOPTIONS structure definition? Also make StgCreateStorageEx to has the optional parameter.
It should contain the two short fields instead long, and the long one instead ULONG.
Thank you in advance!
Trick in StgCreateStorageEx how do I declare it to be optional? It's saying 'invalid attribute for this item' no matter how I declare it, despite optional parameters working in interface definitions.
The way the control works is just to enumerate the items and use the system Property Store.
... .. .
Now if you needed the additional information on the individual multi-style fonts (where you'd double click one in the control and then an entry would show up for each), the quickest shortcut would be to check the Folder attribute (siFont.GetAttributes SFGAO_FOLDER, dwAttribs: If (dwAttribs And SFGAO_FOLDER) = SFGAO_FOLDER Then), and then just take siFont and enumerate that in the same way that was done for the font folder... siFont.BindToHandler 0&, BHID_EnumItems, IID_IEnumShellItems, pEnum2
Do While pEnum2.Next(1&, siSubFont, pcl) = S_OK
etc. ... .. .
Thanks a ton to your invaluable "extended" guidance (with sample code lines), I was easily able to obtain the multiple styles for fonts which possess the same. Two points of interest in this regard:
For whatever reason, in the primary 'Fonts' folder screen, Windows (I have Windows 10) does not show the individual file names for fonts with multiple styles. This has been raised as an issue too here (in a Microsoft Windows forum). But, thanks to you, now in my program, additionally, I can show the file names for multiple styles too, in a grid which I have created (to show fonts info, in the same way as shown in the 'Fonts' folder). Note: Even for fonts without multiple styles, for whatever reason, Windows shows all the file names in uppercase, totally. I am showing the same in my grid now, in the exact case in which the path&file names are existing in the system.
As far as I can see, Windows is showing the 'Size' info cumulatively for fonts with multiple styles. For instance, for Arial, it shows it as 4,240 KB (cumulatively, considering all the nine Arial .ttf fonts). But now, in my program, since I am showing the file name for each of the individual styles, I am able to show the file size too for each of the individual font styles.
I was able to give the above-mentioned additional info in my grid only because you took the time to give extended guidance on how to recurse through fonts which have multiple font styles. I remain ever in thankfulness to you. Thank you so... much.
Note: I have been trying to post this message since 24-May-2020 itself (in the originating thread mentioned at the top of this message) but every time I am meeting with errors only - of more than one kind. I am just unable to post. I tried posting through 3 different browsers. So, I am posting this message in this thread itself now, instead of in the thread specified at the very top of this message. Anyway, as such, this is the right thread for me to post this message since I have availed your library only so far and not your ucShellBrowse control. So, hopefully, no issues.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Glad everything is working out, you're welcome
The control/code here is just pulling data through the same methods that Explorer is; I checked the Fonts folder there and combined sizes and upper case names is how everything is shown in Explorer too, so not too much to be done there besides manually changing it yourself like you're doing.
As always, I'm happy to help and don't hesitate to post if any issues come up
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
hi!
nice work. I am a bit confused, does oleexp.tlb include the interfaces etc. that exist in oleexmpimp.tlb/mimelib.tlb.
also does it include the windows api declarations, structures and constants.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
oleexpimp.tlb contains slightly different versions of a small number of interfaces. For example, in oleexp.tlb, IEnumIDList.Next is a function that returns a Long, because knowing the return value is important for that call. But VB does not allow you to implement a class that contains functions, only subs, so if you wanted to implement that interface yourself in a class (Implements IEnumIDList), you'd use the version in oleexpimp.tlb instead, because that version is written without any return values. You don't need to include a reference to oleexpimp.tlb unless you specifically need one of these alternate versions for a class module Implements statement.
Only a few API declarations are included, most of which are related to or frequently used by the interfaces. All of that ones that are included are oleexp.tlb.
mimelib.tlb is interfaces specifically for MIME in messages; interfaces mostly starting with IMime____. It's very unlikely you'll need this one, and don't need to reference it.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Project Updated to Version 4.7
In one of the sample projects, an issue came up where the enum IUN_Flags and NII_Flags had all the same entries, so produced an ambiguous name error. I had not realized such an issue could make it through compiling the TLB, so had not checked. After realizing that was possible, I created a tool that scanned the code for duplicate constants or enum names, and found a number of them. So it was important to get this new version released to avoid bugs like that. But I had also done quite a bit of other work, so there's a bunch of other new stuff in the release too.
Here's the full changelog:
Code:
(oleexp 4.7 - Released 23 Dec 2020)
-Added interfaces IFrameworkInputPaneHandler and IFrameworkInputPane, with coclass FrameworkInputPane.
-Added interface IShellTaskScheduler with coclass ShellTaskScheduler.
-Added interface ISharingConfigurationManager with coclass SharingConfigurationManager.
-Added interface IDefaultFolderMenuInitialize with coclass DefFolderMenu.
-Added interfaces IAccessible, IAccessibleHandler, IAccessibleWindowlessSite, IAccIdentity, IAccPropServer, and IAccPropServices (with coclass CAccPropServices) from oleacc.h, and related consts.
-Added undocumented interface ICustomizeInfoTip
-Added coclass PropertyChangeArray
-CHANGE TO MAJOR OLELIB INTERFACES: IFolderView has been updated to use As Any in a ByRef Long to get objects in .Items and .GetFolder. Also associated SVGIO enum for several members. Changed ByRef Long for interface pointers in IShellView and IShellView2 .GetItemObject, ICategoryProvider .CreateCategory
-IPropertyStore.SetValue and .Commit were already functions, made the rest of the methods into one as well.
-Added a number of error/success consts including OLE_E_, REGDB_E_, STG_E_, and RPC_E_ error codes.
-The wmp.dll dependency has been removed from oleexp.tlb, and placed in its own dependent tlb, oleexpwmp.tlb. The source is in \source\wmp\, which just moves the wmp.inc source file from olelib/oleexp and like mimelib.tlb, it's compiled including oleexp.tlb.
-Bug fix: IItemNameLimits is typically used for Implements, but had out-only parameters making that impossible.
-Bug fix: IUN_Flags and NII_Flags contained duplicate enum values. This caused an error using any of them and you had to specify which to use. The former has been removed. Change any instance of 'IUN_Flags' to 'NII_Flags'. The values themselves are unchanged.
-Bug fix: After the above issue popped up, I created a tool to root out any further duplicates. Unfortunately, there were many, as I had never worried about this under the assumption that a compile error would be triggered for such a situation.
The following were fixed: Two SVSI_Flags enums, one with additional values. Two SVGIO_Flags enums, ditto. Full duplicates of SVUIA_STATUS and SV2GV_Flags. ISCM_FLAGS was not used anywhere, and contained only a single value found in MUTZ_FLAGS. The URLACTION enum contained some duplicate values from URLPOLICIES.
-(oleexpimp) oleexpimp.tlb has been recompiled using oleexp 4.7
-(oleexpimp) Bug fix: This used the IShellFolder definition from olelib2, but VB says that's a bad interface for Implements
-(mWIC) Added WebP and Heif container format UUIDs.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Thanks again to your efforts to continue the development of this great library!
I'd like to know how you do the conversion of the headers to ODL? All manually? Like to share how it's done? Some others could then support you.
I ask because I did some modifications and enhancements to the library because some of the declarations seem not to work.
(Have you ever used IServiceProvider of oleexpimp.tlb? It always crashes if I implement it. I had to change the code like this to get it working:
As you can see one has to set a pointer to a specific interface (here IExplorerPaneVisibility) instead of a general long pointer to an interface. I found this to be required also for other implemented ServiceProviders.)
Back to the question: I tried to automate the conversion of the MSDN headers using a self developed parser. But it's really hard concerning all the conditional statements an includes. I am now at the state to generate a ODL that then further needs some manual adjustments. But that still is hard work.
My actual target is the Media Foundation API (https://docs.microsoft.com/en-us/win...api/mfobjects/). And especially a replacement for DirectShows Sample Grabber (https://docs.microsoft.com/en-us/win...i/mfreadwrite/) as the new methods are much easier to implement; much less code!
It would be an exceptional addition to oleexp if it included the media foundation interfaces and functions!
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Was it crashing on entry or when you tried to set the pointer to an object? I'm not familiar with IServiceProvider but I've never had an issue with ObjPtr()/vbaObjSetAddRef for a generic object, which pops up fairly often. Though sometimes I've had to implement the function in a standard module with a vtable swap.
But to the question, I do it all mostly manually, just find/replace for common conversions and aliasing data types so not so many of them have to be changed; I use a modern VS to keep a project with all the files, have 2 panes side by side, and have syntax highlighting.(*) As you found, trying to automate it is just too complex to be practical. I've looked at it briefly before, but always just concluded between the time to make a tool and all the manual touching up, it would be quicker to just do it by hand; can do it quite quickly now after so much practice. I've tried to convert every argument using a type that's worked before, but sometimes interfaces have individual quirks that cause issues... like it won't accept a pointer to a GUID so it has to be passed as 4 Longs (why 4 Longs specifically you may ask? Structuring it any other way crashed). And of course sometimes there's just mistakes, it would be way too time consuming to test every single interface in VB when tons of them I'm not even familiar with. I also never went through and checked all the original code from the olelib project this is forked from, which includes ISP.
If you've found and corrected bugs, by all means share and I'll update the project, and credit you for the help. With IServiceProvider here I'd really want to try to find a workaround that didn't result in everyone having to compile their own custom version, so I'll have a look into that.
The Media Foundation API looks great, would love to include it! It does look like a ton of interfaces though; what have you done so far, maybe I can tackle a few of the headers when I get back tonight?
-
* - I do have some code that automates converting to VB... like create IID_IWhatever() UUID functions for mIID.bas or PKEYs for mPKEY/related, or to convert structs to Types in VB code, or to convert enums. But none of it is for automating the C headers to VB6-compatible ODLs.
Last edited by fafalone; Jan 10th, 2021 at 06:50 PM.
If you're interesting here is a small example where you can extract the images from a youtube video frames using Media Foundation API. The example is intended for extracting slides from a video so it analyzes frames and extract the slides and skip animations. For example if you have a video with a slideshow which are animated it should extract the static images:
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by fafalone
Was it crashing on entry or when you tried to set the pointer to an object? I'm not familiar with IServiceProvider but I've never had an issue with ObjPtr()/vbaObjSetAddRef for a generic object, which pops up fairly often. Though sometimes I've had to implement the function in a standard module with a vtable swap.
The sample I've posted is for handling the panes of an explorer browser control. It's somehow complicated: You have to implement IServiceProvider in a class module to hook the GetPaneState calls of IExplorerPaneVisibility, which is also implemented in this class. So the first step ist to tell ExplorerBrowser where to find the IExplorerPaneVisibility interface. The method I found for this is IUnknown_SetSite [oExplBrowser], Me. oExplBrowser then calls the implemented IServiceProvider several times. If the queried IID is the one of IExplorerPaneVisibility I return Set ... = Me as the functions result. It crashes in this case if I use the declaration in oleexpimp. But not with my altered declaration above.
(I have tried this also with a vtable swap but the result was the same.) BTW: I have all the samples from Morcillo; there is no one that uses the implements version of IServiceProvider, so I had to test that myself.
Time to update your sample.
But to the question, I do it all mostly manually, ...
That has been my guess. The most difficult cirumstance to automate the ODL creation for me are the many aliases for types. You have to jump into many includes to find e.g. what the result DBAPI means... finally it's just a DWORD.
If you've found and corrected bugs, by all means share and I'll update the project, and credit you for the help.
No, no, I have not found bugs. Just the issue with IServiceProvider caused me to modify oleexpimp. (Another addition to oleexp are the ActiveScript interfaces that I borrowed and extended from D. Zimmer.)
The Media Foundation API looks great, would love to include it! It does look like a ton of interfaces though; what have you done so far, maybe I can tackle a few of the headers when I get back tonight?
Looks like TheTrick has already done the job! Wow!
Last edited by SaschaT; Jan 13th, 2021 at 06:31 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by The trick
If you're interesting here is a small example where you can extract the images from a youtube video frames using Media Foundation API. The example is intended for extracting slides from a video so it analyzes frames and extract the slides and skip animations. ...
Incredible! That's what I have dreamed of! A nearly complete type library for the Media Foundation objects!
I am just missing some functions in mfreadwrite like MFCreateSourceReaderFromByteStream and so. But I'll make this up by myself.
The same question to you: How do you manage to create the ODLs?