FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour re.prg
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
re.prg
Posted: Wed Mar 16, 2011 07:59 AM

How converte output prg into fivewin code (@ x,y) from re.prg

it now save the prg but only with redefine commands.

I need to save with sources because on W7 the resources leak memory of pc

and I try to converte each mine rc dialogs into source code

Any help ?

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: re.prg
Posted: Wed Mar 16, 2011 09:01 AM
For a sample Look it please


If we run RE.prg


We have a resources rc and we can show it





If we use Rc2prg.prg and thenwe compile the test.prg ( I save on test.prg test.rc)

we have this





BUT IT IS TOO BIG MORE THAN THE ORIGINAL DIALOG

WHY ?
Best Regards, Saludos



Falconi Silvio
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: re.prg
Posted: Wed Mar 16, 2011 09:12 AM
BUT IT IS TOO BIG MORE THAN THE ORIGINAL DIALOG

WHY ?


Silvio, I have noticed this too...

It seems to be that in resources, the Font size is 8 pixels, but from code, you can not specify this Font Size directly to the Dialog, but only to the text on It...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: re.prg
Posted: Wed Mar 16, 2011 12:26 PM
try it please
Resource code
Code (fw): Select all Collapse
LIBROS_EDIT DIALOG DISCARDABLE 24, 45, 330, 230
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "LIBROS_EDIT"
FONT 8, "MS Sans Serif"
{
  CONTROL "T铆tulo", 200, "Static", WS_GROUP, 15, 14, 26, 9
  CONTROL "", 100, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 12, 175, 12
  CONTROL "C贸digo", 201, "Static", WS_GROUP, 230, 14, 24, 8
  CONTROL "", 101, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 255, 12, 60, 12
  CONTROL "T铆t. Orig.", 202, "Static", WS_GROUP, 15, 27, 28, 9
  CONTROL "", 102, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 26, 175, 12
  CONTROL "Autor", 203, "Static", WS_GROUP, 15, 42, 30, 8
  CONTROL "", 103, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 40, 150, 12
  CONTROL "Materia", 204, "Static", WS_GROUP, 15, 56, 27, 8
  CONTROL "", 104, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 54, 150, 12
  CONTROL "Idioma", 205, "Static", WS_GROUP, 15, 70, 24, 8
  CONTROL "", 105, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 68, 150, 12
  CONTROL "Propietario", 206, "Static", SS_RIGHT|WS_GROUP, 15, 84, 33, 8
  CONTROL "", 106, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 82, 150, 12
  CONTROL "Ubicaci贸n", 207, "Static", WS_GROUP, 15, 98, 33, 8
  CONTROL "", 107, "Edit", ES_AUTOHSCROLL|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 50, 96, 150, 12
  CONTROL "", 108, "SysTabControl32", 0x00000000, 15, 114, 300, 86
  CONTROL "", 109, "TBtnBmp", WS_TABSTOP, 16, 203, 56, 8
  CONTROL "", 110, "TBtnBmp", WS_TABSTOP, 16, 212, 56, 8
  CONTROL "&Aceptar", IDOK, "Button", WS_TABSTOP, 208, 203, 50, 16
  CONTROL "&Cancelar", IDCANCEL, "Button", WS_TABSTOP, 264, 203, 50, 16
}


source code

Code (fw): Select all Collapse
#include "FiveWin.Ch"

FUNCTION LIBROS_EDIT()
LOCAL oDlgLIBROS_EDIT
LOCAL oFnt
LOCAL oGet100, nGet100
LOCAL oGet101, nGet101
LOCAL oGet102, nGet102
LOCAL oGet103, nGet103
LOCAL oGet104, nGet104
LOCAL oGet105, nGet105
LOCAL oGet106, nGet106
LOCAL oGet107, nGet107
LOCAL oFold32108
LOCAL oTBMP109
LOCAL oTBMP110
LOCAL oBtIDOK
LOCAL oBtIDCANCEL
 
DEFINE FONT oFnt  NAME "MS Sans Serif"        SIZE 0, -8

DEFINE DIALOG oDlgLIBROS_EDIT ;
        FROM  45,24 TO 79,113 ;
        TITLE "LIBROS_EDIT"  ;
        FONT oFnt

@  14, 15 SAY "T铆tulo" ;
        SIZE 26,  9 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  12,  50 GET oGet100 VAR nGet100 ;
        SIZE  175,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  14, 230 SAY "C贸digo" ;
        SIZE 24,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  12,  255 GET oGet101 VAR nGet101 ;
        SIZE  60,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  27, 15 SAY "T铆t. Orig." ;
        SIZE 28,  9 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  26,  50 GET oGet102 VAR nGet102 ;
        SIZE  175,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  42, 15 SAY "Autor" ;
        SIZE 30,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  40,  50 GET oGet103 VAR nGet103 ;
        SIZE  150,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  56, 15 SAY "Materia" ;
        SIZE 27,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  54,  50 GET oGet104 VAR nGet104 ;
        SIZE  150,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  70, 15 SAY "Idioma" ;
        SIZE 24,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  68,  50 GET oGet105 VAR nGet105 ;
        SIZE  150,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  84, 15 SAY "Propietario" ;
        SIZE 33,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  82,  50 GET oGet106 VAR nGet106 ;
        SIZE  150,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  98, 15 SAY "Ubicaci贸n" ;
        SIZE 33,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt

