home *** CD-ROM | disk | FTP | other *** search
- * *********************************************************
- * *
- * * 05/18/93 MEMTOGEN.SPR 13:45:10
- * *
- * *********************************************************
- * *
- * * Steven Hsu, Wayne Lampel
- * *
- * * Copyright (c) 1993 Microsoft
- * * One Microsoft Way
- * * Redmond, WA 98052
- * *
- * * Description:
- * * This program was automatically generated by GENSCRN.
- * *
- * *********************************************************
-
-
- #REGION 0
- REGIONAL m.currarea, m.talkstat, m.compstat
-
- IF SET("TALK") = "ON"
- SET TALK OFF
- m.talkstat = "ON"
- ELSE
- m.talkstat = "OFF"
- ENDIF
- m.compstat = SET("COMPATIBLE")
- SET COMPATIBLE FOXPLUS
-
- m.rborder = SET("READBORDER")
- SET READBORDER ON
-
- * *********************************************************
- * *
- * * Windows Window definitions
- * *
- * *********************************************************
- *
-
- IF NOT WEXIST("mem2gen") ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.PJX" ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.SCX" ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.MNX" ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.PRG" ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.FRX" ;
- OR UPPER(WTITLE("MEM2GEN")) == "MEM2GEN.QPR"
- DEFINE WINDOW mem2gen ;
- AT 0.000, 0.000 ;
- SIZE 20.385,44.400 ;
- TITLE "Convert Memo" ;
- FONT "MS Sans Serif", 8 ;
- FLOAT ;
- NOCLOSE ;
- MINIMIZE ;
- SYSTEM
- MOVE WINDOW mem2gen CENTER
- ENDIF
-
-
- * *********************************************************
- * *
- * * MEMTOGEN/Windows Setup Code - SECTION 2
- * *
- * *********************************************************
- *
-
- #REGION 1
- if used()
- if not file(dbf())
- wait window "Not a Table (a cursor perhaps)" nowait
- return
- endif
- thetable = dbf()
- thealias = alias()
- wasopen = .t.
- else
- thetable = getfile("DBF","Select a Table")
- if empty(thetable)
- return
- endif
- select 0
- use (thetable) alias "mytable"
- thealias = "mytable"
- wasopen = .f.
- endif
-
- tempfil = sys(3)+'.dbf'
-
- copy to (tempfil) stru exte
- sele 0
- use (tempfil) alias thestru
- copy to array tempm fields field_name for field_type = "M"
- if type("tempm") = "U"
- wait window "No memo fields to convert!" nowait
- return
- endif
-
- use
- delete file (tempfil)
- select (thealias)
- use
-
- gen_cnt = 0
- for z = 1 to alen(tempm)
- tempm(z) = alltrim(tempm(z))
- if isole(thetable,tempm(z)) = 1
- gen_cnt = gen_cnt + 1
- dime thememos(gen_cnt)
- thememos(gen_cnt) = tempm(z)
- endif
- endfor
- if gen_cnt = 0
- wait window "There are no OLE objects in this table!" nowait
- return
- endif
-
- mselect = ""
- m.browseit = .t.
-
- * *********************************************************
- * *
- * * MEMTOGEN/Windows Screen Layout
- * *
- * *********************************************************
- *
-
- #REGION 1
- IF WVISIBLE("mem2gen")
- ACTIVATE WINDOW mem2gen SAME
- ELSE
- ACTIVATE WINDOW mem2gen NOSHOW
- ENDIF
- @ 0.308,3.200 SAY "Please select a memo to convert:" ;
- FONT "MS Sans Serif", 8 ;
- STYLE "BT"
- @ 1.923,3.400 GET mselect ;
- PICTURE "@&T" ;
- FROM thememos ;
- SIZE 12.692,37.400 ;
- DEFAULT 1 ;
- FONT "MS Sans Serif", 8
- @ 15.538,3.200 GET m.browseit ;
- PICTURE "@*C \<Browse after conversion" ;
- SIZE 1.308,28.500 ;
- DEFAULT 0 ;
- FONT "MS Sans Serif", 8 ;
- STYLE "BT"
- @ 17.538,11.000 GET m.action ;
- PICTURE "@*HT \!\<Convert;Cancel" ;
- SIZE 2.000,8.500,1.667 ;
- DEFAULT 1 ;
- FONT "MS Sans Serif", 8 ;
- STYLE "B"
-
- IF NOT WVISIBLE("mem2gen")
- ACTIVATE WINDOW mem2gen
- ENDIF
-
- READ CYCLE
-
- RELEASE WINDOW mem2gen
-
- #REGION 0
-
- SET READBORDER &rborder
-
- IF m.talkstat = "ON"
- SET TALK ON
- ENDIF
- IF m.compstat = "ON"
- SET COMPATIBLE ON
- ENDIF
-
-
- * *********************************************************
- * *
- * * MEMTOGEN/Windows Cleanup Code
- * *
- * *********************************************************
- *
-
- #REGION 1
- ret_val = 0
- if m.action = 1
- ret_val = mem2gen(thetable,alltrim(mselect))
- do case
- case ret_val = -6
- wait window "Could not write to: "+thetable+chr(7)
- case ret_val = -5
- wait window "Field could not be found: "+alltrim(mselect)+chr(7)
- case ret_val = -4
- wait window "Not a valid table!"+chr(7)
- case ret_val = -2
- wait window "Not a memo field: "+mselect+chr(7)
- case ret_val = -1
- wait window "Could not open: "+thetable+chr(7)
- case ret_val = 1
- wait window "Conversion complete!" nowait
- otherwise
- wait window "Unknown mem2gen error: "+alltrim(str(ret_val))+chr(7)
- endcase
- endif
- if (wasopen or browseit) and ret_val >= 0
- select 0
- use (thetable) alias (thealias)
- if browseit
- browse
- endif
- endif
-
-