Vb6 CallByNameEx


Author: Dave
Date: 11.27.25 - 7:08pm



So I am starting to integrate the new vb6 JS engine me and claude wrote, and I noticed that the COM handling was calling my method twice. VB6 callby name is deficient. You end up with crap like this:

If args.count = 0 Then
        Set resultObj = CallByName(comObj, methodName, VbGet)
    ElseIf args.count = 1 Then
        Set resultObj = CallByName(comObj, methodName, VbGet, vArgs(1))


If the method doesnt return an object, then you detect the error, and have to call it a second time trying to get a normal variant return value without the set keyword :(

But the method gets called twice!

Also you will notice you need to know the arg count and get a big block of if statements instead of just passing a variant array of args!

So...we fixed both of those problems with a CallByNameEx implemented in C.

Hairy! dim args(1) as variant and dim args() redim dont seem to be passed the same way. Anyway..I think its good time will tell!

Ill admit it, Id be toast without Claude on this one...




Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 16 + 71 = ? followed by the letter: X 



About Me
More Blogs
Main Site
Posts: (All)
2025 (6)
     js4vb vtComObj
     Vb6 CallByNameEx
     js4vb
     COM dynamic proxy
     go get lost
     Courier Regular Win11 Missing
2024 (3)
     VB6 JSON
     ffmpeg voodoo
     RegJump Vb
2023 ( 9 )
2022 ( 4 )
2021 ( 2 )
2020 ( 4 )
2019 ( 5 )
2018 ( 6 )
2017 ( 6 )
2016 ( 22 )
2015 ( 15 )
2014 ( 25 )
2013 ( 4 )
2012 ( 10 )
2011 ( 7 )
2010 ( 11 )
2009 ( 3 )