Você está na página 1de 3

How to export pictures from General fields by using the ...

http://support.microsoft.com/kb/8948 9

of !

!/! /"# 4 !:$% &'

How to export pictures from General fields by using the ...

http://support.microsoft.com/kb/8948 9

= ADDBS( SYS( 2023 ) ) + 'GenTst\' IF !DIRECTORY( lcTestDi ! " ) #D ( lcTestDi ) E$SE %&& I' DIR is (l e()* t+e e! e,-t* it. $OCA$ lcOl)SetS('e AS STRI/G lcOl)SetS('e = SET( 'S('et*' ) SET SAFETY OFF ERASE ( lcTestDi + '%.%' ) SET SAFETY 0lcOl)SetS('e E/DIF %&& O-en t+e E#1$OYEE t(2le. T+e Gene (l 'iel) t+(t is n(,e) %&& 13OTO +(s -ict4 es in it. 5SE ADDBS( 3O#E() ) + 'S(,-les\D(t(\E,-l6*ee.)2'' %&& 3e e 7e 4n t+e Re-6 t O4t-4t A--lic(ti6n (Re-6 tO4t-4t.(--) in 3O#E(). %&& 8e -(ss it ( 9. T+is ,e(ns t+(t 7e 7(nt t+e Re-6 t O4t-4t A--lic(ti6n %&& t6 st6 e (n 62:ect e'e ence t6 (n 3T#$$istene &t*-e %&& Re-6 t$istene 2(se cl(ss t6 t+e sec6n) -( (,ete t+(t 7e -(ss; l6$istene . DO 3O#E() + 'Re-6 tO4t-4t.(--' 8IT3 9! l6$istene %&& Tell t+e 3T#$$istene t6 s(<e t+e 64t-4t (t+e .3T# -(=e) %&& t6 ( s-eci'ic '6l)e . T+is '6l)e is t+e 6ne c e(te) e( lie . l6$istene .T( =etFile/(,e = lcTestDi + 't,-.+t,' %&& T*-ic(ll*! ( e-6 t t+(t is 4n 2* 4sin= (n 3T#$$istene %&& )is-l(*s 7(it 7in)67s )4 in= - 6cessin= (n) ( %&& ,ess(=e 26> (t t+e en). 8e 7(nt t6 t4 n t+is 6''. T+e e'6 e! %&& 7e set ?4iet#6)e = .T. %&& /6te; T+is (ls6 t4 ns 6'' e 6 e-6 ts ' 6, t+e Re-6 t$istene . l6$istene .?5IET#ODE = .T. %&& R4n t+e e-6 t 2* 4sin= t+e $istene . RE1ORT FOR# GETFI$E('FR@') OBAECT l6$istene %&& T+is c6,,(n) )eletes t+e .+t,l 'ile t+(t is - 6)4ce). %&& 8e )6 n6t nee) it. ERASE ( l6$istene .T( =etFile/(,e ) %&& Cle(n 4-! (n) t+en e-6 t t+(t t+e - 6cess +(s 'inis+e). %&& T6 see t+e es4lts! 4se #ic 6s6't 8in)67s E>-l6 e t6 %&& <ie7 t+e '6l)e -(t+ t+(t is st6 e) in t+e 8in)67s Cli-26( ). C$OSE DATA A$$ BC$I1TE@T = lcTestDi C '1ict4 es +(<e 2een e>t (cte) t6 '! lcTestDi C 'T+is -(t+ is in *64 Cli-26( ).'

Example 2: Programmatically extract pictures from a General field by using a ReportListener class
Save this code example to a new .prg file. Then, run the program to automatically create a report and to use the report to extract the photos from the EMPLOYEE table. Note Either create a folder on the C drive that is named TmpTst or redefine the lcTargetDir variable to point to the folder of your choice. %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& % #ic 6s6't Dn67le)=e B(se A ticle EFGE"F % E@A#1$E 2 % A5T3OR; T e<6 3(nc6cH % CREATED; Fe2 4( * 22! 2009 0F;9F;32 % ABSTRACT; T+is c6)e e>t (cts -ict4 es t6 )isH ' 6, t+e % Gene (l 'iel) t+(t is n(,e) 13OTO in t+e % E#1$OYEE s(,-le t(2le. %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& %&& T+is 6--6site <(l4e 6' t+e c6nst(nt 7ill 2e 4se) t6 set t+e ?4iet#6)e %&& - 6-e t* 6' t+e Re-6 t$istene 2(se cl(ss. 8+en t+e <(l4e is .T.! %&& 7(it 7in)67s t+(t in)ic(te - 6cessin= (--e( . At t+e en)! ( ,ess(=e 26> %&& (--e( s. An* e 6 s in t+e Re-6 t$istene 2(se cl(ss (ls6 (--e( . IDEFI/E S+67Re-6 tFl67BE s .F. $OCA$ lcRe-6 t/(,e AS STRI/G! J lcGenFl)/(,e AS STRI/G! J lnGenFl)3ei=+t AS I/TEGER! J lnGenFl)8i)t+ AS I/TEGER! J lcT( =etDi AS STRI/G! J lcFile/(,eE>- AS STRI/G! J lcGenT(2le AS STRI/G %&& C+66se t+e n(,e 6' ( t(2le t6 e>t (ct 6ne Gene (l %&& 'iel) ' 6,. lcGenT(2le = ADDBS( 3O#E() ) + 'S(,-les\D(t(\e,-l6*ee.)2'' %&& Set t+e n(,e 6' t+e Gene (l 'iel) t+(t *64 7(nt t6 e>t (ct ' 6,. lcGenFl)/(,e = '13OTO' %&& Set t+e +ei=+t t+(t *64 7(nt '6 t+e Gene (l 'iel). lnGenFl)3ei=+t = E000.00 %&& Set t+e 7i)t+ t+(t *64 7(nt '6 t+e Gene (l 'iel). lnGenFl)8i)t+ = K000.00 %&& Set t+e '6l)e int6 7+ic+ t+e Gene (l 'iel) %&& -ict4 es 7ill 2e e>t (cte). lcT( =etDi = 'C;\T,-Tst\' %&& B* )e'(4lt! -ict4 es t+(t ( e en)e e) t6 )isH 2* t+e Re-6 t$istene cl(ss %&& 4se t+e '6ll67in= 'ile n(,e '6 ,(t; Bn.:-=. In t+is '6 ,(t! n %&& is ( n4,2e . I' *64 set t+is ne>t <( i(2le t6 (n e>- essi6n! *64 %&& c(n 6<e i)e t+(t 2e+(<i6 . In t+is e>(,-le! 7e n(,e %&& t+e .:-= 'iles 2(se) 6n t+e FIRSTB/A#E (n) $ASTB/A#E %&& 'iel)s ' 6, t+e E#1$OYEE t(2le t+(t 7e ( e e-6 tin= ' 6,. %&& T+is e>- essi6n 7ill 2e 7 (--e) in t+e ELA$ '4ncti6n 7+en it is c(lle). %&& T+e e'6 e! ,(He s4 e t+(t *64 s-eci'* (n e>- essi6n! ( <( i(2le! 6 s6,et+in= else. %&& 16ssi2le c+6ices incl4)e t+e REC/O '4ncti6n (n) 6t+e t(2le 'iel) n(,es. lcFile/(,eE>- = J MA$$T(E,-l6*ee.Fi stB/(,e) + 'B' + A$$TRI#(E,-l6*ee.$(stB/(,e)M %&&&&&& START RE1ORT CREATIO/ % C$OSE DATA A$$ IF !DIRECTORY( lcT( =etDi ! " ) #ESSAGEBO@( 'T( =et 64t-4t '6l)e )6es n6t e>ist. 1 6cess st6--e).'! GE! '' ) RET5R/ .F. E/DIF CD ( lcT( =etDi ) %&& Cle(n 4- t+e '6l)e 'i st t6 - e<ent (n* 'ile n(,e c6n'licts. $OCA$ lcOl)SetS('e (s St in= lcOl)SetS('e = SET(MS('et*M) SET SAFETY OFF DE$ETE FI$E %.% SET SAFETY 0lcOl)SetS('e %&& C e(te ( te,-6 ( * c4 s6 t6 2(se t+e e-6 t %&& 6n! ,(He t+e e-6 t! (n) t+en cl6se t+e c4 s6 . %&& T+is te,-6 ( * c4 s6 is 4se) t6 set 4- t+e e-6 t '6 t+e 'i st ti,e. %&& It is n6t nee)e) ('te t+e e-6 t is ,()e. lcRe-6 t/(,e = lcT( =etDi + 'GenRe-6 t' CREATE C5RSOR TE#1 ( Fl)" G ) CREATE RE1ORT ( lcRe-6 t/(,e ) FRO# TE#1 5SE I/ TE#1 %&& O-en t+e e-6 t 'ile (FR@) (s ( t(2le. 5SE ( FORCEE@T( lcRe-6 t/(,e! 'FR@' ) ) I/ 0 A$IAS T+eRe-6 t E@C$5SILE SE$ECT T+eRe-6 t %&& T+is c6,,(n) e,6<es 62:ects t+(t ( e n6t eN4i e) %&& ' 6, t+e e-6 t s4 '(ce (n) ' 6, t+e e-6 t t(2le itsel'. %&& O2:T*-e = 9 6 E; Re,6<es t+e l(2el (n) 'iel) 62:ects ' 6, t+e '66te . %&& O2:T*-e = 23 0 F6ntSt*le = "; Re,6<es ( '6nt es64 ce %&& t+(t is n6t nee)e). T+e es64 ce 2el6n=e) t6 t+e l(2el t+(t 7(s )elete). DE$ETE A$$ FOR (O2:T*-e = 23 A/D F6ntSt*le = ") J OR I/$IST(O2:T*-e! 9! E) I/ T+eRe-6 t %&& T+is c6,,(n) ():4sts t+e l(*64t 6' t+e +e()e (n) '66te 2(n)s. %&& O2:T*-e = F 0 O2:C6)e = " ,e(ns 1(=e 3e()e 2(n). %&& O2:T*-e = F 0 O2:C6)e = K ,e(ns 1(=e F66te 2(n). %& Re)4ce t+e, 2ec(4se t+e* ( e n6t eN4i e) '6 t+is c6)e. 51DATE T+eRe-6 t SET L-6s = 0! 3-6s = 0! 3EIG3T = 0 J 83ERE O2:T*-e = F A/D (O2:C6)e = " OR O2:C6)e = K) %&& Inc e(se t+e +ei=+t 6' t+e Det(il 2(n) %&& (O2:T*-e = F 0 O2:C6)e = G) t6 'it t+e %&& 1ict4 eOO$E B64n) c6nt 6l t+(t is inse te) 2* 4sin= t+e ne>t c6,,(n). 51DATE T+eRe-6 t SET L-6s = 0! 3-6s = 0! 3EIG3T = lnGenFl)3ei=+t J 83ERE O2:T*-e = F A/D O2:C6)e = G %&& A)) ( 1ict4 eOO$E B64n) c6nt 6l t6 t+e e-6 t 2* inse tin= ( %&& ec6 ) 7it+ (-- 6- i(te <(l4es. 5sin= (n 62:ect t+(t is 2(se) 6n t+e E#1TY %&& cl(ss +e e (n) t+e GAT3ER /A#E cl(ss l(te t6 inse t t+e ec6 ) ,(Hes it e(sie t6 %&& see 7+ic+ <(l4es line 4- t6 7+ic+ 'iel)s 7+en c6,-( e) t6 ( l( =e %&& S?$&I/SERT c6,,(n)). $OCA$

" of !

!/! /"# 4 !:$% &'

How to export pictures from General fields by using the ...

http://support.microsoft.com/kb/8948 9

I/TEGER ln$(st5n)e sc6 e16s = ATC('B'! T3IS.I,=File! OCC5RS( 'B'! T3IS.I,=File ) ) RE/A#E ( T3IS.I,=File ) TO J FORCEE@T( S5BSTR( T3IS.I,=File! "! ln$(st5n)e sc6 e16s & " )! 'A1G' ) E/DIF E/DIF DODEFA5$T( nB(n)O2:C6)e! nFR@Rec/6 ) E/D1ROC E/DDEFI/E For more information about exporting embedded bitmap images, click the following article number to view the article in the $%$&'( )http#**support.microsoft.com*kb*$%$&'(* + ,ow to export an embedded .bmp image into a file icrosoft !nowledge "ase#

For additional information about F-. table structure, see the /Table Structures of Table Files ).dbc, .frx, .lbx, .mnx, .p0x, .scx, .vcx+/ topic in 1isual Fox2ro ,elp. To review the 1isual Fox2ro 3.4 F-. table structure directly, run the following command in the Command window# REPORT FORM HOME() + "\Tool \File !ec\"#$r%&$r%" PRE'(E)

-EFE-E8CES
For more information about the -eport5istener . 5 display6style foundation class, visit the following icrosoft 7eveloper 8etwork ) S78+ 9eb site# http#**msdn(.microsoft.com*en6us*library*ms33:'$;)1S.&4+.aspx )http#**msdn(.microsoft.com*en6us*library*ms33:'$;)1S.&4+.aspx+

2roperties
<rticle =7# &3>&$3 6 5ast -eview# 8ovember $%, (44; 6 -evision# '.' APPLIES TO
icrosoft 1isual Fox2ro 3.4 2rofessional Edition

Keywords: kbcodesnippet kbhowto !"&3>&$3

! of !

!/! /"# 4 !:$% &'

Você também pode gostar