Conversion of Buttons to 32 Bit

Conversion of Buttons to 32 Bit

Postby MichaelMo » Sun Jun 14, 2009 9:16 pm

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.
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am

Re: Conversion of Buttons to 32 Bit

Postby Antonio Linares » Sun Jun 14, 2009 9:42 pm

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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41453
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Conversion of Buttons to 32 Bit

Postby MichaelMo » Sun Jun 14, 2009 9:57 pm

Thank you, I will give that a try.
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am

Re: Conversion of Buttons to 32 Bit

Postby MichaelMo » Mon Jun 15, 2009 6:05 am

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?
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am

Re: Conversion of Buttons to 32 Bit

Postby Antonio Linares » Mon Jun 15, 2009 6:42 am

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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41453
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Conversion of Buttons to 32 Bit

Postby MichaelMo » Mon Jun 15, 2009 5:43 pm

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?
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am

Re: Conversion of Buttons to 32 Bit

Postby Antonio Linares » Tue Jun 16, 2009 6:18 am

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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41453
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Conversion of Buttons to 32 Bit

Postby MichaelMo » Wed Jun 17, 2009 7:47 am

Thanks for the info on screens and the MAC. I assume that is also the case for LINUX ports as well?
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am

Re: Conversion of Buttons to 32 Bit

Postby Antonio Linares » Wed Jun 17, 2009 9:32 am

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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41453
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Conversion of Buttons to 32 Bit

Postby MichaelMo » Fri Jun 19, 2009 2:53 am

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.
MichaelMo
 
Posts: 55
Joined: Thu Feb 15, 2007 1:35 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Antonio Linares, Ari, Google [Bot] and 114 guests