It's certainly possible but you'd have to prepare a typelibrary with the interfaces; I don't think anyone has done this yet (The trick has done Direct2D and DirectWrite).
The DirectX interfaces are defined in an *extremely* VB-unfriendly way, so creating a typelib is a fairly significant project. Even moreso in my case; it's taken 8 hours so far converting The trick's d2d/dw TLBs to MKTYPLIB-compatible syntax to merge them with oleexp (to reduce conflicts since they depend on oleexp).
In my opinion this method can be useful in beautiful and professional UI design, especially since this method has started in new windows. I heard and researched a little about it, considering that Trick is proficient in other languages such as C, I think he has experience in this case.
just to design some simple 3D effects (just for for show hide like as transitions) that I was following in the links below, I had to to use opengl while I had to work with layers and controls at the same time.
most of my questions in these few months have been about designing beautiful forms as layers and combined with beautiful effects,i still work on opengl
but if I can test this method, perhaps it is possible to design more professional user interfaces just for another chance.maybe a good result can be reached here
Last edited by Black_Storm; Feb 4th, 2023 at 11:42 PM.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
of what I know, the Trick is using windows 7.
DirectComposition need at least 8.1 to work.
sure u could have a check, if 8.1+ u enable it.
but if u want to make a program that works in windows 7 as well u should try another approach.
the direct2d that I use (a typelib the Trick created) is usable from windows 7
that means, not all features are there. some features where added in 8/10 and those dont work.
I asked about it and the Trick answered me that he is in W7.
maybe in the far future if we all move to windows 10 he will update it, but when he do, it could mean it will not work in windows 7 if anyone is still using it.
Hi. You don't necessarily need a TLB to work with COM interfaces. Almost all of my projects and examples (Direct2D/3D, WIC, MediaFoundation, WinRT, etc.) that work with COM interfaces do not use a TLB because there is either no TLB for VB6 or I don't feel like looking for a suitable TLB. I don't like waiting for someone to provide a TLB for it. I always use the DispCallFunc API. This may be very time-consuming and confusing for some, but so far, with a few exceptions, I've gotten everything to work with it.
Sure you can do it that way but it's far more complicated and time consuming than using a TLB, and the resulting code vastly more difficult to read/write.
Sure you can do it that way but it's far more complicated and time consuming than using a TLB, and the resulting code vastly more difficult to read/write.
That was good. I expected this answer. If I have some time, I'll take a look at how to create a TLB. Like I said, I've never used it before. So the answer is more in the direction of Black_Storm.
Well it's just a question of doing the tedious work of getting all the interfaces into a typelib, going through them to replace vb-incompatible types with compatible ones (i.e. you need to change all unsigned multibyte types to signed), then compiling. It's not difficult, just time consuming. The C++ examples you linked would be easy to port. Pretty ironic C/C++ is closer to VB6 than VB.NET.
It seems that you mean in such a situation that there is still no exe source code sample in VB, this is the only way to make tlb, did I understand your meaning correctly?
If yes, then now the question is how to make a TLB in VB, I have already searched this question in the forum and for example I saw this answer:
- Start VB6 Project.
- Under Project/Project1 Properties..., change it to an ActiveX DLL.
- Add a standard module and put a Sub Main in it.
- Add a Class1 module.
- Under Project/Project1 Properties... again, go to the "Components" tab and check "Remote Server Files".
- Compile the project.
- Voila, a Project1.tlb file appears.
Of course, I did a test, but still the TLB file was dependent on its own DLL and it didn't work without registering the DLL inside the project, in a better case, how can you make a TLB without depending on the compiled DLL? Inside VB and of course I did not find any project about TLB in VB.
Or I saw in Trick's portfolio that he is creating TLBs with like as C/C++ language, so I should use another language for this purpose?
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
u need to create the TLB
using notepad, u create a .ODL file
and after that u use MKTYPLIB.EXE to compile it into .TLB
and now u can reference it.
example of a ODL I created awhile ago:
Code:
[uuid(75BEEE99-1CD9-4E32-A749-3565C64E3F75)]
library OTHER
{
typedef unsigned char BYTE;
typedef struct _BLENDFUNCTION {
BYTE BlendOp;
BYTE BlendFlags;
BYTE SourceConstantAlpha;
BYTE AlphaFormat;
} BLENDFUNCTION; //, *PBLENDFUNCTION, *LPBLENDFUNCTION
typedef struct tagSAFEARRAY1D {
short cDims;
short fFeatures;
long cbElements;
long cLocks;
long pvData;
long cElements1D;
long lLbound1D;
} SAFEARRAY1D;
For something like this yes you're going to need to use IDL; vb6 creates typelibs as part of Active-X controls/DLLs, but VB6 lacks the syntax to precisely control what's in them, and it would be 1000x the effort for something like DirectComposition.
Look at a simple TLB for a start.
If you have Krool's VBCCR project, open the OLEGuids folder. OLEGuids.odl is the source file; it's plain text, open it in Notepad.
Then open up the SDK source files (e.g. OleIdl.idl) to see the differences... you'll see it's virtually identical, just some differences in types because VB6 doesn't support everything, and removal of a few attributes like pointer_default(unique) so it can be compiled with MKTYPLIB (which is something OLEGuids and oleexp have to worry about, but if you wanted to make a standalone typelib you could use the more modern midl so long as you weren't including low-level base COM/OLE interfaces and sticking to things like DirectComposition).
All the interfaces you define have to be inside the header:
Code:
[
uuid(5A2B9220-BF07-11E6-9598-0800200C9A66),
helpstring("OLE Guid and interface definitions"),
lcid(0x0),
version(1.0)
]
library OLEGuids
{
importlib("stdole2.tlb"); //All TLBs compiled with MKTYPLIB must have this; if you're compiling with midl it force-includes it and others no matter what. NO MATTER WHAT.
//interfaces go here
};
For the GUID inside the uuid attribute, you have to generate a new unique one for your project. Visual Studio comes with a utility called GUIDGEN.exe to do this.
If you're creating a larger typelib, you can split things into multiple files, and use #include, look at oleexp.odl in the oleexp.tlb source to see an example of this.
For compiling, you use the command line. For example oleexp has a batch file to compile, mkex4s.bat:
OLEGuids and oleexp are a good place to start; DirectX stuff isn't written so simple. There was no particular reason for Microsoft to obfuscate it so much... it has to get compiled down to the same thing... if I was more conspiracy minded I'd think it was for the exclusive purpose of making it harder to use in VB6...
After you understand the basics of typelibs better have a look at the sources for The trick's Direct2D and DirectWrite tlbs, which he attached to this post.
Edit: Looks like directcomp is in the same format as those, easiest way might be to add them to that.
Last edited by fafalone; Feb 7th, 2023 at 06:01 AM.
HRESULT SetClip(
[in, ref] const D2D_RECT_F & rect
);
Is it ByVal RECT or ByRef? Need to know because MKTYPLIB doesn't understand that syntax so won't automatically handle it (and I'd have to workaround a byval).
HRESULT SetClip(
[in, ref] const D2D_RECT_F & rect
);
Is it ByVal RECT or ByRef? Need to know because MKTYPLIB doesn't understand that syntax so won't automatically handle it (and I'd have to workaround a byval).
how to handle 2-d array? Normally for 2d even in a UDT doesn't it convert it to SAFEARRAY? It's showing it correctly in the object browser, i'll have to see if it's really a fixed regular array.
interface IDCompositionVisual : stdole.IUnknown
{
// Changes the value of OffsetX property
HRESULT SetOffsetX(
[in] float offsetX
);
// Animates the value of the OffsetX property.
HRESULT SetOffsetX(
[in] IDCompositionAnimation* animation
);
Is this actual overloading, i.e. they're at the same v-table offset, or they're different vtable entries and I can rename them? (MKTYPLIB errors with 'duplicate definition')
Last edited by fafalone; Feb 8th, 2023 at 12:10 AM.
Ok here's a test version of oleexp with DXGI and DirectComposition interfaces/structs/enums
It's also in tbShellLib if you want to try in twinBASIC... quicker and easier to edit issues as it's in VB-style syntax, e.g.
Code:
[ InterfaceId ("BB8A4953-2C99-4F5A-96F5-4819027FA3AC") ]
[ OleAutomation (False) ]
Interface IDCompositionSurface Extends stdole.IUnknown
Sub BeginDraw(ByRef updateRect As RECT, ByRef iid As UUID, ByRef updateObject As Any, ByRef updateOffset As POINT)
Sub EndDraw()
Sub SuspendDraw()
Sub ResumeDraw()
Sub Scroll(ByRef scrollRect As RECT, ByRef clipRect As RECT, ByVal offsetX As Long, ByVal offsetY As Long)
End Interface
and doesn't need outside compilation (also supports x64)
Last edited by fafalone; Feb 9th, 2023 at 02:44 PM.
Is this actual overloading, i.e. they're at the same v-table offset, or they're different vtable entries and I can rename them? (MKTYPLIB errors with 'duplicate definition')
Of course they have the different vTable offsets. You just can rename SetOffsetX, SetOffsetX_2
Ok here's a test version of oleexp with DXGI and DirectComposition interfaces/structs/enums
It's also in tbShellLib if you want to try in twinBASIC... quicker and easier to edit issues as it's in VB-style syntax, e.g.
Code:
[ InterfaceId ("BB8A4953-2C99-4F5A-96F5-4819027FA3AC") ]
[ OleAutomation (False) ]
Interface IDCompositionSurface Extends stdole.IUnknown
Sub BeginDraw(ByRef updateRect As RECT, ByRef iid As UUID, ByRef updateObject As Any, ByRef updateOffset As POINT)
Sub EndDraw()
Sub SuspendDraw()
Sub ResumeDraw()
Sub Scroll(ByRef scrollRect As RECT, ByRef clipRect As RECT, ByVal offsetX As Long, ByVal offsetY As Long)
End Interface
and doesn't need outside compilation (also supports x64)
Thanks, can you attach an example of using Direct Composition with the help of this library (tlb) that has been tested?
one question: considering that I have no experience in using Direct composition, does this library cover all the issues related to this discussion or is it currently being tested, which includes a limited number of functions and definitions and should Was it waiting for it to be more complete?
Of course, this topic can remain open because it seems that it can make better progress.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
Yeah im going to port the example with the layered child window, but it uses media foundation interfaces and I had basic ones but not the one it used, so I'm working on adding an expanded set. I'll finish that tonight but give me another day or two for the example because the latest version of tB can compile my ucShellBrowse control to work in 64bit VBA and .NET WinForms, I'll be busy playing with that tonight 😄
Well first the sample used some media foundation stuff I thought was already in oleexp, but it wasn't, so I finished adding all that.
Then today I found some Direct3D 11 interfaces in the sample, and while The trick has a D3D 9 typelib, there's no D3D 11 typelib for VB6, so the past couple days I've been working on that, but it takes time.
...if you're not satisfied with the speed I'm converting 10s of thousands of lines of headers to VB6-compatible typelib syntax in preparation for porting a sample, I'd be happy to make it my full time job and get it done much faster, my rate is $200/hr.
I was just waiting to see if you will prepare the usage sample according to the time you announced, but it seems not yet,its okay if need more time.
Of course, it should be noted that since the beginning of this thread, not a single sample has been prepared yet.i understand maybe because this is new in vb6 and new windows versions.
If you want to talk about the cost, even if I was willing to make the payment, but considering the conditions of the country and the sanctions, it was not easy, and this problem is not only for payments to communicate with any person outside the country, but this The problem has a long story and even to pay for any foreign site we have problems here.
Anyway, thanks for your time on this.
My question still remains here because this question has not yet had a practical example , we most talked about changes and how to design and etc.
I was hoping that more guys would work in this field and show interest, but it seems that either they haven't entered newer Windows yet, or they don't have experience working with it, so the work has been stopped.
If a practical example is not found, unfortunately, I have to change the topic as solved without results.
Last edited by Black_Storm; Feb 13th, 2023 at 01:09 AM.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
Then today I found some Direct3D 11 interfaces in the sample, and while The trick has a D3D 9 typelib, there's no D3D 11 typelib for VB6, so the past couple days I've been working on that, but it takes time.
Btw, I posted a link to DirectX 11 typelib above but please let OP add the missing interfaces. I’m not willing to support his demands for free labor too.
I also did not create this free thread with the aim of someone wanting to earn income from here , while someone like him (wqweto) wants to be hired somewhere to solve a problem , it is up to him.He has already received his answer and it is useless for him to repeat it.
It seemed that based on the thread he came and made some changes free and hinted and left. I hope it was useful for him too.
Of course, it has been found that it is useful in completing some libraries and improving them, and this is good.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
Yes I'm still planning to do the sample but can't promise a timeframe, it depends on what difficulties I run into.
cool,i understand,hope to get a result soon
I was sure that if the trick is entered, it will do great things as always, but it's a pity that according to Baka's previous tips, the trick is busy in Windows 7 (I'm not sure).
Last edited by Black_Storm; Feb 13th, 2023 at 08:34 PM.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
I also did not create this free thread with the aim of someone wanting to earn income from here , while someone like him (wqweto) wants to be hired somewhere to solve a problem , it is up to him.He has already received his answer and it is useless for him to repeat it.
To me it sounded more like if the free help was not respected or appreciated and demands for further help were made then free help is no longer appropriate because they are not slaves who can be ordered to work for free.
To me it sounded more like if the free help was not respected or appreciated and demands for further help were made then free help is no longer appropriate because they are not slaves who can be ordered to work for free.
Many of these are like that, there is no need for their help, they can go and show their help elsewhere, sometimes slaves are worth more than this.and of course, the value of money is sometimes more than such people
Originally Posted by georgekar
Mr wqweto share some of the best open source code for all of us and he is not deserve to handle him with the way Black_Storm did.
Like this person(miss wqweto,It is more like women than men) already got their answer and can go on sharing while laughing, not even worth talking to.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
This section was declared resolved so as not to continue with this stupid talk, anyone who is interested can follow this practical topic elsewhere, although I think that even now, if it has helped to expand the library It was useful (whether it was a related library of that slave) or those who worked on this discussion here like fafaolne, those working on new windows can follow this interesting and useful discussion elsewhere.
[ ... active on skype and discord ... ] ,[always strive to achieve your dreams] , [always try,dont stop,never say never]
So just to update... I finished adding Direct3d 11 and 12 to oleexp, started in on the dcomp demos, only to find a number of interface dependencies from Direct2D, and that The trick's library only covered about 25% of Direct2D, and it will take a few days to get through the remaining 10k or so lines of interfaces/structs/enums before I can get back to the demo. So this is the kind of unanticipated thing that delays it when I only have a few hours a day for all of my programming projects, of which this is just one. (And no, I'm not just going to take the bits I need for the demo, because unless you're paying me, I'm doing what interests me, which is having comprehensive coverage of this in oleexp so people who see the demos and want to go further have everything available).
Last edited by fafalone; Feb 15th, 2023 at 09:23 AM.
and verified the basic window creation; now I'm just adding detailed logging for when the first runs inevitably go wrong, and double/triple checking everything, since I'm not going to be able to run from the IDE.
I'm doing it in twinBASIC first since that has a feature that makes this easier-- it allows passing null pointers to UDT params in APIs, which is helpful because I had to remove all the "optional" tags since MKTYPLIB doesn't support it at all and neither VB nor TB supports Optional followed by non-Optional. I'm probably going to have to revise the oleexp.tlb defs to make the optional UDTs "As Any" so it's possible to pass a null pointer, the only workaround for this possible in VB6.
If you want to do the super-fun error correction/debugging yourself, I'm attaching the project I'm working on. Note you can run in a single thread by changing the startup object to Sub Main and modifying PostLog to not use the critical section, and commenting out the CoInitialize/CoUninitialize calls in RunDCompEffects; my plan is to eventually have multiple samples in the app each running in their own thread.
Last edited by fafalone; Mar 4th, 2023 at 04:19 AM.