This project has already been available for quite some time as a package on the twinBASIC server and I finally got around to exporting it as a TypeLib (both 32-bit and 64-bit) for whoever wants to use it in their VB6 and VBA projects. The TypeLibs contain extensive coverage of the most popular WinRT namespaces although they are far from complete.
The twinBASIC package contains a changelog with what is currently included:
Code:
1.0.0.5 - Preliminary public release
Windows.ApplicationModel
Windows.ApplicationModel.AppService
Windows.ApplicationModel.Background
Windows.ApplicationModel.DataTransfer
Windows.ApplicationModel.DataTransfer.DragDrop
Windows.Data.Json
Windows.Data.Pdf
Windows.Data.Xml.Dom
Windows.Devices.Input
Windows.Foundation
Windows.Globalization
Windows.Graphics.Capture
Windows.Graphics.DirectX.Direct3D11
Windows.Graphics.DirectX
Windows.Graphics.Imaging
Windows.Graphics
Windows.Media.Ocr
Windows.Security.Credentials.UI
Windows.Security.Cryptography
Windows.Storage
Windows.Storage.Pickers
Windows.Storage.Pickers.Provider
Windows.Storage.Provider
Windows.Storage.Streams
Windows.System
Windows.System.Threading
Windows.UI
Windows.UI.Core
Windows.UI.Input
Windows.UI.Notifications
Windows.UI.Popups
Windows.UI.Text
Windows.UI.WindowManagement
Windows.Xaml
Windows.Xaml.Controls
Windows.Xaml.Controls.Primitives
Windows.Xaml.Data
Windows.Xaml.Hosting
Windows.Xaml.Input
Windows.Xaml.Markup
Windows.Xaml.Media
Windows.Xaml.Media.Animation
Windows.Xaml.Media.Imaging
Windows.Xaml.Media.Media3D
Windows.Xaml.Navigation
Windows.Web
1.1.0.10 - Added namespaces:
Windows.ApplicationModel.AppService
Windows.Devices.Core
Windows.Devices.Enumeration
Windows.Media
Windows.Media.Audio
Windows.Media.Capture
Windows.Media.Capture.Core
Windows.Media.Capture.Frames
Windows.Media.Casting
Windows.Media.Core
Windows.Media.Devices
Windows.Media.Devices.Core
Windows.Media.Editing
Windows.Media.Effects
Windows.Media.FaceAnalysis
Windows.Media.MediaProperties
Windows.Media.Playback
Windows.Media.PlayTo
Windows.Media.Protection
Windows.Media.Streaming
Windows.Media.Streaming.Adaptive
Windows.Media.Transcoding
Windows.Networking
Windows.Networking.BackgroundTransfer
Windows.Networking.Connectivity
Windows.Networking.Sockets
Windows.Security.Authentication.Web
Windows.Security.Credentials
Windows.Security.Cryptography.Certificates
Windows.Security.Cryptography.Core
Windows.System.RemoteSystems
Windows.UI.Xaml.Documents
Windows.Web.Http
Windows.Web.Http.Filters
Windows.Web.Http.Headers
1.2.0.17 - Added namespaces:
Windows.ApplicationModel.Search
Windows.Devices.Printers
Windows.Graphics.Display
Windows.Graphics.Effects
Windows.Graphics.Printing
Windows.UI.Composition
Windows.UI.Composition.Effects
Windows.UI.Xaml.Shapes
1.3.0.30 - Added namespaces:
Windows.System.Threading.Core
Windows.System.Profile
Windows.UI.Xaml.Interop
cAwait
cBindableVector
cPop
mdlSubclass
1.4.0.64 - Added namespaces:
Windows.Data.Text
Windows.Devices.SerialCommunication
Windows.Storage.BulkAccess
Windows.Storage.Search
Windows.UI.Text.Core
Windows.UI.ViewManagement
- Added support for ByVal UDTs as well as helper methods and properties for many UDTs:
Color, CornerRadius, DateTime, Duration, FontWeight, GeneratorPosition, GridLength, HSTRING, KeyTime, Matrix, Matrix3D, POINTF, RepeatBehavior, RECTF, SIZEF
UUID, Thickness, TimeSpan, WindowId
1.5.0.107 - Added namespaces:
RoMetaDataApi (refactored mdlNamespaces to resolve runtime class names from MetaData (*.winMD files) instead of hard-coding them in a XML file)
Windows.Data.Html
Windows.Media.Playlists
Windows.Media.SpeechRecognition
Windows.Media.SpeechSynthesis
1.6.0.125 - Added namespaces:
Windows.UI.Composition.Core
Windows.UI.Composition.Desktop
Windows.UI.Composition.Diagnostics
Windows.UI.Composition.Interactions
Windows.UI.Composition.Scenes
Windows.Web.UI
Windows.Web.UI.Interop
The backbone of any VB6 project using WinRT classes is the NewObject function that instantiates an activatable WinRT class and provides access to its interfaces. On the first call it also parses the system .winmd metadata files and builds a collection of activatable classes (this process is very fast, well under 100ms) so that subsequent instantiations are pretty much instant.
Here's an example of how to instantiate the MediaPlayer runtime class:
Code:
' Sample usage:
Dim MediaPlayer As IMediaPlayer
Set MediaPlayer = NewObject("MediaPlayer")
I'll be updating this collection with some sample projects described below showcasing the usage of these TypeLibs with various WinRT classes:
Download the WinRT Samples Collection.zip
Here are the TypeLib files:
Requirements: Windows 10 or later!