Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
but in VB6 you'd have to go with the nuclear option of implementing it yourself in a BAS module.
Ah yes, I did the same thing in my large WinRT project for IVector_(H)String. I actually wanted to avoid that. It really needs something like an IList<T> as a helper function.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Usually you can find other objects that give you the vector you want. For example both ClipboardContentOptions.HistoryFormats and RemoteLauncherOptions.PreferredAppIds give you an IVector_HSTRING.
And for XAML Binding of control properties you can use a custom implementation of IBindableVector in a class like I did in the PDF Viewer example above.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by -Franky-
My question is: How do I create a new and empty IVector_IStorageItem using your TLB?
Since IDataPackage.SetStorageItems wants only an IIterable_IStorageItem parameter and does not require a full IVector_IStorageItem implementation then the problem is simplified a lot and we can implement these IIterable interfaces in a regular cStorageItems class using a vanilla Collection object as backing storage for the vector's elements:
Code:
Class cStorageItems
Implements IIterable_IStorageItem, IIterator_IStorageItem
Private BackingStorage As Collection, m_CurrentIndex As Long
Friend Function This(vFiles As Variant) As IIterable_IStorageItem
Dim vFile As Variant
Set This = Me: If Not IsArray(vFiles) Then vFiles = Array(vFiles)
With New cAwait
For Each vFile In vFiles
If .Await(StorageFileStatics.GetFileFromPathAsync(StrRef(vFile))) = AsyncStatus_Completed Then BackingStorage.Add .GetResults(Of IStorageFile)
Next vFile
End With
End Function
Private Function IIterable_IStorageItem_First() As IIterator_IStorageItem
m_CurrentIndex = 0: Set IIterable_IStorageItem_First = Me
Debug.Print "IIterable_IStorageItem_First"
End Function
Private Property Get IIterator_IStorageItem_Current() As IStorageItem
Set IIterator_IStorageItem_Current = BackingStorage(m_CurrentIndex + 1)
Debug.Print "IIterator_IStorageItem_Current"
End Property
Private Property Get IIterator_IStorageItem_HasCurrent() As BooleanByte
IIterator_IStorageItem_HasCurrent = Abs(m_CurrentIndex <= BackingStorage.Count - 1)
Debug.Print "IIterator_IStorageItem_HasCurrent"
End Property
Private Function IIterator_IStorageItem_MoveNext() As BooleanByte
m_CurrentIndex = m_CurrentIndex + 1: IIterator_IStorageItem_MoveNext = IIterator_IStorageItem_HasCurrent
Debug.Print "IIterator_IStorageItem_MoveNext"
End Function
Private Function IIterator_IStorageItem_GetMany(ByVal Length As Long, ByVal Items As LongPtr) As Long
' Not Implemented
End Function
Private Sub Class_Initialize()
Set BackingStorage = New Collection
End Sub
End Class
As you can see the implementation is a lot simpler because these interfaces are already declared and we don't need a BAS module anymore. However we still need memory allocation for the IIterable_IStorageItem elements, hence the need for a Collection.
Here's the updated ShareUI.zip project showcasing this new approach.
I'd still go with the previous FolderLauncherOptions method of obtaining a full-fledged vector implementation as it's still a lot easier and probably performs better than a Collection (although not by much).
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
I'd still go with the previous FolderLauncherOptions method of obtaining a full-fledged vector implementation as it's still a lot easier and probably performs better than a Collection (although not by much).
I also believe that's the best way. I partly did it that way in my large WinRT project as well.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
Also please feel free to post your creations in this thread as well instead of exclusively on the German forum!
Since the question about how to access this ShareUI dialog was asked in a German forum, I'm naturally posting my example there as well. However, I'm not using your TLB in this example. Yes, I know it would be clearer and simpler with TLB. I hope you can forgive me.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
I wasn't talking about the ShareUI dialog, you couldn't have posted that since the IDataTransferManagerInterop interface wasn't included in the TypeLib at the time. You could have posted your video conversion example though, that could have been interesting for many other users.
Anyway, I have now updated the TypeLib with this missing interface and added the ShareUI sample to the collection linked in the first post above.
This update also includes the FolderWatcher project that demonstrates how you can monitor a folder for file changes and receive events when such changes occur.
Monitored changes include:
file created (or copied into the folder)
file deleted
file renamed (reported as creation + deletion)
file size changed (like editing a text file)
file date changed (usually happens during editing as well)
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
The code for this video converter was written for a specific problem and can be found here: https://www.vb-paradise.de/index.php...esen/?pageNo=3 <- Last post on this page. On page 4, I'll show a few more small changes to the code.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
This update also includes the FolderWatcher project that demonstrates how you can monitor a folder for file changes and receive events when such changes occur.[/LIST]
Error when try to run in cFileQuery.cls:
Code:
Set StorageFolderStatics.GetFolderFromPathAsync(StrRef(sWatchedFolder)).Completed = Me
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Open another project from the samples collection (like the GIF Player for example) and copy the 3 lines of code with the registry key check from Form_Load, looks like I forgot to add them in the FolderWatch project!
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
A little help maybe, what exactly is causing type mismatch for you, that line of code is very straightforward and it works just fine for everyone else...
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
@VanGoghGaming: I believe the error occurs when the setting for how errors are handled is configured under "General" in the IDE options. You are comparing a string with WinRT.BOOL.APITRUE here, which triggers the error. CStr(APITRUE) resolves the issue when reading and writing the value..
Last edited by -Franky-; May 8th, 2026 at 01:28 AM.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
A little help maybe, what exactly is causing type mismatch for you, that line of code is very straightforward and it works just fine for everyone else...
APITRUE and HKEY_CURRENT_USER are not declare ... when i declare in a module every thing is ok
Code:
Public Const HKEY_CURRENT_USER As Long = &H80000001
Public Const APITRUE As String = "1"
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by -Franky-
@VanGoghGaming: I believe the error occurs when the setting for how errors are handled is configured under "General" in the IDE options. You are comparing a string with WinRT.BOOL.APITRUE here, which triggers the error. CStr(APITRUE) resolves the issue when reading and writing the value..
I can't reproduce it for any of the error trapping options in the General tab, probably because this isn't an error, the compiler is supposed to automatically coerce Long to String in this case. That's why I am at a loss for why this is happening in some cases.
Originally Posted by cliv
APITRUE and HKEY_CURRENT_USER are not declare ... when i declare in a module every thing is ok
Code:
Public Const HKEY_CURRENT_USER As Long = &H80000001
Public Const APITRUE As String = "1"
Those values are definitely declared as Enums in the TypeLib, just right-click one and select Definition. Maybe you have an ancient version of the TypeLib that you need to overwrite with the latest one from the first post above.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
One should not leave it to the compiler to correctly cast values during a comparison. In .NET, with "Option Strict On," a comparison between a string and for example an integer would immediately be flagged as an error in the code.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
.NET is for the weak, that's why we keep on trucking in VB6! The compiler is perfectly capable to coerce value types as needed:
Code:
Debug.Print 1 = "1" ' Prints True
I am more interested why exactly it produced Type mismatch only for @cliv above. Maybe it's an issue with SP6 not being installed or more likely an outdated TypeLib, either way it should work correctly all the time.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
That's right! Embrace language constraints, strive for brevity and dream about direct machine opcodes via Emit :-))
SP6 missing is possible but unlikely (everything will bomb out). I bet it's a case of having an old version of the typelib lying around registered in a temporary folder and now cannot untangle the registry mess.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
I am more interested why exactly it produced Type mismatch only for @cliv above. Maybe it's an issue with SP6 not being installed or more likely an outdated TypeLib, either way it should work correctly all the time.
I am also encountering this error. SP6 and all other available updates for VB6 have been installed as well. Using CStr(APITRUE) resolved the error. I am also using your latest TLB.
One really shouldn't speak negatively about other programming languages. Everyone who programs in VB.NET pokes fun at VB6 those who program in C# poke fun at those who program in VB.NET, and so on. Ultimately, it doesn't matter which language you program in. Every programming language has its own advantages and disadvantages. For instance, I personally would have liked to have had "Option Strict On" available in VB6 right from the start.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
It was a joke mate, just for laughs. Maybe you have some Add-Ins that cause this error, otherwise I really don't know what's happening. You were always able to compare strings with integers, it's a core feature.
Last edited by VanGoghGaming; May 10th, 2026 at 05:09 AM.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
I am more interested why exactly it produced Type mismatch only for @cliv above. Maybe it's an issue with SP6 not being installed or more likely an outdated TypeLib, either way it should work correctly all the time.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
That's interesting, my VB6 doesn't display "Forms3: 12.0.4518.101" in the bottom-right corner. The rest of numbers are the same, Version 9782 and VBA: Retail 6.0.9782. Wondering what's up with that Forms3 stuff?
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
That's interesting, my VB6 doesn't display "Forms3: 12.0.4518.101"
...because i have i installed Microsoft Access 2007 for old database and Microsoft Office LTSC Professional Plus 2021
Edit (Copilot): Forms3: 12.0.4518.101 is the version of the Microsoft Forms 2.0 ActiveX library (FM20.DLL) that Visual Basic 6.0 is using on your system. Forms3 is the internal name used by Microsoft for the third?generation MSForms library, which provides the controls used in VB6 and VBA UserForms. Forms3 corresponds to the DLL: FM20.DLL
This DLL is installed with Microsoft Office, not with VB6 itself.
The version you see: 12.0.4518.101 corresponds to Office 2007 (Office 12).
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Even AI is stumped by this comparison conundrum!
I've finally managed to reproduce the error eventually by deleting the registry key entirely. It turns out vbNullString is not a valid comparison value for an integer!
Last edited by VanGoghGaming; May 11th, 2026 at 09:24 AM.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
I've finally managed to reproduce the error eventually by deleting the registry key entirely. It turns out vbNullString is not a valid comparison value for an integer!
With "Option Strict On" this would never have happened. Just kidding. CStr(APITRUE) is enough to solve the problem.
Re: [VB6] - WinRT Interfaces & XAML Islands TypeLibs for VB6/VBA x86 and VBA7 x64
Originally Posted by VanGoghGaming
It turns out vbNullString is not a valid comparison value for an integer!
Fixed this bug and uploaded the new samples collection archive. This version also includes the BindableRecordset project which is an Access MDB Database editor using a WinRT XAML ListView control bound to an ADODB Recordset.
This project focuses on editing the Customers table from the classic Northwind.mdb database while bridging technologies several decades apart:
a classic ADODB Recordset is used to open the table
a modern XAML ListView control is bound to this Recordset with an implementation of the IBindableVector interface
The binding is set to two-way mode and triggered on PropertyChanged so that every change is recorded in real time and saved to the database.