@  96,  50 GET oGet107 VAR nGet107 ;
        SIZE  150,  12 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  114, 15 FOLDER oFold32108 ;
        SIZE 300,  86 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  203, 16 BTNBMP oTBMP109 ;
        SIZE 56,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  212, 16 BTNBMP oTBMP110 ;
        SIZE 56,  8 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  203, 208 BUTTON oBtIDOK ;
        SIZE 50,  16 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

@  203, 264 BUTTON oBtIDCANCEL ;
        SIZE 50,  16 ;
        OF oDlgLIBROS_EDIT ;
        FONT oFnt ;
        PIXEL

ACTIVATE DIALOG oDlgLIBROS_EDIT
RETURN 0

//------------------------------------------------------------------------------
Best Regards, Saludos



Falconi Silvio
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: re.prg
Posted: Thu Mar 17, 2011 10:14 AM

Silvio,

remember that in rc the sizes and positions are shown in DIALOG UNITS, that are not PIXELS. That's the reason when we change the dialog's font everything resizes.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: re.prg
Posted: Thu Mar 17, 2011 11:55 AM

Carlos,
I not believe on 2011 we not have Ide run , I need create forms no resources because it eat the resources of system (w7)
I found an app vrmm of ricardo marques , it seems run ok , it a simply form application , then it save on prg good

Antonio must insert this app on new fwh , it can be usefull for the community

FWH .. BC582.. xharbour
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: re.prg
Posted: Thu Mar 17, 2011 12:58 PM

To get the same size object in dialog units divide window units by 2.05

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: re.prg
Posted: Thu Mar 17, 2011 02:53 PM
@James,

not sure about that. It depends on the font used in the DIALOG's declaration (in .rc). The real conversion can be a little bit tricky, remember the 16BIT (or something like that) of the REDEFINE DIALOG command in FWH, even 16 bits rc are different.
Code (fw): Select all Collapse
pixelX = (dialogunitX * baseunitX) / 4
pixelY = (dialogunitY * baseunitY) / 8

from http://support.microsoft.com/kb/145994

A dialog unit is based on the size of the dialog box font, normally 8-point MS Sans Serif. A horizontal unit is the average width of the dialog box font divided by four. A vertical unit is the average height of the font divided by eight.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: re.prg
Posted: Thu Mar 17, 2011 03:04 PM

Carlos,

Thanks for clarifying that. I found that number something like 10 years ago and it was just a rough estimate which worked for what I was doing at the time. Your explanation will be more useful and generic.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: re.prg
Posted: Thu Mar 17, 2011 11:39 PM

Carlos,
do you have an Idea to converte rc form into right prg on Re.prg ?
If I can design ( move) each control and save on prg , this is a dream....

Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: re.prg
Posted: Fri Mar 18, 2011 12:08 AM
It seems the problem is in this part of the RC2PRG.PRG code. I have not tried to figure it out yet. I don't know where the 14 and 7 came from. Carlos, any ideas?

Regards,
James



Code (fw): Select all Collapse
// Dialog-Coordinates

#define FNTX 14
#define FNTY 7

Function xCo(c,x)
if x == NIL
聽 聽return Ltrim(str((Val(c)*FNTX)/8,6,0))
endif
return Ltrim(str(val(c)+(((Val(c)+Val(x))*FNTX)/8),6,0))

Function yCo(c,x)
if x == NIL
聽 聽return Ltrim(str((Val(c)*FNTY)/4,6, 0))
endif
return Ltrim(str(val(c)+(((Val(c)+Val(x))*FNTY)/4),6,0))
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: re.prg
Posted: Fri Mar 18, 2011 11:02 AM

May be those values are the font sizes in use in 16 bits resources, may be they should be changed to the font sizes in the FONT at DIALOG's definition.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
鈥淚f you think education is expensive, try ignorance"
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: re.prg
Posted: Sat Mar 19, 2011 11:24 AM

Dear Friends
Any solution for it ?

Best Regards, Saludos



Falconi Silvio
Posts: 446
Joined: Mon Dec 26, 2005 09:11 PM
Re: re.prg
Posted: Fri Mar 25, 2011 05:39 PM

Silvio

Look this links

http://www.mediafire.com/?if123opaq1kdjob

http://www.mediafire.com/?g5q96xz77g378wp

Both are modified code from original rc2prg

Armando

FWH + BCC582 + WorkShop 4.5 + Resource Hacker + Mingw
Mis nuevas herramientas
Comunicacion via WhatsApp (+51) 957549 665
Comunicaci贸n via Correo: apic1002002 at yahoo dot es; apic1002002@gmail.com
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: re.prg
Posted: Sat Mar 26, 2011 08:52 AM

I tried but it make the same

Best Regards, Saludos



Falconi Silvio

Continue the discussion