VB2PB - Visual Basic to PureBasic converter...

Developed or developing a new product in PureBasic? Tell the world about it.
DevilDog
Enthusiast
Enthusiast
Posts: 208
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

VB2PB - Visual Basic to PureBasic converter...

Post by DevilDog »

Hi All,

Background
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. :wink:


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:
  • Textboxes
    Buttons
    Labels
    Optionbuttons
    Checkboxes
    Pictureboxes
    Lists
    Comboboxes
    Frame
    Timer
    Vertical/horizontal scrollbars
The 3 buttons on the vb form do the following:

Code: Select all

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
Last edited by DevilDog on Thu Mar 14, 2013 9:26 pm, edited 3 times in total.
When all is said and done, more is said than done.
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Post by JCV »

nice! I'll help during vacant time. I still have to convert many vb apps I made before. :D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: VB2PB - Visual Basic to PureBasic converter...

Post by PB »

> I looked around the forums and couldn't find one.
> There may very well be one but I didn't find one.

I wrote an app called "vis2pure" way back in 2001, but the official announcement
was lost when the forums changed to phpBB. Here was the latest thread from
when I stopped working on it, although I have been tinkering again lately:

http://www.purebasic.fr/english/viewtopic.php?t=8319
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

@PB;
Yes, I know its an older thread and I hate to bring it up again...but a simple question please...PB, do you have any plans to re-release this as an updated version?

@DevilDog

I found the following caused errors:

Code: Select all

; misc procs
Declare.l Hex2Dec(h$)

and...

Procedure.l Hex2Dec(h$); I'm sure one of these 2 hex2rgb can be removed.
  ; I changed one slightly and somewhere and never got back to clearing this up
  ; h$ can be 0-FFFFFFF.
  h$=UCase(h$)
  For r=1 To Len(h$)
    d<<4 : a$=Mid(h$,r,1)
    If Asc(a$)>60
      d+Asc(a$)-55
    Else
      d+Asc(a$)-48
    EndIf
  Next
  ProcedureReturn d
EndProcedure
I commented them out and it seemed to work OK. Thanks for this :)
DevilDog
Enthusiast
Enthusiast
Posts: 208
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post by DevilDog »

SFSxOI,
It may be that the logic path where that code is encountered had not been triggered with the test vb project that I was using. If it works ok for your needs then great!

I'm glad you can use it. Like I said if anyone can use any part of it or help develop it further that would be fine.
When all is said and done, more is said than done.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> PB, do you have any plans to re-release this as an updated version?

Not right at the moment... I literally have no time these days, and it's hard to
get motivated anyway when things like PureFORM are so damn good. :)

One thing that kinda stops me wanting to do it, is that there's no easy way to
do PanelGadgets with the Visual Basic editor. You can add one easily, but you
can't switch tabs and drop gadgets onto those tabs. So it's likely that vis2pure
wouldn't support PanelGadgets, which would make it a bit useless, yes?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

"which would make it a bit useless, yes?"

I guess your right, it would in a way make it a bit useless. Thank You :)
PB wrote:> PB, do you have any plans to re-release this as an updated version?

Not right at the moment... I literally have no time these days, and it's hard to
get motivated anyway when things like PureFORM are so damn good. :)

One thing that kinda stops me wanting to do it, is that there's no easy way to
do PanelGadgets with the Visual Basic editor. You can add one easily, but you
can't switch tabs and drop gadgets onto those tabs. So it's likely that vis2pure
wouldn't support PanelGadgets, which would make it a bit useless, yes?
A M S
User
User
Posts: 58
Joined: Fri Aug 14, 2009 2:26 pm
Location: Afghanistan

Post by A M S »

Please reUpload this useful application
my problem is here :
http://www.purebasic.fr/english/viewtopic.php?t=38535
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

vis2pure wasn't a code converter, it was a form converter. It won't help you.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

I've still got a copy of the VB2PB.zip laying around. Since it belongs to PB, if he gives his permission i'll put it up on rapid share for you to get or somewhere else.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

vb2pb isn't mine. Mine is called vis2pure.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
DevilDog
Enthusiast
Enthusiast
Posts: 208
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post by DevilDog »

SFSxOI,
I wrote VB2PB, if you've still got the copy of it handy and you haven't already sent it to AMS, I have no problem with you sending it to him.

DevilDog
When all is said and done, more is said than done.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

@PB I got yours confused, sorry 'bout that...too many V's and B's and v to this and that around here. :)

@DevilDog - I haven't sent it, don't have anyplace to send it, heck its not that large and I could do it as an email attachment, or I could upload it somewhere so he can download. Thanks for granting permission.

@AMS, if you show back up, just PM me and let me know and we will work something out to get it to you.
DevilDog
Enthusiast
Enthusiast
Posts: 208
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

New download link

Post by DevilDog »

Hey everyone,
I've changed the link in the first post to point to my website instead of PureStorage since PureStorage is down.

You should be able to download VB2PB now. Here's the link again:



http://www.mooresdevildogs.com/VB2PB.zip
Last edited by DevilDog on Thu Mar 14, 2013 9:27 pm, edited 1 time in total.
When all is said and done, more is said than done.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5353
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Thanks DevilDog for this good idea 8)

But i have don't understand, how to use the only one file "VB2PB.zp" who is in your ZIP :oops:
ImageThe happiness is a road...
Not a destination
Post Reply