Page 1 of 1

Conversion of Buttons to 32 Bit

PostPosted: Sun Jun 14, 2009 9:16 pm
by MichaelMo
I'm finally getting some actual time to work on updating an application to 32 bits. The code compiled into Harbour like a dream and I was able to replace most of the FUNKY lib tools with Fivewin functions or I simply rewrote them in Harbour. The conversion of my DLL file was a bit tricky mostly because the original file had corruption. There still seems to be a difference in the way FW/Harbour handle buttons, and I'd like some advice.

In the 16 Bit DLL are three buttons, marked 1201,3201, and 5201, each representing different "push states" of the button on the screen. To setup the button in Clipper/1.92 Fivewin, the command to activate and display the button was:

REDEFINE BUTTON ID 201 OF oDlg ;
ACTION (oDlg:end())

Each of the various button states were displayed depending on the state of the button. After reverting to an older (uncorrupted) version of the DLL file, I was able to convert it to 32bit using the tools provided with Fivewin, and I am now able to edit the 32 bill DLL with Visual Studio and other editors. The button in the DLL however comes over as a custom item, and the screen will not display properly unless I replace that custom control with an actual button, however none of the visual displays work as they did in 16 bit, and all I get is a blank button. What is the easiest way to convert over these buttons so that the are not blank and work as they did in 16bit?

FYI, I am *extremely* impressed (and grateful) at how smoothly things have progressed, even with the difficulty caused by the corruption in the original DLL file. I'm very much enjoying the conversion process thus far, but I like some advice on the best way to convert the buttons.

Re: Conversion of Buttons to 32 Bit

PostPosted: Sun Jun 14, 2009 9:42 pm
by Antonio Linares
Michael,

It seems as you are using Borland buttons in your dialogs.

If yes, then you need to add this code in your app:
Code: Select all  Expand view

Local hDLL := LoadLibrary( "bwcc32.dll" )

BWCCRegister( GetResources() )

...your code...

FreeLibrary( hDLL )
 

and also add this function declaration at the bottom of your main PRG:
Code: Select all  Expand view

DLL FUNCTION BWCCRegister( hInst AS LONG ) AS WORD PASCAL LIB "BWCC32.DLL"
 

And copy bwcc32.dll to the folder where your EXE is located. bwcc32.dll is available in FWH\samples

Re: Conversion of Buttons to 32 Bit

PostPosted: Sun Jun 14, 2009 9:57 pm
by MichaelMo
Thank you, I will give that a try.

Re: Conversion of Buttons to 32 Bit

PostPosted: Mon Jun 15, 2009 6:05 am
by MichaelMo
I have added the lines you recommended. I had inadvertently left out the loadlibrary statement. If I do not set the "no fail create" property on the box to yes, it fails to create the dialog box. If I set that property to true, I get an error 1 message, non defined id 201. If I remove the custom control in Visual Studio and add a standard button, I simply get a gray button. Are there specific property settings that I will need to set for new button control in the DLL file, or should that custom control have worked without me having to change it to a button?

Re: Conversion of Buttons to 32 Bit

PostPosted: Mon Jun 15, 2009 6:42 am
by Antonio Linares
Michael,

Our advise is not to use Borland controls for your migration to 32 bits.

You may replace them with standard Windows buttons, and then use the Class TButtonBmp as shown in FWH\samples\TestBuBm.prg

Re: Conversion of Buttons to 32 Bit

PostPosted: Mon Jun 15, 2009 5:43 pm
by MichaelMo
Thanks. I'll do that. It will take a bit more time to convert the application of course. :)

At some point I will be interested in porting this application to the mac. Just out of curiosity, how do I transfer the screen resources from a DLL file to the mac platform? Will I need to rewrite the screens in pure code to transfer it to the Mac, or can I import an RC file in some way?

Re: Conversion of Buttons to 32 Bit

PostPosted: Tue Jun 16, 2009 6:18 am
by Antonio Linares
MIchael,

> Will I need to rewrite the screens in pure code

Yes, thats the only way by now.

Anyhow, you may use "CrossOver" to directly run your Windows app on the Mac.

Re: Conversion of Buttons to 32 Bit

PostPosted: Wed Jun 17, 2009 7:47 am
by MichaelMo
Thanks for the info on screens and the MAC. I assume that is also the case for LINUX ports as well?

Re: Conversion of Buttons to 32 Bit

PostPosted: Wed Jun 17, 2009 9:32 am
by Antonio Linares
Michael,

In Linux you can use Glade to design your screens, and in Mac you can use "Interface Builder" to design them too,
but finally you have to copy the coordinates to @ ..., ... xbase sentences.

In Linux we can use the Glade file format screens, as they are, but they don't behave exactly as Windows RC files.

Re: Conversion of Buttons to 32 Bit

PostPosted: Fri Jun 19, 2009 2:53 am
by MichaelMo
Is the 64 bit upgrade the same deal, or can I use the RC file in 64 bit?

I've seriously considered updating the basic screens of the application, and rewriting them in pure code. It would take awhile, but it sounds like it would be the most universal way to go and that is a big plus. For now I'm making pretty good progress converting the button redefines to BTNBMPs. I'll finish that and finish the update to 32 bits before even thinking about converting it all to pure code.

I must say Antonio, I'm very pleased with how things are going so far and I am grateful that I will not have to rewrite this application in another language. From the speed tests I've run so far, the 32 bit updates are simply awesome. I'm tickled pink with Harbour and all the updates to Fivewin and all the new features of Fivewin. Nice job. I'm sure I'll find something to nitpick about later on, but I'm very appreciative of all your hard work and all the folks at Harbour.