Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FLL creation problem
Message
 
To
18/11/2011 13:35:11
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Miscellaneous
Thread ID:
01529243
Message ID:
01529256
Views:
93
This message has been marked as the solution to the initial question of the thread.
Likes (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
}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform