re.prg

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

re.prg

Post by Silvio »

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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: re.prg

Post by Silvio »

For a sample Look it please


If we run RE.prg


We have a resources rc and we can show it


Image


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

we have this

Image



BUT IT IS TOO BIG MORE THAN THE ORIGINAL DIALOG

WHY ?
Best Regards, Saludos

Falconi Silvio
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: re.prg

Post by Bayron »

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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: re.prg

Post by Silvio »

try it please
Resource code

Code: Select all

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: Select all

#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
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: re.prg

Post by Carlos Mora »

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
“If you think education is expensive, try ignorance"
User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: re.prg

Post by MdaSolution »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: re.prg

Post by James Bott »

To get the same size object in dialog units divide window units by 2.05
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: re.prg

Post by Carlos Mora »

@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: Select all

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
“If you think education is expensive, try ignorance"
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: re.prg

Post by James Bott »

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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: re.prg

Post by Silvio »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: re.prg

Post by James Bott »

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: Select all

// 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))
 
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: re.prg

Post by Carlos Mora »

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
“If you think education is expensive, try ignorance"
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: re.prg

Post by Silvio »

Dear Friends
Any solution for it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Armando Picon
Posts: 448
Joined: Mon Dec 26, 2005 9:11 pm
Location: Lima, Peru

Re: re.prg

Post by Armando Picon »

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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: re.prg

Post by Silvio »

I tried but it make the same
Best Regards, Saludos

Falconi Silvio
Post Reply