Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FLL creation problem
Message
 
À
18/11/2011 13:35:11
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Divers
Thread ID:
01529243
Message ID:
01529256
Vues:
92
This message has been marked as the solution to the initial question of the thread.
J'aime (1)
First of all, you cannot expect receiving Integer type every time. It is very likely that a user of your FLL may pass a numeric parameter not as integer 1 but as a float 1.0. In such a case, ev_long becomes useless.

In my FLLs I pass all numeric input parameters through the following conversion function.
long GetParmLong(Value p)
//accepts float and int, returns int
{
	if ( p.ev_type == 'N' ) return (int)p.ev_real;
	else if ( p.ev_type == 'I' ) return p.ev_long;
	else return 0;
}
So for example, for an external declaration
FoxInfo myFoxInfo[] = 
{
     ...
     {"PD_SETPROGRESS",  (FPFI) SetProgress,  2, "N.N"},
     ...
}
The function is implemented as follows. Note that I also check if the second parameter (declared as optional) exists, otherwise it is replaced with a default value 100.
void SetProgress( ParamBlk *parm )
{
	long dwCompleted = GetParmLong( parm->p[0].val );

	long dwTotal = parm->pCount > 1 
		? GetParmLong( parm->p[1].val ) : 100;

        // ... the rest of code
}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform