Author Topic: Couple Api ideas for embedding  (Read 90105 times)

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #45 on: June 16, 2014, 07:59:44 PM »
Can you make it work with the current 2.2 version scriba.exe? Tom added a dozen math functions that were stubs in 2.1. There has also been a couple minor bug fixes as well. I really don't want to use 2.1 code knowing the grief I went through getting it resolved.


Great job on the video. You make things look so easy. I will have to play this again more than a couple times to grasp what is like opening a car door to you.  8)
« Last Edit: June 16, 2014, 08:13:29 PM by support »

dzzie

  • Guest
Re: Couple Api ideas for embedding
« Reply #46 on: June 17, 2014, 06:37:17 AM »
i found the 2.2 source, attached is the COM.dll compatible with v 2.2.

all I had to do is build against its header files instead of the 2.1 ones

I also diffed the headers, I didnt see anything immediately obvious as to why the structure pointer offsets
were changed, but in the debugger I could see they were which is why it was crashing.

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #47 on: June 17, 2014, 09:57:57 AM »
That solved the problem and it is working fine with Script BASIC 2.2 code base.

Theming would be sweet!



Code: [Select]
import com.inc

function Button1_Click(arg)
print "Back in script basic Button1_Click arg=", arg, "\n"
Button1_Click = arg + 1
end function

function Button2_Click(arg)
print "Back in script basic Button2_Click arg=", arg, "\n"
Button2_Click = arg * 2
end function

obj = CreateObject("VB6.Sample")

if obj = 0 then
    print "CreateObject failed!\n"
else
print "obj = ", obj, "\n"
       
oCollection = CallByName(obj, "CallBackHandlers", VbGet)
    print "oCollection = ", oCollection, "\n"
   
    CallByName(oCollection, "Add", VbMethod, ADDRESS(Button1_Click()), "frmCallBack.cmdOp1_Click" )
    CallByName(oCollection, "Add", VbMethod, ADDRESS(Button2_Click()), "frmCallBack.cmdOp2_Click" )
   
    retVal = CallByName(obj, "LaunchCallBackForm", vbMethod, 21)
    print "LaunchCallBackForm returned ", retVal, "\n"
   
    ReleaseObject(obj)
    print "test complete!\n"
end if

C:\SB22\sbcom\sbvb3>scriba COM_VB6_Callback_Example.sb
obj = 1414352
oCollection = 1414432
Back in script basic Button1_Click arg=21
Back in script basic Button2_Click arg=22
LaunchCallBackForm returned 44
test complete!

C:\SB22\sbcom\sbvb3>scriba -v
ScriptBasic v2.2
Variation >>Windows32<< build 2
Magic value 859001395
Node size is 16
Extension interface version is 11
Compilation: May  3 2014 21:45:37
Executable: C:\SB22\bin\scriba.exe

C:\SB22\sbcom\sbvb3>
« Last Edit: June 17, 2014, 02:50:52 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #48 on: June 17, 2014, 06:06:01 PM »
A bit of progress on the theming front. The new com.dll (SB ext. mod.) isn't hanging when using the scriba.exe.manifest or sbiup.exe (Windows SB + theming support version) but it isn't showing a window either. Returns immediately.


C:\SB22\sbcom\sbvb3>scriba COM_VB6_Callback_Example.sb
obj = 1479888
oCollection = 1479968
LaunchCallBackForm returned 0
test complete!

C:\SB22\sbcom\sbvb3>

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #49 on: June 17, 2014, 07:53:47 PM »
I was able to get your Script BASIC VB COM callback example running under Windows 7 64 bit.  I also installed Visual Studio 6 for my VB6 install on Windows 7.

Note: regsrv32 must be run as an admin to work.


« Last Edit: June 17, 2014, 11:32:34 PM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #50 on: June 17, 2014, 10:59:27 PM »
I was able to get VB themed with a manifest file on XP. It should work for Windows 7 but haven't tried it yet. Using the same manifest with scriba didn't display the form.  :'(

Here is the VB6.EXE.manifest you will need to get VB6 theme support on XP.

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    version="6.00.9782.0"
    processorArchitecture="X86"
    name="Visual Basic"
    type="win32"
    />
  <description>Microsoft Corporation VB6</description>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="X86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
             />
        </dependentAssembly>
    </dependency>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.GdiPlus"
                version="1.0.0.0"
                processorArchitecture="X86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
             />
        </dependentAssembly>
    </dependency>
