Home > Back-end >  BCB excuse me 2010 with ole container in TForm show PPT, how to enter a state of editing, or can sho
BCB excuse me 2010 with ole container in TForm show PPT, how to enter a state of editing, or can sho

Time:10-10

I want to in ole container in the window display all contents of PPT (2007), to explore and can be edited by entering state to achieve the effect, but the code written into the editing,

I hand in a manual operation on the office first, reach step is like this:
1, powerpoint insert objects: create an object from a file (see page into the first page of the thumbnail), small but can adjust size,
2, right click on the "presentation" object can see to what is done in the operation: screening, editor, open, try can do,
3, click the edit (double-click on the object can be directly), see the zoom and scroll bars, all pages are displayed, also can edit,
Written in code, however, are always enter a state of editors, the editors, should be to activate objects?

The code is written like this:
//TOleContainer * Ole;//put the control in TForm, hope PPT in the control display (not another rev powerpoint software window)
Ole - & gt; CreateObjectFromFile (m_file, false);
Ole - & gt; DoVerb (ovOpen);
Ole - & gt; The Run ();
Ole - & gt; SizeMode=2;//full screen
Ole - & gt; AutoActivate=3;//automatic activation: no see
Ole - & gt; AutoVerbMenu=true;//to be able to see objects right-click menu has shown, editor, open, but the mouse point invalid
Behind all these failed:
Ole - & gt; OleObject. OlePropertyGet (" Application "). OlePropertyGet (" Windows "); Or obtaining ActiveWindow ActivePresentation all failed,

Recorded macro view:
Insert on the PPT software objects:
ActiveWindow. Selection. SlideRange. Shapes. AddOLEObject (Left:=120, Top:=110, Width:=480, Height:=320, FileName:="XXX. PPTX," Link:=msoFalse). Select
The state of editing:
ActiveWindow. Selection. ShapeRange. OLEFormat. DoVerb Index:=2
Application. The WindowState=ppWindowMaximized
But the code Ole - & gt; OleObject. OleFunction (" Select "); An error, the execution Ole - & gt; DoVerb (2); There is no effect, or no access to ActiveWindow,

Please help to see how should do? Thank you very much! Just contact with ole, completely don't understand ah, see some of the ole and office data, a little dizzy,


Note:
Another code search on the Internet is like this (but not meet my needs) :
Ole - & gt; CreateObject (" PowerPoint. Application ", false);
Ole - & gt; OleObject. OlePropertySet (" Visible ", true);
Ole - & gt; OleObject. OlePropertyGet (" Presentations ".) OleFunction (" Open ", WideString (m_file), false, false, true);//must use WideString

This code will be outside the ole container to open the window and processes (see the Windows opened a new window, rather than in BCB Tform shown on the ole container controls) to start the powerpoint, and the expected effect,
At the beginning of the program with Ole - & gt; AllowInPlace=true; No,
And this is the application object, want to with you close the bar code, complains:
IOleInPlaceObject * IOPO;
Ole - & gt; OleObjectInterface - & gt; QueryInterface (IID_IOleInPlaceObject, (void * *) & amp; IOPO);
IOPO - & gt; UIDeactivate ();//to trample memory mistake
IOPO - & gt; Release ();
If can't solve the above problems, solve the line also ha:)
  • Related