Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(1500) Help
Message
 
 
To
08/01/2008 16:14:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01280185
Message ID:
01280448
Views:
20
Hi Cesar,

I think I was on the right track then in my original reference.

> W O W !!!!
>
>How can you know EVERYTHING about EVERYTHING ???
>
>As always, you've brought an elegant and clean solution
>
>Thanks a lot !
>
>
>Below is the final code that generates an HTM file from any selected PRG.
>Thanks very much !
>
>
>
>
LOCAL lcFile
>lcFile = GETFILE("prg")
>
>* Open the VFP Editor
>MODIFY COMMAND (lcFile) NOWAIT NOEDIT
>
>
>* Select all and Copy to Clipboard
>* by Sergey Berezniker
>LOCAL ARRAY laEnv [25]
>LOCAL lnHandle, lnResult
>SET LIBRARY TO FoxTools ADDITIVE
>* Get the whandle for the current window
>lnHandle = _WonTop()
>lnResult = _EdGetEnv( lnHandle, @laEnv )
>* [ 2 ]  File Size
>* [ 17 ] SelStart
>* [ 18 ] SelEnd
>
>* Select ALL
>_EdSelect(lnHandle, 0, laEnv[2]-1)
>
>* Copy to clipboard
>IF NOT _EdCopy(lnHandle)
>	MESSAGEBOX("Couldn't Copy ")
>	RETURN .F.
>ENDIF	
>
>
>* Close the PRG
>RELEASE WINDOWS (JUSTFNAME(lcFile))
>
>
>LOCAL loIE as "InternetExplorer.Application"
>loIE = CREATEOBJECT("InternetExplorer.Application")
>#DEFINE READYSTATE_COMPLETE      4
>#DEFINE MAX_TIME                30
>#DEFINE OLECMDID_PASTE          13
>#DEFINE OLECMDEXECOPT_DODEFAULT  0
>
>local lcInnerHTML && HTML of the webpage
>local lnStarted && Seconds when started loading
>local lnWaiting && Seconds waiting for the document to load
>local lcRetVal && Return Value
>
>lnStarted = SECONDS()
>
>loIE.navigate("about:blank")
>
>* Wait till page totally loaded
>DO WHILE loIE.Readystate <> READYSTATE_COMPLETE or lnWaiting >= MAX_TIME
>   lnWaiting = SECONDS() - lnStarted
>ENDDO
>
>* Make the page editable
>loIE.Document.Body.contentEditable = .T.
>
>* Paste Clipboard content
>loIE.ExecWB(OLECMDID_PASTE, OLECMDEXECOPT_DODEFAULT)
>
>* Retrieve the HTML
>lcInnerHTML = loIE.Document.Body.InnerHTML
>
>* Save to HTM file
>LOCAL lcDestFile, lcCommand
>lcDestFile = FORCEEXT(lcFile, "htm")
>STRTOFILE(lcInnerHTML, lcDestFile)
>
>lcCommand = "RUN /N Explorer.Exe " + lcDestFile
>&lcCommand
>
>RETURN
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform