Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open a word doc in modal form??
Message
 
 
To
19/06/2007 09:29:56
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01234220
Message ID:
01234244
Views:
20
>can I open a worddoc so it is in a modal window?
>so my program waits until word gets closed??
>
>
>Thanks
>
>
>peter

Hi Peter,

There is an interesting idea recently discussed in a Russian site at http://forum.foxclub.ru/read.php?29,276949,279499#msg-279499

I made a quick test, created a modal form and put this code in the Init:
DECLARE SetParent IN user32 integer hWndChild, integer hWndParent    
    
  DECLARE integer SetWindowPos IN User32 ;    
    	integer Wnd_handler, integer Window_Order, ;    
    		integer X1, integer Y1, integer X2, integer Y2, integer wFlags    
    		    		  
  DECLARE LONG FindWindow IN Win32API ;    
        STRING lpClassName;    
        ,STRING lpWindowName    
          		  
    loWord = CREATEOBJECT( 'WORD.APPLICATION')   
    lcFile = GETFILE('doc') 
    loDoc=m.loWord.Documents.Add(m.lcFile)   
      
    _PP=lodoc.name +" - "+loword.CAPTION  
     
    word_hwnd=FindWindow(NULL,_pp)   
    SetParent( word_hwnd, thisform.HWnd)  
    setWindowPos( word_hwnd,0,0,INT(THISFORM.Height/2),THISFORM.Width-1,THISFORM.HEIGHT-1,0)   
    loword.ActiveWindow.ActivePane.View.Zoom.PageFit = 1  
    
  loword.VISIBLE=.T.
Code from this thread, I didn't try to play with it much. I think it may be a starting point.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform