Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Word in a VFP form
Message
From
01/03/2005 11:55:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/03/2005 11:37:42
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00991182
Message ID:
00991631
Views:
18
Good if working for you. Didn't work for me. I actually tried FileDownload before and when Cancel is true it doesn't ask but it doesn't open either (and should be like that according to documentation).
Cetin

>Cetin,
>
>>Good you found it, didn't know could be used for showing toolbars.
>
>Think get the two issues solved: showing toolbars and bypassing dialog box.
>
>Thanks so much for your valuable assistance!
>
>Regards,
>
>Fernando
>
>To show toolbars:
>
>        Procedure cmdShowTBars.Click
>*                 ------------ -----
>                  Try
>                      ThisForm.oleBrowserWin.ExecWB (OLECMDID_HIDETOOLBARS       , ;
>                                                     OLECMDEXECOPT_DONTPROMPTUSER, ;
>                                                     0                           , ;
>                                                     0)
>                  Catch
>                  EndTry
>        EndProc
>
>and to bypass dialog box:
>
>        Procedure oleBrowserWin.FileDownload
>*                 ------------- ------------
>                  LParameters bActiveDocumentCancel, bDialogCancel
>
>                  bDialogCancel = .T.
>        EndProc
>
>Interesting that when loading the doc file, you must first do a "DoEvents", otherwise the dialog box is shown:
>
>        Procedure cmdLoad.Click
>*                 ------- -----
>                  DoEvents
>
>                  ThisForm.oleBrowserWin.Navigate2 (cLoadFileName)
>        EndProc
>
>The complete program:
>
>*Constants for ExecWB first parameter
>
>#DEFINE OLECMDID_OPEN 1
>#DEFINE OLECMDID_NEW 2
>#DEFINE OLECMDID_SAVE 3
>#DEFINE OLECMDID_SAVEAS 4
>#DEFINE OLECMDID_SAVECOPYAS 5
>#DEFINE OLECMDID_PRINT 6
>#DEFINE OLECMDID_PRINTPREVIEW 7
>#DEFINE OLECMDID_PAGESETUP 8
>#DEFINE OLECMDID_SPELL 9
>#DEFINE OLECMDID_PROPERTIES 10
>#DEFINE OLECMDID_CUT 11
>#DEFINE OLECMDID_COPY 12
>#DEFINE OLECMDID_PASTE 13
>#DEFINE OLECMDID_PASTESPECIAL 14
>#DEFINE OLECMDID_UNDO 15
>#DEFINE OLECMDID_REDO 16
>#DEFINE OLECMDID_SELECTALL 17
>#DEFINE OLECMDID_CLEARSELECTION 18
>#DEFINE OLECMDID_ZOOM 19
>#DEFINE OLECMDID_GETZOOMRANGE 20
>#DEFINE OLECMDID_UPDATECOMMANDS 21
>#DEFINE OLECMDID_REFRESH 22
>#DEFINE OLECMDID_STOP 23
>#DEFINE OLECMDID_HIDETOOLBARS 24
>#DEFINE OLECMDID_SETPROGRESSMAX 25
>#DEFINE OLECMDID_SETPROGRESSPOS 26
>#DEFINE OLECMDID_SETPROGRESSTEXT 27
>#DEFINE OLECMDID_SETTITLE 28
>#DEFINE OLECMDID_SETDOWNLOADSTATE 29
>#DEFINE OLECMDID_STOPDOWNLOAD 30
>
>*Constants for ExecWB second parameter
>
>#DEFINE OLECMDEXECOPT_DODEFAULT 0
>#DEFINE OLECMDEXECOPT_PROMPTUSER 1
>#DEFINE OLECMDEXECOPT_DONTPROMPTUSER 2
>#DEFINE OLECMDEXECOPT_SHOWHELP 3
>
> cLoadFileName = "C:\Temp\Test.doc"
>
> oShowWordPage = CreateObj ("frmShowWordPage")
>
> oShowWordPage.Show ()
>
> Clear Events
>
> Define Class frmShowWordPage as Form
>*------ ----- --------------- -- ----
>
>        Height      = 600
>        Width       = 800
>        AutoCenter  =  .T.
>        ControlBox  =  .T.
>        MaxButton   =  .T.
>        MinButton   =  .T.
>        Movable     =  .T.
>        ZoomBox     =  .T.
>        SizeBox     =  .T.
>        Name        = "frmShowWordPage"
>        Caption     = " Sample Word Editing Window"
>        Closable    =  .T.
>        Enabled     =  .T.
>        WindowType  =   1
>
>        Add Object oleBrowserWin  as oleControl  with Top               =   5, ;
>                                                      Left              =   5, ;
>                                                      Height            = 560, ;
>                                                      Width             = 790, ;
>                                                      Name              = "oleBrowserWin", ;
>                                                      OLEClass          = "Shell.Explorer.2"
>
>        Add Object cmdLoad      as CommandButton with Top               = 570, ;
>                                                      Left              =   5, ;
>                                                      Height            =  25, ;
>                                                      Width             =  75, ;
>                                                      FontName          =  "Arial", ;
>                                                      FontSize          =   8, ;
>                                                      Caption           = "\<Load"
>
>        Add Object cmdPrint     as CommandButton with Top               = 570, ;
>                                                      Left              =  85, ;
>                                                      Height            =  25, ;
>                                                      Width             =  75, ;
>                                                      FontName          =  "Arial", ;
>                                                      FontSize          =   8, ;
>                                                      Caption           = "\<Print"
>
>        Add Object cmdShowTBars as CommandButton with Top               = 570, ;
>                                                      Left              = 165, ;
>                                                      Height            =  25, ;
>                                                      Width             = 120, ;
>                                                      FontName          =  "Arial", ;
>                                                      FontSize          =   8, ;
>                                                      Caption           = "\<Show Tool Bars"
>
>        Add Object cmdCancel    as CommandButton with Top               = 570, ;
>                                                      Left              = 720, ;
>                                                      Height            =  25, ;
>                                                      Width             =  75, ;
>                                                      FontName          =  "Arial", ;
>                                                      FontSize          =   8, ;
>                                                      Cancel            = .T., ;
>                                                      Caption           = "\<Close"
>
>        Procedure cmdCancel.Click
>*                 --------- -----
>                  ThisForm.Release
>        EndProc
>
>        Procedure cmdLoad.Click
>*                 ------- -----
>                  DoEvents
>
>                  ThisForm.oleBrowserWin.Navigate2 (cLoadFileName)
>        EndProc
>
>        Procedure oleBrowserWin.FileDownload
>*                 ------------- ------------
>                  LParameters bActiveDocumentCancel, bDialogCancel
>
>                  bDialogCancel = .T.
>        EndProc
>
>        Procedure cmdPrint.Click
>*                 -------- -----
>                  Try
>                      ThisForm.oleBrowserWin.ExecWB (OLECMDID_PRINT          , ;
>                                                     OLECMDEXECOPT_PROMPTUSER, ;
>                                                     0                       , ;
>                                                     0)
>                  Catch
>                  EndTry
>        EndProc
>
>        Procedure cmdShowTBars.Click
>*                 ------------ -----
>                  Try
>                      ThisForm.oleBrowserWin.ExecWB (OLECMDID_HIDETOOLBARS       , ;
>                                                     OLECMDEXECOPT_DONTPROMPTUSER, ;
>                                                     0                           , ;
>                                                     0)
>                  Catch
>                  EndTry
>        EndProc
>
>        Procedure oleBrowserWin.Refresh
>*                 ------------- -------
>                  NoDefault
>        EndProc
>
>        Procedure oleBrowserWin.NavigateComplete2
>*                 ------------- -----------------
>                  LParameters PDisp, URL
>
>                  Try
>                      ThisForm.oleBrowserWin.ExecWB (OLECMDID_HIDETOOLBARS       , ;
>                                                     OLECMDEXECOPT_DONTPROMPTUSER, ;
>                                                     0                           , ;
>                                                     0)
>                  Catch
>                  EndTry
>        EndProc
>
>        Procedure oleBrowserWin.Init
>*                 ------------- ----
>                  This.Navigate2 ("about:blank")
>        EndProc
>
>        Procedure Init
>*                 ----
>        EndProc
>
>        Procedure QueryUnload
>*                 -----------
>                  ThisForm.cmdCancel.Click
>
>                  NoDefault
>
>                  Return .T.
>        EndProc
>
> EndDefine
>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform