? printf("Width=%d, Height=%4d, Alignment=%s", 100, 200, "Center")
PROCEDURE printf (lcSource, p0, p1, p2, p3, p4, p5, p6, p7,;
p8,p9,p10,p11,p12,p13,p14,p15)
* VFP Help: A maximum of 27 parameters can be passed
* from a calling program
LOCAL lnIndex, lcDecl, lvValue, lcType, lcDecl,;
lnResult, lcTarget
lcDecl = ""
FOR lnIndex=0 TO 15
IF lnIndex <= PARAMETERS()-2
lvValue = EVAL("p" + LTRIM(STR(lnIndex)))
lcType = TYPE("lvValue")
DO CASE
CASE lcType = "C"
lcDecl = lcDecl + ", STRING"
CASE lcType = "N"
lcDecl = lcDecl + ", INTEGER"
ENDCASE
ELSE
lcDecl = lcDecl + ", INTEGER"
ENDIF
ENDFOR
* every time this function has to be redeclared
* according to the parameters passed to it
lcDecl = "DECLARE INTEGER wnsprintf IN Shlwapi " +;
"STRING @lpOut, INTEGER cchLimitIn, STRING pszFmt" +;
lcDecl
&lcDecl
lcTarget = Space(4096)
lnResult = wnsprintf (@lcTarget, Len(lcTarget), lcSource,;
p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15)
RETURN Left(lcTarget, lnResult)
|