A while back I thought about how it would be cool to have a VB to PB converter.
I looked around the forums and couldn't find one. There may very well be one but I didn't find one.
So as a programming exercise I decided to try to write one.
My goal was to be able to convert a simple VB application to PB that used no ActiveX controls nor COM stuff.
This might be a cool way to both introduce VB developers to PB and who knows if in the future PB can handle ActiveX controls -that would really open things up. Status
VB2PB converts a VB project that contains 2 forms and 2 modules (should be able to handle more) to a PB program.
The VB form has:
The 3 buttons on the vb form do the following:
1. button 1 - displays a msgbox
2. button 2 - calls a method in a module which in turn:
a. calls a function which performs a calculation and returns the result
b. displays the returned valued in a msgbox
c. displays the second form
3. button 3 - displays the second form
They obviously don't do anything useful. The point was to mix up the flow of the programs so as to help test the VB2PB program.
One key thing that VB2PB does do which isn't straight forward code to code conversion, is it can handle extracting the icons, jpg or bmps used in a Picturebox control.
If you are not familiar with that, VB stores the ico, bmp and jpg images used in Pictureboxes (and I'm assuming Image controls although I didn't get to test that) in binary form in a seperate file with an .FRX extension and with the same name as the form they're used in.
Also, VB will store the items in a combo box and list box in the same .FRX file.
This made writing VB2PB a bit harder as there wasn't much info that I could find regarding this. Finally I did find one sample VB program that handled the images but not the combo/lists, but I was able to figure it out for the most part.Future
I'm not currently working on VB2PB as I've got several other projects, but I think the idea still has merit, I just can't further it along for a while.
So rather than let it sit there I thought I would put it out there and see if I could get some help with it from the community.
I am making the source code available to everyone who is interested in helping develop it further. I've commented the code as much as possible.
If anyone wants to help, just reply to this post.Download and Execute
You can find the download at the bottom of this post.
Extract the files with the directory structure in place.
In the PB folder you will find the VB project file (.vbp) I used for development. If you have VB 6 you should be able to double-click it to load it. You can then run it to see the VB application.
In the PB\Converted folder you will find the PB program that was created during the conversion as well as the ico, bmp and jpg files that were extracted from the FRX file.
In the Program folder you will find the VB2PB program. To use it simply run it and in the first textbox it needs the path to the .VBP VB project file to convert. In the second textbox it needs the directory where it can store the converted .PB program and any image files. Bugs
I'm sure there are still bugs as it's a work in progress. Here we can list bugs and fix them.
1. VB2PB currently uses "PureCOLOR_SetGadgetColor" to make a textgadget transparent like VB labels. But it's not working correctly and the text gets messed up. Features
Here we can list features we need worked on.
Download the VB2PB.Zip file from my website: VB2PB.zip