<!-- Identify the application as DPI-aware: Vista and above -->
  <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
      <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
        <dpiAware>true</dpiAware>
      </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
« Last Edit: June 18, 2014, 11:22:52 AM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #51 on: June 18, 2014, 12:13:15 AM »
Here is what a VB6 application looks like themed on Windows 7.

CommonControls (Replacement of the MS common controls)



I will try to get VB6 theming working on Windows 7 64 bit tomorrow.
« Last Edit: June 18, 2014, 12:52:50 AM by support »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #52 on: June 18, 2014, 01:48:51 PM »
Poking around there seems to a focused effort on keeping VB Classic alive. I think it's great Dave is showing what the intent of VB was but never embraced. (building COM objects that can be used by other languages)

I'm still trying to get VB6 theming working on Windows 7 and will post something when I get it working. I think creating a current VB6 distributables zip would help this project out a lot. I need to revisit the VB6 controls edition again now that it seems to have purpose to me.

 

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #53 on: June 18, 2014, 02:39:39 PM »
I was able to find a VB5CCE (Visual BASIC 5 Controls Creation Edition) with help files. You can download it HERE. The manifest file I posted above will work with the VB5CCE version if you rename it to vb5cce.exe.manifest. The conrol edition will let you create standard Windows forms but are saved as a project file and can't be compiled to a .exe.

« Last Edit: June 18, 2014, 02:53:24 PM by support »

dzzie

  • Guest
Re: Couple Api ideas for embedding
« Reply #54 on: June 18, 2014, 03:38:22 PM »
I just did a couple quick tests with vb5 cce since it had been a while.

We can not host usercontrol UIs at the moment, but you can use code in the usercontrol the same as if it were just a standard public class, its just that its UI wont be visible. From the "class" you can then display a traditional form object which can host the UI

In other news i figured out a way for the vb form to pass an arbitrary number of arguments to
the script basic callback, and to let the script basic call back return either a long or string.
that should cover most use needs I think.
« Last Edit: June 18, 2014, 03:54:34 PM by dzzie »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #55 on: June 18, 2014, 03:48:30 PM »
I wasn't sure what value the VB5CCE version would offer so thanks for clearing that up. Is any of the runtime components of VB5CCE usable for anything? From what I gather I can create a standard VB form, save the it as a project file, load it in standard VB and create a standalone .exe with it. If anything maybe it can be used as an IDE / Debugger of sorts.


dzzie

  • Guest
Re: Couple Api ideas for embedding
« Reply #56 on: June 18, 2014, 03:56:02 PM »
all of the things i did in the vb6 demo can be done from the vb5 cce

the user control will be the class, and it will display the form. same mechanisms at play

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #57 on: June 18, 2014, 04:00:17 PM »
So are you saying VB5CCE wasn't a waste of time and can be used in the SB VB COM project?


dzzie

  • Guest
Re: Couple Api ideas for embedding
« Reply #58 on: June 18, 2014, 04:14:01 PM »
yup still works fine in vb5cce see attached
« Last Edit: June 18, 2014, 04:16:13 PM by dzzie »

Support

  • Administrator
  • *****
  • Posts: 19
    • View Profile
Re: Couple Api ideas for embedding
« Reply #59 on: June 18, 2014, 04:30:07 PM »
Very Cool!

I had to register the OCX this time. (no dll)



Code: [Select]
import com.inc

function Button1_Click(arg)
print "Back in script basic Button1_Click arg=", arg, "\n"
Button1_Click = arg + 1
end function

obj = CreateObject("VB5.CCESample")

if obj = 0 then
    print "CreateObject failed!\n"
else
    print "obj = ", obj, "\n"
       
    oCollection = CallByName(obj, "CallBackHandlers", VbGet)
    print "oCollection = ", oCollection, "\n"
   
    CallByName(oCollection, "Add", VbMethod, ADDRESS(Button1_Click()), "frmCallBack.cmdOp1_Click" )
   
    retVal = CallByName(obj, "LaunchCallBackForm", vbMethod, 21)
    print "LaunchCallBackForm returned ", retVal, "\n"
   
    ReleaseObject(obj)
    print "test complete!\n"
end if

C:\SB22\sbcom\sbvb4>scriba VB5_Example.sb
obj = 1400632
oCollection = 1406752
Back in script basic Button1_Click arg=21
LaunchCallBackForm returned 22
test complete!

C:\SB22\sbcom\sbvb4>