Maybe a bug in MKTYPLIB? It shows FUNCDESC.oVft = 0. Here is the TLB without this bug in ID2D1Geometry interface but it exists in all the derived interfaces. I've just fixed bytes in a hex editor.
Printable View
It must start somewhere in the new ifaces and impact all following.. I had checked some older ones for just this issue but it seemed ok. Will investigate tonight.
ID2D1RoundedRectangleGeometry::GetRoundedRect voffset=0x0034, inherits from ID2DGeometry... so it counts those methods... but not ID2D1Resource or IUnknown
ID2D1DrawingStateBlock::GetDescription voffset=0x00010, it inherits from ID2D1Resource... so same setup as ID2DGeometry, but correct.
Ok so I don't know why it's happening, but I figured out the solution... placing ID2D1Resource *before* ID2D1Geometry fixes the problem (even though it's forward declared). I'll post an update a little later after I make sure this isn't impacting anything else.
Project Updated
The version is still 5.3, but if you downloaded oleexp before this post, it's impacted by the bug discussed in the previous few posts. It has now been fixed.
I made sure no interface appears before the one it inherits from, which was the cause of the bug, though it really shouldn't have been, given they were forward declared.
Please fix the IID of ITypeInfo interface it isn't correct.
Wow, olelib (the project this was forked from) came out like 20 years ago and nobody has noticed this until now lol... i checked my copy of the original and sure enough it was wrong from then.
I'm finishing up adding some extra media foundation interfaces to support DirectComposition, I'll post it along with that tonight.
fafalone, are you interested in a project in which you could mix tlbs? Just i thought about the issues with MKTYPLIB like optional parameters, out/retval attributes. I think i could make a TLB mixer and you could use MIDL to produce modern typelib then mix it with VB6-compatible types.
Do you mean just using MKTYPLIB for the unavoidable redefinitions then midl for everything else? and then combine them? Yes it's a possibility... but I'm pretty sure twinBASIC will support exporting typelibs very soon now (and not via midl compilation), at which point I can just export it all from my tbShellLib version. At this point I'm probably going to wait for that, because even if I could compile oleexp in midl, it would be a **ton** of work to go back and fix everywhere I didn't preserve the types and just put 'long' instead of the proper type and a typedef. I did that once already, it took weeks.
Ok that took a lot longer than I thought since mfidl.idl was 15k lines to get through, and I still need to do IID and GUID generation work before a final public release, but here's a test version with the ITypeInfo bug fixed and the new MF interfaces.
Project Updated - Version 5.4
NOTE: The Beta version posted last night contained bugs in several interfaces and types.
The final release also includes the extensive set of GUIDs for the Media Foundation interfaces (in addition to the regular interface IIDs).
Changelog:
(oleexp 5.4 - Released 09 February 2023)
- Added DXGI and DirectComposition interfaces
- Substantially expanded included Media Foundation interfaces. This includes all the related GUIDs defined in mfidl.idl, in DirectX.bas, in addition to the interface IIDs.
- (Bug fix) IMFMediaTypes had ByVal UDTs
- (Bug fix) IShellWindows had member with VARIANT instead of VARIANT_BOOL.
- (Bug fix) ITypeInfo had the wrong GUID, which is incredible as it's been wrong since the original olelib.
Project Updated - Version 5.5
Since a few people are working on typelib-related stuff right now I wanted to release a fix for a major bug immediately: ICreateTypeLib2 incorrectly inherited from IUnknown instead of ICreateTypeLib (another in the category of 'unnoticed for 20+ years' lol). Also added a few basic COM interfaces from oaidl.idl.
- Added objidl.idl interfaces IAdviseSink2, IClientSecurity, IServerSecurity, IMallocSpy, IClassActivator, IProgressNotify, IStdMarshalInfo, IExternalConnection and IThumbnailExtractor (w/coclass ThumbnailFCNHandler).
- Added undocmented hardware enum interfaces/coclasses.
- Bug fix: ICreateTypeLib2 incorrectly extended IUnknown instead of ICreateTypeLib.
These updates have also been applied to tbShellLib v2.9.85.
Can You make a IDispatch2
which have this alternative functions:
rgszNames not as string
Function GetIDsOfNames(riid As IID, rgszNames As Long, cNames As Long, lcid As Long, rgDispId As Long) As Long
pVarResult as variant
Function Invoke(dispIdMember As Long, riid As IID, lcid As Long, wFlags As Integer, pDispParams As DISPPARAMS, pVarResult, pExcepInfo As EXCEPINFO, puArgErr As Long) As Long
reason:
1) You can't invoke a method using named arguments, because you can't pass an array of long values (the pointers to BSTR) in GetIDsOfNames to get an array from pointer rgDispId.
2) Invoke may return an UDT and that goes to pVarResult if it is Variant.
I use this and works nice for me:
Code:// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: IDispatch.tlb
[
uuid(54BC8460-C769-11D2-8350-444553540004),
version(2.0),
helpstring("IDispatch Interface - Eduardo Morcillo - changed for M2000 Interperter")
]
library IDispatch
{
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");
typedef struct {
long Data1;
short Data2;
short Data3;
unsigned char Data4[8];
} IID;
typedef struct {
[helpstring("Parameters")
]
long rgPointerToVariantArray;
[helpstring("Named parameters")
]
long rgPointerToDISPIDNamedArgs;
[helpstring("Parameter count")
]
long cArgs;
[helpstring("Named parameter count")
]
long cNamedArgs;
} DISPPARAMS;
typedef struct {
[helpstring("Error number")
]
short wCode;
short wReserved;
[helpstring("Source")
]
long StrPtrSource;
[helpstring("Description")
]
long StrPtrDescription;
[helpstring("Help file")
]
long StrPtrHelpFile;
[helpstring("Help context")
]
long dwHelpContext;
long pvReserved;
[helpstring("HRESULT (__stdcall *pfnDeferredFillIn)(struct EXCEPINFO *);")
]
long pfnDeferredFillIn;
long scode;
} EXCEPINFO;
typedef [helpstring("InvokeFlags")]
enum {
DISPATCH_METHOD = 1,
DISPATCH_PROPERTYGET = 2,
DISPATCH_PROPERTYPUT = 4,
DISPATCH_PROPERTYPUTREF = 8
} InvokeFlags;
typedef [helpstring("IDispatch::Invoke HRESULTs")]
enum {
DISP_E_UNKNOWNINTERFACE = -2147352575,
DISP_E_MEMBERNOTFOUND = -2147352573,
DISP_E_PARAMNOTFOUND = -2147352572,
DISP_E_TYPEMISMATCH = -2147352571,
DISP_E_UNKNOWNNAME = -2147352570,
DISP_E_NONAMEDARGS = -2147352569,
DISP_E_BADVARTYPE = -2147352568,
DISP_E_EXCEPTION = -2147352567,
DISP_E_OVERFLOW = -2147352566,
DISP_E_BADINDEX = -2147352565,
DISP_E_UNKNOWNLCID = -2147352564,
DISP_E_ARRAYISLOCKED = -2147352563,
DISP_E_BADPARAMCOUNT = -2147352562,
DISP_E_PARAMNOTOPTIONAL = -2147352561,
DISP_E_BADCALLEE = -2147352560,
DISP_E_NOTACOLLECTION = -2147352559,
DISP_E_DIVBYZERO = -2147352558
} InvokeResults;
typedef [helpstring("Standard DISPIDs")]
enum {
DISPID_AUTOSIZE = -500,
DISPID_BACKCOLOR = -501,
DISPID_BACKSTYLE = -502,
DISPID_BORDERCOLOR = -503,
DISPID_BORDERSTYLE = -504,
DISPID_BORDERWIDTH = -505,
DISPID_DRAWMODE = -507,
DISPID_DRAWSTYLE = -508,
DISPID_DRAWWIDTH = -509,
DISPID_FILLCOLOR = -510,
DISPID_FILLSTYLE = -511,
DISPID_FONT = -512,
DISPID_FORECOLOR = -513,
DISPID_ENABLED = -514,
DISPID_HWND = -515,
DISPID_TABSTOP = -516,
DISPID_TEXT = -517,
DISPID_CAPTION = -518,
DISPID_BORDERVISIBLE = -519,
DISPID_APPEARANCE = -520,
DISPID_MOUSEPOINTER = -521,
DISPID_MOUSEICON = -522,
DISPID_PICTURE = -523,
DISPID_VALID = -524,
DISPID_READYSTATE = -525,
DISPID_LISTINDEX = -526,
DISPID_SELECTED = -527,
DISPID_LIST = -528,
DISPID_COLUMN = -529,
DISPID_LISTCOUNT = -531,
DISPID_MULTISELECT = -532,
DISPID_MAXLENGTH = -533,
DISPID_PASSWORDCHAR = -534,
DISPID_SCROLLBARS = -535,
DISPID_WORDWRAP = -536,
DISPID_MULTILINE = -537,
DISPID_NUMBEROFROWS = -538,
DISPID_NUMBEROFCOLUMNS = -539,
DISPID_DISPLAYSTYLE = -540,
DISPID_GROUPNAME = -541,
DISPID_IMEMODE = -542,
DISPID_ACCELERATOR = -543,
DISPID_ENTERKEYBEHAVIOR = -544,
DISPID_TABKEYBEHAVIOR = -545,
DISPID_SELTEXT = -546,
DISPID_SELSTART = -547,
DISPID_SELLENGTH = -548,
DISPID_REFRESH = -550,
DISPID_DOCLICK = -551,
DISPID_ABOUTBOX = -552,
DISPID_ADDITEM = -553,
DISPID_CLEAR = -554,
DISPID_REMOVEITEM = -555,
DISPID_CLICK = -600,
DISPID_DBLCLICK = -601,
DISPID_KEYDOWN = -602,
DISPID_KEYPRESS = -603,
DISPID_KEYUP = -604,
DISPID_MOUSEDOWN = -605,
DISPID_MOUSEMOVE = -606,
DISPID_MOUSEUP = -607,
DISPID_ERROREVENT = -608,
DISPID_READYSTATECHANGE = -609,
DISPID_CLICK_VALUE = -610,
DISPID_RIGHTTOLEFT = -611,
DISPID_TOPTOBOTTOM = -612,
DISPID_NAME = -800,
DISPID_DELETE = -801,
DISPID_OBJECT = -802,
DISPID_PARENT = -803
} STANDARD_DISPIDS;
typedef enum {
DISPID_AMBIENT_BACKCOLOR = -701,
DISPID_AMBIENT_DISPLAYNAME = -702,
DISPID_AMBIENT_FONT = -703,
DISPID_AMBIENT_FORECOLOR = -704,
DISPID_AMBIENT_LOCALEID = -705,
DISPID_AMBIENT_MESSAGEREFLECT = -706,
DISPID_AMBIENT_SCALEUNITS = -707,
DISPID_AMBIENT_TEXTALIGN = -708,
DISPID_AMBIENT_USERMODE = -709,
DISPID_AMBIENT_UIDEAD = -710,
DISPID_AMBIENT_SHOWGRABHANDLES = -711,
DISPID_AMBIENT_SHOWHATCHING = -712,
DISPID_AMBIENT_DISPLAYASDEFAULT = -713,
DISPID_AMBIENT_SUPPORTSMNEMONICS = -714,
DISPID_AMBIENT_AUTOCLIP = -715,
DISPID_AMBIENT_APPEARANCE = -716,
DISPID_AMBIENT_PALETTE = -726,
DISPID_AMBIENT_TRANSFERPRIORITY = -728,
DISPID_AMBIENT_RIGHTTOLEFT = -732,
DISPID_AMBIENT_TOPTOBOTTOM = -733
} AMBIENT_DISPIDS;
typedef enum {
DISPID_FONT_NAME = 0,
DISPID_FONT_SIZE = 2,
DISPID_FONT_BOLD = 3,
DISPID_FONT_ITALIC = 4,
DISPID_FONT_UNDER = 5,
DISPID_FONT_STRIKE = 6,
DISPID_FONT_WEIGHT = 7,
DISPID_FONT_CHARSET = 8,
DISPID_PICT_HANDLE = 0,
DISPID_PICT_HPAL = 2,
DISPID_PICT_TYPE = 3,
DISPID_PICT_WIDTH = 4,
DISPID_PICT_HEIGHT = 5,
DISPID_PICT_RENDER = 6
} OLEOBJECTS_DISPIDS;
interface IDispatchM2000;
[
odl,
uuid(00020400-0000-0000-C000-000000000046),
helpstring("IDispatch Interface")
]
interface IDispatchM2000: IUnknown {
long _stdcall GetTypeInfoCount([out] long* pctinfo);
long _stdcall GetTypeInfo(
[in] long iTInfo,
[in] long lcid,
[out] long* ppTInfo);
long _stdcall GetIDsOfNames(
[in] IID* riid,
[in] long *rgszNames,
[in] long cNames,
[in] long lcid,
[in, out] long *rgDispId);
long _stdcall Invoke(
[in] long dispIdMember,
[in] IID* riid,
[in] long lcid,
[in] short wFlags,
[in, out] DISPPARAMS* pDispParams,
[out] VARIANT* pVarResult,
[out] EXCEPINFO* pExcepInfo,
[out] long* puArgErr);
};
};
Why wouldn't you be able to pass the named arguments as strings?
It should accept arrays... since the number of elements is specified by cNames and "as string" is just passing a pointer to a string anyway, you should be able to pass stringarray(0) and it will get all of them... at least, this is how it works for interfaces, longs/integers/bytes, and UDTs, though I haven't specifically tried that setup with strings.
With Invoke, you'd pass VarPtr(variant), which is equivalent to passing ByRef variant. But yes that doesn't match the official definition so should have been different.
But sure I can put your alternate version into the next release... I'll mark it hidden so as not to confuse but IDispatchM2000 will be there (all this does is prevent it from showing up in the object browser, you can use it as normal, it's the 'restricted' attribute that interferes with normal use).
Thanks
So there's a bunch of incorrectly formatted GUIDs and PROPERTYKEYs in mDirectX.bas... I'm in the middle of finishing D2D now so am going to post a corrected version of just that module and wait to update the main release...
Edit: Attachment removed; new public release has fixes applied.
@georgekar, IDispatchM2000 will have to go in oleexpimp.tlb because MKTYPLIB doesn't allow two interfaces with the same GUID.
This is a part of code before the invoke (at iDispatch). I have to pass the names of the named arguments in reverse order, but at 0 has to be the name of the function. So I pass the myptr(0) (by reference) so I pass the pointer of the first element of the array. But I am thinking that I didn't use Varptr(pargs2(0)), on OLEEXP, so maybe you are right. Anyway I have to pass the names in reverse order, so a long array is more preferable, because only the strptr need to copy there in the right order.
Code:ReDim myptr(0 To fixnamearg)
myptr(0) = StrPtr(pstrProcName)
For lngLoop = fixnamearg To 1 Step -1
myptr(fixnamearg - lngLoop + 1) = StrPtr(pargs2(lngLoop))
Next lngLoop
ReDim varDISPID(0 To fixnamearg)
lngRet = IDsp.GetIDsOfNames(riid, myptr(0), fixnamearg + 1, Clid, varDISPID(0))
dispid = varDISPID(0)
Project Updated - Version 5.6
This version adds all missing Direct2D interfaces/types/enums/GUIDs, adds all Direct3D 11 and 12 interfaces/types/enums/GUIDs, and corrects the bugs in mDirectX.bas.
PLEASE NOTE: ADDON MODULES NOW DISTRIBUTED SEPARATELY.
Download oleexp-modules.zip for mIID.bas, mPKEY.bas, mCoreAudio.bas, mWIC.bas, mDirectShow.bas, mPortableDevices.bas, and mDirectX.bas.
This is due to the attachment size limit now being exceeded if they're all in the same zip with oleexp.tlb.
By request of georgekar, an alternative version of IDispatch, IDispatchM2000, is available in oleexpimp.tlb (it's not Implements-compatible but MKTYPLIB doesn't let you put two interfaces with the same GUID in one TLB).
These changes have also been applied to tbShellLib v3.0.10.
Hi, fafalone.
Thanks for sharing this great type libray.
Currently, I'm trying to convert a source code for AeroWizards from C++ to VB6, but I'm facing some issues here. Some members of PROPSHEETPAGE, like hblWatermark, pszHeaderTitle, pszHeaderSubTitle, are missing from your type library. Some Type also seems to be missing, like PROPSHEETHEADER.
I don't know if it would cause error if I keep going without these stuff, so I'm putting a hold on it. Could you add them in the future update? I'll gladly help you if you need it.
Have a great day. Thank you.
With a UDT, you don't strictly have to use the TLB version, you can declare alternates locally because vb6 support declaring UDTs (and api calls).
But the situation here is the PROPSHEETPAGE in oleexp dates from the Win2k/XP-era original olelib this project was forked from, and the members you mentioned were only added in Windows Vista. I actually added the more recent versions to tbShellLib, but it looks like I didn't also add them to oleexp. I'll put them in the next version, along with the header.
In the mean time you can add them to your project in VB6:
Then use them with these local APIs instead of the TLB-defined APIs (which are currently hard-coded for the original):Code:Public Type PROPSHEETPAGE_V2
dwSize As Long
dwFlags As PSP_FLAGS
hInstance As LongPtr
pResource As LongPtr
hIcon As LongPtr
pszTitle As LongPtr
pfnDlgProc As LongPtr
lParam As LongPtr
pfnCallback As LongPtr
pcRefParent As LongPtr
pszHeaderTitle As LongPtr
pszHeaderSubTitle As LongPtr
End Type
Public Type PROPSHEETPAGE_V3
dwSize As Long
dwFlags As PSP_FLAGS
hInstance As LongPtr
pResource As LongPtr
hIcon As LongPtr
pszTitle As LongPtr
pfnDlgProc As LongPtr
lParam As LongPtr
pfnCallback As LongPtr
pcRefParent As LongPtr
pszHeaderTitle As LongPtr
pszHeaderSubTitle As LongPtr
hActCtx As LongPtr
End Type
Public Type PROPSHEETPAGE_V4
dwSize As Long
dwFlags As PSP_FLAGS
hInstance As LongPtr
pResource As LongPtr
hIcon As LongPtr
pszTitle As LongPtr
pfnDlgProc As LongPtr
lParam As LongPtr
pfnCallback As LongPtr
pcRefParent As LongPtr
pszHeaderTitle As LongPtr
pszHeaderSubTitle As LongPtr
hActCtx As LongPtr
bmHeader As LongPtr
End Type
Public Type PROPSHEETHEADER
dwSize As Long
dwFlags as PropSheetHeaderFlags
hwndParent as LongPtr
hInstance as LongPtr
hIcon as LongPtr
pszCaption as LongPtr
nPages as Long
nStartPage as LongPtr
ppsp as LongPtr
End Type
public Type PROPSHEETHEADER_V2
dwSize as Long
dwFlags as PropSheetHeaderFlags
hwndParent as LongPtr
hInstance as LongPtr
hIcon as LongPtr
pszCaption as LongPtr
nPages as Long
nStartPage as LongPtr
ppsp as LongPtr
hbmWatermark as LongPtr
hplWatermark as LongPtr
hbmHeader as LongPtr
End Type
Public Enum PropSheetHeaderFlags
PSH_DEFAULT = &H00000000
PSH_PROPTITLE = &H00000001
PSH_USEHICON = &H00000002
PSH_USEICONID = &H00000004
PSH_PROPSHEETPAGE = &H00000008
PSH_WIZARDHASFINISH = &H00000010
PSH_WIZARD = &H00000020
PSH_USEPSTARTPAGE = &H00000040
PSH_NOAPPLYNOW = &H00000080
PSH_USECALLBACK = &H00000100
PSH_HASHELP = &H00000200
PSH_MODELESS = &H00000400
PSH_RTLREADING = &H00000800
PSH_WIZARDCONTEXTHELP = &H00001000
' ----- New flags for wizard97 -----------
PSH_WIZARD97 = &H01000000
PSH_WATERMARK = &H00008000&
PSH_USEHBMWATERMARK = &H00010000 ' user pass in a hbmWatermark instead of pszbmWatermark
PSH_USEHPLWATERMARK = &H00020000 '
PSH_STRETCHWATERMARK = &H00040000 ' stretchwatermark also applies for the header
PSH_HEADER = &H00080000&
PSH_USEHBMHEADER = &H00100000
PSH_USEPAGELANG = &H00200000 ' use frame dialog template matched to page
PSH_WIZARD_LITE = &H00400000
PSH_NOCONTEXTHELP = &H02000000
PSH_AEROWIZARD = &H00004000
PSH_RESIZABLE = &H04000000
PSH_HEADERBITMAP = &H08000000
PSH_NOMARGIN = &H10000000
End Enum
Code:Public Declare Function CreatePropertySheetPage Lib "comctl32" Alias "CreatePropertySheetPageA" (psp As Any) As Long
Public Declare Function CreatePropertySheetPageW Lib "comctl32" (psp As Any) As Long
Public Declare Function DestroyPropertySheetPage Lib "comctl32" (ByVal hPage As Long) As Long
Public Declare Function PropertySheet Lib "comctl32" Alias "PropertySheetA" (psh As Any) As Long
Public Declare Function PropertySheetW Lib "comctl32" (psh As Any) As Long
PS- There's an error I just found with PSN_QUERYINITIALFOCUS and PSN_TRANSLATEACCELERATOR; the correct values are:
Code:PSN_TRANSLATEACCELERATOR = (-212)
PSN_QUERYINITIALFOCUS = (-213)
FYI, I couldn't get oleexp.StringFromGUID2 going. I just called StringFromGUID2 directly to get it going. Here's the code I couldn't make work:
Further FYI, it does return 39 (number of characters it "thinks" it returned, including null terminator) but it just returns spaces.Code:
Private Function GetStringGuid() As String
Dim uGuid As oleexp.UUID
oleexp.CoCreateGuid uGuid
GetStringGuid = Space$(38&)
Call oleexp.StringFromGUID2(uGuid, ByVal StrPtr(GetStringGuid), 39&)
GetStringGuid = Mid$(GetStringGuid, 2&, 36&)
End Function
If I declare the following ...
... and then remove the "oleexp." from the call, all works fine.Code:
Private Declare Function StringFromGUID2 Lib "ole32" (g As Any, ByVal lpsz As Long, ByVal cchMax As Long) As Long
Yeah I've had trouble with that too...
I'll just change it to Long for the next release, since VB obviously has some issue with the LPWSTR argument (even though it's used elsewhere and works).Code:[entry("StringFromGUID2")]
LONG StringFromGUID2(
[in] UUID *UUID,
[in, out] LPWSTR lplpsz,
[in] LONG cbMax);
I actually had trouble with the VB6 declares too, and wound up writing my own routine for it:
Code:Private Function GUIDToString(tg As UUID, Optional bBrack As Boolean = True) As String
'StringFromGUID2 never works, even "working" code from vbaccelerator AND MSDN
GUIDToString = Right$("00000000" & Hex$(tg.Data1), 8) & "-" & Right$("0000" & Hex$(tg.Data2), 4) & "-" & Right$("0000" & Hex$(tg.Data3), 4) & _
"-" & Right$("00" & Hex$(CLng(tg.Data4(0))), 2) & Right$("00" & Hex$(CLng(tg.Data4(1))), 2) & "-" & Right$("00" & Hex$(CLng(tg.Data4(2))), 2) & _
Right$("00" & Hex$(CLng(tg.Data4(3))), 2) & Right$("00" & Hex$(CLng(tg.Data4(4))), 2) & Right$("00" & Hex$(CLng(tg.Data4(5))), 2) & _
Right$("00" & Hex$(CLng(tg.Data4(6))), 2) & Right$("00" & Hex$(CLng(tg.Data4(7))), 2)
If bBrack Then GUIDToString = "{" & GUIDToString & "}"
End Function
Thanks for the help.
There's still some things missing, but I want to focus on converting the thing I'm working on. And, oh, I'm looking forward to the next update.
Have a great day. Thank you.
To be honest, I feet like I should say more, but I don't know what to say... Sorry.
What's missing? I went through the SDK headers for the propsheet stuff, I think I got it all. Or do you mean other things? If it's interfaces needed I definitely want to know; but it's not meant to be a comprehensive api set; the apis are only for things directly related to the interfaces since they can be declared in VB (and interfaces can't).
Major Update - oleexp Version 6.0
This version of oleexp adds the full set of Microsoft Speech APIs v5.4 (both automation and standard interface sets), and the full set of WebView2 interfaces, for those who'd like to pursue their own wrappers. Also included fixes for the issues mentioned above with missing PROPSHEET UDTs and StringFromGUID2 not working, and some miscellaneous interfaces.
These features have also been added to tbShellLib for twinBASIC.
Full changelog:
(oleexp 6.0 - Released 26 February 2023)
- Added WebView2 interfaces/types/enums.
- Added Microsoft Speech APIs Version 5.4
- Added IHttpNegotiate3, IObjectProvider, IEnumObjects, and IIOCancelInformation interfaces.
- Added Vista+ PROPSHEETPAGE and PROPSHEETHEADER versions of these structs (use PROPSHEETPAGE_V4 and PROPSHEETHEADER_V2 on Vista+) and PropSheet/PropSheetW APIs. Also corrected wrong values for PSN_TRANSLATEACCELERATOR/PSN_QUERYINITIALFOCUS.
- (Bug fix) StringFromGUID2 now uses a Long instead of LPWSTR since the latter was not working.
Also please take note of the different file structure of the zips-- I had to rearrange things because of the attachment size limit again. oleexp60.zip contains only oleexp.tlb; oleexpimp.tlb and history.txt are now in oleexp60-2.zip along with all the addon modules (including a new mSpeech.bas for the Speech APIs).
Edit: Forgot to add, there's a few WebView2 interfaces with members documented as Property Get/Let that have been changed to regular functions and renamed. This is because the Get returns a UDT ByRef, but the Let expects it ByVal, which VB6 doesn't support, so it had to be rewritten to pass the members individually, and MKTYPLIB doesn't support having different arguments for same-named Get/Let combos.
These are:
ICoreWebView2Controller::Bounds->get_Bounds() As RECT, put_Bounds(left, top, right, bottom)
ICoreWebView2PointerInfo::PointerDeviceRect->get_PointerDeviceRect() As RECT, put_PointerDeviceRect(left, top, right, bottom)
ICoreWebView2PointerInfo::DisplayRect->get_DisplayRect() As RECT, put_DisplayRect(left, top, right, bottom)
ICoreWebView2PointerInfo::PixelLocation->get_PixelLocation() As POINT, put_PixelLocation(x, y)
ICoreWebView2PointerInfo::HimetricLocation->get_HimetricLocation() As POINT, put_HimetricLocation(x, y)
ICoreWebView2PointerInfo::PixelLocationRaw->get_PixelLocationRaw() As POINT, put_PixelLocationRaw(x, y)
ICoreWebView2PointerInfo::HimetricLocationRaw->get_HimetricLocationRaw() As POINT, put_HimetricLocationRaw(x, y)
ICoreWebView2PointerInfo::TouchContact->get_TouchContact() As RECT, put_TouchContact(left, top, right, bottom)
ICoreWebView2PointerInfo::TouchContactRaw->get_TouchContactRaw() As RECT, put_TouchContactRaw(left, top, right, bottom)
Hi Fafalone, I am looking at the possibility of moving from d2dvb.tlb to oleexp.tlb, D2DVB is excellent and very comfortable, but I am not sure if TheTrick will continue to update it, I do not know if you have thought at some point to implement the d2D1EFFECTS , try through My part of TLB but all my attempts were in vain (**** Midl **** Mktyplib). Frank Schüler gave me an excellent example of D2D1Effects no TLB, but I couldn't agree with d2DVB.TLB
Well my first question because I am mistake 13 in this
'Oleexp v5.6
Code:Option Explicit
Private Declare Function GetMem8 Lib "msvbvm60" (ByRef pSrc As Any, ByRef pDst As Any) As Long
Dim cFactory As ID2D1Factory
Private Sub Form_Load()
Set cFactory = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, IID_IDWriteFactory)
End Sub
Private Function IID_IDWriteFactory() As UUID
GetMem8 543017151384793.4554@, IID_IDWriteFactory
GetMem8 524995195940339.1138@, ByVal VarPtr(IID_IDWriteFactory) + 8
End Function
ID2D1Effect is present... I believe I got all of the Direct2D interfaces, if one is missing let me know. I started by merging The trick's tlb, so for what was in that the syntax should be identical except I had to remove optional attribs since mktyplib doesn't allow them.
oh perfect I had not seen it!
I have a question, I'm having problems in this line, vb6 crash
Set cMemTarget = cFactory.CreateWicBitmapRenderTarget(cWICBitmap, tRTP)
looking and comparing both tlb there is an extra * in the first parameter (target).
I tried passing it varptr(cWICBitmap) or byval varptr(cWICBitmap) , but no resultCode:D2DVB.tlb
HRESULT _stdcall CreateWicBitmapRenderTarget(
[in] void target,
[in] D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
[out, retval] ID2D1RenderTarget** renderTarget);
oleexp.tlb
HRESULT _stdcall CreateWicBitmapRenderTarget(
[in] void* target,
[in] D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
[out, retval] ID2D1RenderTarget** renderTarget);
I believe since it's an object you should jut pass cWICBitmap or ByVal ObjPtr(cWICBitmap).
Does this line work with the other TLB?
uff if you are right, I had tried with objptr but surely I missed the byval.
I've finished exporting all the functions and everything is working ok, now I'm going to play with the effects. Thank you!!
Sorry for the twists and turns, I just realized that the font is not taking me (CreateTextFormat), I have already tried different ways but I do not have the correct result, the FontFamillyName parameter is vbLong, so I am passing strptr(sName) , one way to check it is with GetFontFamilyNameLength which if I pass as Font "Arial" should return 5 but any font that I pass always returns 2 (or 4 in case I am passing a pointer stored in a long variable)
The last parameter LocaleName also has an error if I pass any value, but well, this doesn't seem to be necessary to call it.Code:Option Explicit
Private Declare Function GetMem8 Lib "msvbvm60" (ByRef pSrc As Any, ByRef pDst As Any) As Long
Dim cDWFactory As IDWriteFactory
Dim cTextFormat As IDWriteTextFormat
Private Sub Form_Load()
Set cDWFactory = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, IID_IDWriteFactory)
Dim sFontName As String '* 32
Dim ptr As Long
sFontName = "Arial"
'ptr = StrPtr(sFontName)
Set cTextFormat = cDWFactory.CreateTextFormat(StrPtr(sFontName), Nothing, _
DWRITE_FONT_WEIGHT_NORMAL, _
DWRITE_FONT_STYLE_NORMAL, _
DWRITE_FONT_STRETCH_NORMAL, _
Me.FontSize * 96# / 72#, 0&)
MsgBox cTextFormat.GetFontFamilyNameLength '& vbCrLf & Len(sFontName)
End Sub
Public Function IID_IDWriteFactory() As UUID
GetMem8 543017151384793.4554@, IID_IDWriteFactory
GetMem8 524995195940339.1138@, ByVal VarPtr(IID_IDWriteFactory) + 8
End Function
sFontName should not be a string but an array of integers (0 to 31). Then you would use "lstrcpy" to write the Font Name:
Then try passing VarPtr(sFaceName(0)) to cDWFactory.CreateTextFormat and see how it goes.Code:Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyW" (ByVal pszDst As Long, ByVal pszSrc As String) As Long
Dim sFontName(0 to 31) as Integer
lstrcpy VarPtr(sFaceName(0)), "Arial"
No, it does not work. :/
Code:Dim sFaceName(0 To 31) As Byte
lstrcpy VarPtr(sFaceName(0)), "Arial"
Set cTextFormat = cDWFactory.CreateTextFormat(VarPtr(sFaceName(0)), Nothing, _
DWRITE_FONT_WEIGHT_NORMAL, _
DWRITE_FONT_STYLE_NORMAL, _
DWRITE_FONT_STRETCH_NORMAL, _
Me.FontSize * 96# / 72#, 0&)
MsgBox cTextFormat.GetFontFamilyNameLength
LeandroA, do my examples work?
Code:' // DirectWrite basic drawing example
Option Explicit
Dim cD2dFactory As ID2D1Factory
Dim cDWFactory As IDWriteFactory
Dim cTarget As ID2D1HwndRenderTarget
Dim cTextFormat As IDWriteTextFormat
Dim cBrush As ID2D1Brush
Private Sub Form_Load()
Set cD2dFactory = D2D1.CreateFactory
Set cTarget = cD2dFactory.CreateHwndRenderTarget(D2D1.RenderTargetProperties( _
D2D1.PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM)), _
D2D1.HwndRenderTargetProperties(Me.hWnd, D2D1.SizeU))
Set cDWFactory = DW.CreateFactory(DWRITE_FACTORY_TYPE_SHARED)
' // Create text format
Set cTextFormat = cDWFactory.CreateTextFormat("Arial", Nothing, DWRITE_FONT_WEIGHT_NORMAL, _
DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, _
19# * 96# / 72#, "en-US")
' // Color brush
Set cBrush = cTarget.CreateSolidColorBrush(D2D1.ColorF(Red), ByVal 0&)
End Sub
Private Sub Form_Paint()
Dim sText As String
sText = "Hello World!"
cTarget.BeginDraw
cTarget.Clear D2D1.ColorF(Ivory)
cTarget.DrawText sText, Len(sText), ByVal cTextFormat, D2D1.RectF(20, 20, 220, 120), cBrush
cTarget.EndDraw ByVal 0&, ByVal 0&
End Sub
Private Sub Form_Resize()
cTarget.Resize D2D1.SizeU(Me.ScaleWidth, Me.ScaleHeight)
End Sub
If you need something about d2dvb.tlb or dwvb.tlb you can write to the related thread.Code:' // Create WIC bitmap that is saved to file
Set cBitmap = cWicFactory.CreateBitmap(Me.ScaleWidth, Me.ScaleHeight, _
WIC.GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnLoad)
' // Create render target based on that image
Set cBitmapSurf = cFactory.CreateWicBitmapRenderTarget(cBitmap, D2D1.RenderTargetProperties( _
D2D1.PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED), _
D2D1_RENDER_TARGET_TYPE_SOFTWARE, 96, 96, D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE))
DrawButtons cBitmapSurf
Hi TheTrick, d2dvb.tlb and dwvb.tlb works correctly, but as I mentioned above I'm migrating to oleexp.tlb, because I want to use ID2D1Effect , the problem I'm in now is the CreateTextFormat function (Oleexp), its parameters are not vbstrings but vblong and not I manage to make it work
Hmm looks like I might have the declare incorrect. If VB lets you, ByVal StrPtr for now, I'll fix in next version.
Original is
_In_z_ WCHAR const* fontFamilyName,
so should be [in] long instead of [in, out] long*
It was a massive project so I used some automated code formatting, must have missed that in manual review.
Edit: Attached is a test version where that (and all other DWrite instances of [in, out] long* where it's _In_z_ WCHAR const*) is now [in] long (ByVal Long) which should work with just StrPtr.
Have you declared "lstrcpy" with Alias "lstrcpyW"? The declaration already present in "oleexp" is the ANSI version "lstrcpyA" which is no good... I was hoping it would be the same as the ".szFaceName" member of the "CHARFORMAT2" type which is an array of integers and I got it working correctly with "lstrcpy".
Sorry about that, looks like one of the saves didn't take and the * was still there when I reloaded it. It's definitely gone from this one, double checked in oleview.
Normally you don't need QI directly; the VB Set statement is a wrapper for it, so
is the same as calling de.QueryInterface(IID_ID2D1RenderTarget, rt)Code:Dim rt As ID2D1RenderTarget
Dim de As ID2D1Effect
Set rt = de
That said, if you still want to, the way to do it is first cast to the unrestricted IUnknown in oleexp:
Code:Dim pUnk As oleexp.IUnknown
Dim hr As Long
Set pUnk = de
hr = pUnk.QueryInterface(...)
Project Updated - Version 6.1
Since the bugs discussed above are fairly significant, I wanted to update the full version now (especially since if you want to use oleexpimp.tlb it needs to be compiled against the current oleexp.tlb to avoid error 32810). This version contains the DirectWrite string interface bugfixes, a bug fix for INameSpaceTreeControlEvents that should hopefully help with right-click crashes, and the Vista+ TrayBand/DeskBand interfaces and coclasses that were inexplicably missing.
Full changelog:
(oleexp 6.1 - Released 02 March 2023)
- Added ITrayBand, IDeskBand2, IDeskBandInfo, IBandHost, and IBandSite interfaces, IMenuBand, and coclasses TrayDeskBand, TrayBandSiteServices
- Added IRegTreeItem interface
- Added IPrintDialogCallback/IPrintDialogServices interfaces.
- Bug fix: Certain DirectWrite interface members had ByRef Long for strings where they should have had ByVal.
- Bug fix: SHELLSTATE had an extra member on the end (shouldn't have impacted use, but if MS changed the API to look for an exact size it would be an issue).
- Bug fix: Attempted to correct INameSpaceTreeControlEvents context menu crashing.
These changes have also been made to tbShellLib as of v3.3.41.
NOTE: The file with INameSpaceTreeControl changes didn't save properly, so if you were among the first 3 people to download oleexp 6.1, before 11:50PM Eastern US time, you'll need to redownload to get those changes. Sorry, something is wrong with my VS install where it's indicating the file was saved and removing the *, only for the changes to be gone when reloaded or checked.
does it support webview2?
what's webview2 tlb for vb6?
It contains all of the COM interface definitions, Enums, and initialization APIs for WebView2.
It's for if you want to build your own implementation of it like Olaf did in RC6; it's not an implementation itself.
For an example of using these interfaces directly, twinBASIC has a WebView2 implementation using the interfaces directly (but not tbShellLib-based so expanding it would require extra steps since it doesn't contain every interface). New project->Samples->Sample 0 or Sample 9.
anyone translate oleexp.tlb to 64bit?
For VBA or for twinBASIC?
For twinBASIC, yes. tbShellLib contains all interfaces/APIs/etc from oleexp, compatible with 64bit. There's only a few small adjustments for a small number of differences (run replace-alls for changing oleexp.IUnknown with IUnknownUnrestricted, replacing several public aliases as tB doesn't yet have those, then delete all instances of 'oleexp.'; then a small percentage of APIs need return values moved back to being the last argument instead, as some legacy olelib APIs were rewritten to change a final [out] to [out, retval], a language feature not supported by VBx/tB Declare syntax).
For VBA, I'm waiting for twinBASIC to support exporting tbShellLib as a .TLB (a planned feature). It's not possible to compile a project like oleexp with midl, as midl force-includes some low level types and COM interfaces and refuses to allow you to replace them with vb6-compatible versions; I've spent a couple dozen hours trying to work around that with no success. oleexp is compiled with MKTYPLIB, which does not support targeting x64. Alternatives would have been far, far too much work.
Project Updated - Version 6.2
While I noted in another thread I won't be bringing expanded API sets to oleexp (unless someone writes a converter from VBA7->MKTYPLIB-compat IDL or wants to contribute)-- I am adding them to tbShellLib, which will eventually replace oleexp when twinBASIC supports exporting TLBs; I'm still maintaining all the same interfaces between the two. This update adds tons of new stuff over hundreds of interfaces:
(oleexp 6.2 - Released 01 April 2023)
- Added accessibility UI Automation interfaces and APIs.
NOTE: This API had a number of *very* generically named enums, like FillMode and ToggleState; these have been prefixed with Uia_ to avoid conflicts. In most cases, the actual members were left alone, with the exception of LiveSetting (renamed Uia_LiveSetting), which had Off, Polite, and Assertive; these have been prefixed with Uia_ as well.
NOTE: IUIAutomationAndCondition and IUIAutomationOrCondition have members that return a SAFEARRAY of IUIAutomationCondition... MKTYPLIB does not support this so these return a pointer you'll need to dereference.- Completed Media Foundation interfaces up through the most recent Windows 11 SDK. This includes the capture engine and other entirely new feature sets.
- Added CoreAudio Spatial Audio interfaces (newer Win10 versions/Win11 only)
- Added IActiveScript and all related ActiveX Script Host / Engine interfaces.
- Added IPinnedList (Vista), IPinnedList2 (7 < Win10 1809), IPinnedList3 (>= Win10 1809), and coclass TaskBandPin. Added IStartMenuPin. Don't abuse these-- always ask user permission to pin.
- Added ITrayNotify and INotificationCB, coclass TrayNotify
- Added coclass TaskBand
- Added IHandlerInfo2, IDeskBar, IDeskBarClient amd IShellFolderBand
- Added IHostDialogHelper, coclass HostDialogHelper
- Added IFileSearchBand, coclass FileSearchBand
- Added IPropertyPage[2] and IPropertyPageSite interfaces.
- Added ISimpleFrameSite interface
- Added IDispatchEx interface and related interfaces IDispError, IVariantChangeType, IProvideRuntimeContext, IObjectIdentity, and ICanHandleException
- Added misc. interfaces ICurrentWorkingDirectory, IPropertyKeyStore, ISortColumnArray, IBannerNotificationHandler, IDelayedPropertyStoreFactory, IStorageProviderCopyHook, IDesktopGadget/Coclass DesktopGadget, IQueryCodePage, IStreamUnbufferedInfo, IUserAccountChangeCallback, IOpenSearchSource (with Implements- version in oleexpimp), IDestinationStreamFactory, ICreateProcessInputs, and ICreatingProcess.
- (mIID) Added EP_* GUIDs for IExplorerPaneVisibility
- (mIID) Added some missing SID_ guids.
- Bug fix: AUDCLNT_RETURNCODES were all incorrect.
Most of this was already in tbShellLib, what wasn't is now.
There's a bug in the declaration of "D3D11CreateDevice":
VBD3D11 is another TypeLib for D3D11 by wqwetoCode:Dim lRet As Long, pID3D11Device As Long, pID3D11DeviceContext As Long, objID3D11Device As ID3D11Device, objID3D11DeviceContext As ID3D11DeviceContext
lRet = oleexp.D3D11CreateDevice(Nothing, D3D_DRIVER_TYPE_HARDWARE, 0&, D3D11_CREATE_DEVICE_BGRA_SUPPORT, 0&, 0&, D3D11_SDK_VERSION, objID3D11Device, 0&, objID3D11Device)
' returns error "887A0004"
Private Declare Function D3D11CreateDevice Lib "D3D11.dll" (ByVal pAdapter As Long, ByVal DriverType As Long, ByVal Software As Long, ByVal flags As Long, ByVal pfeatureLevels As Long, ByVal featureLevels As Long, ByVal SDKVersion As Long, ByRef ppDevice As Long, ByRef pFeatureLevel As Long, ByRef ppImmediateContext As Long) As Long
lRet = D3D11CreateDevice(0&, D3D_DRIVER_TYPE_HARDWARE, 0&, D3D11_CREATE_DEVICE_BGRA_SUPPORT, 0&, 0&, D3D11_SDK_VERSION, pID3D11Device, 0&, pID3D11DeviceContext)
' returns zero (S_OK)
lRet = VBD3D11.D3D11CreateDevice(Nothing, D3D_DRIVER_TYPE_HARDWARE, 0&, D3D11_CREATE_DEVICE_BGRA_SUPPORT, ByVal 0&, 0&, D3D11_SDK_VERSION, objID3D11Device, 0&, objID3D11DeviceContext)
' also returns zero (S_OK)
It seems that the "pFeatureLevels" parameter needs to be declared either as "ByVal Long" (as in the manual Declare above) or as "Any" (as in wqweto's TypeLib). Yours is declared as an "Enum" and you can't put "ByVal" in front of it (Type mismatch).
That's weird... I would have thought if FeatureLevels (the number of elements in pFeatureLevels) was 0, it wouldn't attempt to read it.
It's specified in the documentation, if it's zero then it's a combination of ALL features put together.
The next parameter is supposed to be a count of the elements you passed... If that's 0, why wouldn't you expect it to treat it as null/invalid?
Anyway, it will be As Any in the next update. Since it's an API declare it's interchangeable with locally defined ones.
While you're at it could you please add SHCreateMemStream as well? CreateStreamOnHGlobal is already included but SHCreateMemStream is so much better for creating streams! "shlwapi.dll" has many useful APIs that would make a great addition to oleexp...
Sure, I'll add it.
I wasn't really planning on doing a large expansion of the included APIs though as oleexp's days are numbered... once twinBASIC supports exporting to .tlb, I'll only be updating the tbShellLib codebase as it will allow a single source for VB6, VBA7 32/64bit, and tB 32/64bit. If you (or anyone) wanted to create an automated tool that could take VB API declare syntax and convert it to IDL syntax, then it would just be a few minutes instead of weeks of work and it would be a different story; at least for the APIs I've added to tbShellLib (I didn't have SHCreateMemStream until today but I have added a whole lot of others on top of what was in oleexp-- including all of gdip... there's about 2800 now, compared to 1000 in oleexp). I already have them grouped by DLL, so there wouldn't be a need to sort them.
Just e.g.
Typedefs and enums are more straightforward.Code:Public DeclareWide PtrSafe Function SHCreateMemStream Lib "shlwapi" (pInit As Any, ByVal cbInit As Long) As IStream
[entry("SHCreateMemStream")]
IStream** SHCreateMemStream([in] LPVOID pInit, [in] ULONG cbInit);
There's a few less obvious things; like ByRef interfaces must be [out] IFoo**, ByVal must be [in] IFoo*.. but As Any can only be void*; and the VB declares don't consistently use ByRef explicitly or implicitly.
I think I should really jump on this TwinBasic bandwagon and see what the hype is all about... It does sound like a preferable alternative to .NET!
Hello, I was seeing that Oleexp has ICoreWebView2, is there any example of use? Could the same be done with cWebView2 from RC6.dll?
thank!
@LeandroA
RC6 contains an implementation of WebView2... the interface definitions in oleexp are what you would need to create your own wrapper like RC6 does.
There are examples of using these interfaces directly-- twinBASIC has 2 built in WebView samples that create a browser directly from these low level interfaces. You could substitue the oleexp ones to create a VB6 port (and tbShellLib for tB has a complete set as well, the built in tB demos only have a minimal set to support the examples).
@VanGoghGaming
You really should check it out. I was surprised too at just how very far along it was after so many empty promises and projects that went nowhere fast. It can't run 100% of VB6 code yet, but it's getting awfully close. It even runs complex Active-X controls... I've made 64bit versions of my ucShellTree and ucShellBrowse control that can be used in tB like a VB .ctl, or compiled to an ocx and used in 64bit Office and .NET (and to a 32bit OCX to use in VB6).
On top of support VBA7 64bit syntax and all VB6 syntax, it's got tons of new features *right now*... not planned, but already implemented, I've been making a list, since the www site is very, very out of date:
- LongPtr data type (4 bytes on 32bit, 8 on 64bit)
- LongLong data type, available in both 32bit and 64bit (VBA LongLong is only available in 64bit Office)
- True Decimal data type instead of just inside a Variant.
- All the standard accessories for the new data types, e.g. DefDec/DefLngLng/DefLongPtr, CDec/CLngLng/CLongPtr, and vbDecimal/vbLongLong/vbLongPtr constants for type checking.
- Define interfaces and coclasses in language
- Implements allowed on inherited interfaces-- e.g. you can just implement IShellFolder2, and provide all the methods for IShellFolder, and tB will automatically respond to QI for IShellFolder *and* IShellFolder2.
- If you have an interface multiple others extend from, you can write multiple implementations, or specify one implementation for all: e.g. IOleWindow_GetWindow() As LongPtr Implements IOleWindow.GetWindow, IShellBrowser.GetWindow, IShellView2.GetWindow
- Implements allowed on interfaces with 'As Any' parameters-- you can substitute LongPtr.
- Implements Via to extend classes
- vbNullPtr allows passing null pointers to UDT members of APIs/interfaces (in VB6 you'd have to declare them As Any and then could pass ByVal 0)
- Short-circuit conditional operators OrElse and AndAlso
- Support for modern image formats
- Transparency on forms
- Bitshift operators << and >>
- New assignment operators: += -= /= *= ^= &= <<= >>=
- Thread safety/multithreading support-- no native language syntax yet (planned), but you can call CreateThread directly with no hacks
- Ability to define custom packing for UDTs with [ PackingAlignment(n) ] attribute
- AddressOf can be used on class/form/UC members, including from outside the class by specifying the instance. Also, no need for FARPROC-type functions, you can use it like Ptr = AddressOf Func
- Overloading, both with type of argument and number of arguments
- Generics
- DeclareWide to disable Unicode-ANSI conversion on API declares
- CDecl support for API calls (though The trick has a patch for VB6 that adds this)
- Continue For, Continue While, Continue Do, Exit While
- Return syntax for functions
- Err.LastHResult and Err.ReturnHResult to get/set COM interface hresults
- Parameterized class constructors
- [ Description("text") ] attribute for APIs, UDTs , and Consts that are shown in popups when you hover over uses of them
- Built in support for making standard DLLs with simple [ DllExport ] attribute
- Built in support for making kernel-mode drivers
- Built in support for overriding entry point
- Option to put all API declares in the import table rather than runtime calls like VB6 (VB6 puts TLB-declared APIs in the import table; tB replicates this too but further provides an option for in-project declares).
- Built in support to mark projects DEP-aware and LARGEADDRESSAWARE
- [ RunAfterBuild ] attribute-- you can specify a function that runs after your exe is built (there's App.LastBuildPath to know where it is if you're e.g. signing the exe)
- Register ActiveX builds to HKEY_LOCAL_MACHINE option
- Private/Public modifiers for modules and classes
- All tB-implemented controls support Unicode
- Detects stale/dangling pointers for strings, replacing them with warning symbols
- Warnings for likely-incorrect hex literals &H8000-&HFFFF and &H80000000-&HFFFFFFFF (these almost always should be e.g. &H8000& to avoid being interpreted as a negative Integer).
- tB-implemented controls all support x64 and are all dpi aware (Currently available ones: CommandButton, TextBox, ComboBox, CheckBox, OptionButton, Label, Frame, PictureBox, Line, Shape, VScrollBar, HScrollBar, Timer, DriveListBox, DirListBox, FileListBox, Image, TreeView, ProgressBar, DTPicker, MonthView, Slider, and UpDown. The Microsoft-provided OCXs for others will work but the x64 version of MSComCtl.ocx doesn't come with Windows and isn't legally redistributable-- but if you have Office 64bit, it works in tB).
- Form.DpiScaleX/Y properties
- Per-procedure [ IntegerOverflowChecks(False) ], [ FloatingPointErrorChecks(False) ] and [ ArrayBoundsChecks(False) ] attributes to disable those checks on performance-critical routines while leaving them generally in place.
- Constant function folding: You can specify a [ ConstantFoldable ] attribute for functions where when called with non-variable input, will be computed at compile time, rather than runtime. For example, a function to converted string literals to ANSI. The result would never change, so the resulting ANSI string is stored, rather than recomputing every run.
- Removal of limits on line continuations, procedure size, etc.
- Handles and Implements procedure syntax so you can use different names if you wish, for instance instead of Form_Load you can have Sub AppStart() Handles Form.Load
- IsNot operator
- CurrentComponentName CurrentProcedureName CurrentProjectName CurrentSourceFile and CurrentComponentCLSID variables; easily make boilerplate code like error handlers.
- Compiler warnings for common bad practices or likely oversights, with ability to set them to ignore or turn them into an error both project-wide and per-procedure with [ IgnoreWarnings(TB___)], [ EnforceWarnings(TB____) ], and [ EnforceErrors(TB____) ] attributes
- Customize COM initialization call used by hidden entry point (CoInitialize STA, CoInitializeEx MTA, OleInitialize STA)
- Built-in ability to make a console project rather than a GUI project with default Console class for reading/writing console IO and provided debug console.
- Form .MinWidth, .MinHeight, .MaxWidth, and .MaxHeight properties
- Control anchors-- control x/y/cx/cy can made relative, so they're automatically moved/resized with the Form.'
- Form.Opacity property for alpha blending
- Form.TopMost property
- TextBox.NumbersOnly
- PictureDpiScaling property for Forms/UCs/PB
- CodeLens allows running Subs in modules with no arguments right from the editor without starting the full program
- Internal functions like MsgBox now support Unicode
- IDE features long desired that VB6 lacks: Code folding (with ability to define Regions that can also be folded), sticky scroll, multiple modules/classes per file, Unicode support in editor/properties, info on hover, advanced info option for hover shows Len/LenB/alignment for UDTs and offsets for UDTs and interface methods, and the full inheritance chain for interfaces. Also History panel, parenthesis/bracket color matching, minimap, and Variables panel that dumps the values of ones in use by that procedure on break, controls with Visible=False are faded, Outline panel with control over what's outlined. Type library viewer shows the entire source in tB language syntax.
- Online package server for code packages that can contain any type of tB code-- modules, classes, etc. (They can be used offline too. Note: Ability to publish not yet added to IDE but still available via old VSCode plugin).
- Inline initialization of variables (e.g. Dim x As Long = 1)
- [ Unimplemented ] attribute for methods allows showing a compiler warning about it being unimplemented wherever it's called (you can upgrade it to error too).
- Can have module-level declares in between Subs/Functions instead of needing to all be above them (while often bad coding practice this is good for e.g. very simple 1-line macros directly related to declares).
- [ SetDllDirectory (True/False) ] attribute to allow an explicitly loaded DLL to load it's own dependencies from it's load path. Also has the effect of allowing searching the app path for the DLLs in the base app's declare statements (used per-declare).
- Support for block and inline comments with /* */ syntax, e.g. Sub Foo(bar As Long /* out */)
- [ TypeHint() ] attribute allows populating Intellisense with an enum for types other than Long.
And I guarantee I'm missing some (still-- I've been updating this post as I remember or am reminded about others). There's a whole bunch more planned, including unsigned types, aliases defined in language, inheritance, etc.
So there's *already* a lot of compelling reasons to use tB over VB6.
can oleexp.tlb make new IUnknown object?
and add some vtable
Code:.VTable(3) = GetAddress(AddressOf invoke)
.VTable(4) = GetAddress(AddressOf ExecuteScriptCompleted)
Code:Public Function InitializeDemonBlog(LE As DemonBlog) As IUnknown 'IDemonBlog
If m_pVTable = 0 Then
With m_VTable
.VTable(0) = GetAddress(AddressOf QueryInterface)
.VTable(1) = GetAddress(AddressOf AddRef)
.VTable(2) = GetAddress(AddressOf Release)
.VTable(3) = GetAddress(AddressOf ExecuteScriptCompleted)
m_pVTable = VarPtr(.VTable(0))
End With
End If
With LE
.pVTable = m_pVTable
CopyMemory InitializeDemonBlog, VarPtr(.pVTable), 4
End With
End Function
Implements WebView2.IUnknown
webview.tlb , WebView2.idl WebView2Loader.dll
from https://globalcdn.nuget.org/packages....1774.30.nupkg (rename as zip file)
maybe can't use vb6 class file for IUnknown
No idea what you're doing or how it relates to oleexp.
There is a problem with oleexp related to HRESULTs in callbacks, I'll get that fixed, and add active scripting, this week.
i make More new class by IUnknown with vtable.
if only one class,it's easy
if have 10 class,
Virtual table simulation class, create IUnknown object for WEBVIEW2 callback event
Different functions execute callbacks on different source objects.
Now I want to make the virtual VTABLE and IUnknown objects into simpler codes. A module can support dozens or hundreds of different class objects. It can also deal with the release. If the same callback comes from different objects, the THIS pointer should be different, but there will be no problem with the virtual pointer. I will test these.
I most want to turn the CLASS1 file of VB6 into an IUnknown object, but he has more than 5 and 8 interfaces by default, while IUnknown only has 3 interfaces, so this way is doomed to fail
i want to find easy way to create More IUnknown object for vc++ dll call back
[VB6] Creating/Using COM Interfaces without TLBs-VBForums
https://www.vbforums.com/showthread....s-without-TLBs
Project Update - Version 6.3
This version adds Active Scripting interfaces, Package Manager interfaces, completes Core Audio interfaces, and adds additional WebView2 interfaces to catch it up to the latest version. Also on the WebView2 front, removed use of HRESULT in interfaces used with Implements, which should take care of the errors with those. Also added UI Ribbon interfaces, completing a source file that had been hanging around the source folder unfinished for years, and some others.
Full changelog:
(oleexp 6.3 - Released 09 June 2023)
- Added active scripting interfaces (ActivScp.h)
- Completed Core Audio interfaces
- Added Package Manager interfaces from msopc.idl/coclass OpcFactory
- Added DirectComposition Presentation Manager interfaces.
- Added some missing base OLE/COM interfaces: IDataAdviseHolder, IOleAdviseHolder, IDropSourceNotify, IEnterpriseDropTarget, IContinue, IQuickActivate, IAdviseSinkEx, IPointerInactive, IOleUndoManager, IEnumOleUndoUnits, IOleParentUndoUnit, IOleUndoUnit, IViewObjectEx, IOleInPlaceSiteWindowless, IOleInPlaceSiteEx, IOleInPlaceObjectWindowless.
- ribbon.odl, UI Ribbon interfaces, had been sitting around in the source folder unfinished forever; it's now complete and added (source file renamed exp_ribbon.odl).
- Added IContextCallback interface with coclass ContextSwitcher.
- Added Disk Quota interfaces IDiskQuotaControl (with coclass DiskQuotaControl), IDiskQuotaUser, IDiskQuotaUserBatch, IEnumDiskQuotaUsers, and IDiskQuotaEvents.
- Added missing Direct2D DrawText option flag to enable color fonts (e.g. colored emojis).
- Updated WebView2 interfaces to version 1.0.1774.30
- (oleexpimp) Added IAdviseSink and IAdviseSinkEx.
- (Bug fix) VB6 did not play nice with Implements where one argument was an HRESULT.
- (Bug fix) D3D11CreateDevice pFeatureLevels now As Any to allow passing ByVal 0.
- (Bug fix) DirectComposition vtable ordering to correct undocumented vtable reversal.
All of these updates have already been added to tbShellLib.