Solved

OLE Container problem

Posted on 2000-03-22
9
725 Views
Last Modified: 2013-11-25
I've got problems using an OLE Container in my application. I've linked it to a pdf file, then i've associated the DoVerb method to the mouse click event.
When I run my application, pdf files open in an Acrobat Reader window (correctly ...), but I'm not able to open that window maximized.

How can I do that?
Thanks in advance (sorry for my poor english ...)

Andrea

0
Comment
Question by:andrea_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 1

Expert Comment

by:phiro
ID: 2643981
You cannot.
You would need to increase the size of your OLE container (Maximize the form on which it is situated and maximize the container as well) or you would have to start an instance of Acrobat outside of your application :
For instance (I do not know this works for I have no Acrobat here so I give you an example for Word: )

In your form code :

Public oWord As Word.Application
Public oDoc As Word.Document

Private Sub cmdVerb_Click()
    Set oWord = New Word.Application
    oWord.WindowState = wdWindowStateMaximize
    Set oDoc = oWord.Documents.Open("c:\Doc1.doc")
    oWord.Visible = True
End Sub

You need to have an existing document at the path.
Now to use this with acrobat,
You would need to use the Acrobat COM library. You find that in VB by opening the "Project" menu and select "references". Now look for the Acrobat library and check the checkbox.
Now you can use the objects simulair to the example I showed you.
Press F2 to find out how the functions and properties are called for Acrobat.

Good luck, let me know when you need more info.

0
 

Author Comment

by:andrea_v
ID: 2648200
Adjusted points from 100 to 130
0
 

Author Comment

by:andrea_v
ID: 2648201
The only library I found contains only a PdfLib.Pdf class with few and useless methods.
Where can I find more specific libraries?

Can I build my application in a different way?
For example, using OLE AutoSize method and opening the document in a separate frame? How can I do that?

Many thanks for your time.

Andrea
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:phiro
ID: 2648578
Well, you could create a new form, maximize it and but an OLE container over the whole surface. When you activate the first OLE container (Or better, just use a button to start it) you will have a full screen OLE container.
You'd open the second form by:
Lets assume it is called frmFullOLE
the call would be :

dim obj as New frmFullOLE
frmFullOLE.Show

Another option is, when you cannot find a good COM lib. Is to use the API call to start the application itself with the file you want to use.

In the general declaration part of your form, add this:
'*** START ADD


Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'***END ADD

Do not be alarmed if this seems complicated. It gets better <g>

Now in your code where you want to start the application just put the line :


ShellExecute Me.hwnd, "open", sFileNameAndPathPdfFile, vbNullString, vbNullString, 1

Just set the path and filename at the place where sFileNameAndPathPdfFile is. leave the rest.
Now windows will open the file for you.

Hope this helps you further.


0
 

Author Comment

by:andrea_v
ID: 2649168
Ok, I've tried that way, but Acrobat still opens NOT MAXIMIZED!!!

I think to have to change ShellExecute's last parameter (1), but I don't know what's the right value ...

Thanks, bye.

Andrea
0
 
LVL 1

Accepted Solution

by:
phiro earned 140 total points
ID: 2649767
Oops,

My mistake ,

Change 1 for 3 (SW_MAXIMIZE)
So :
ShellExecute Me.hwnd, "open", sFileNameAndPathPdfFile, vbNullString, vbNullString, 3


This opens it maximized !

Cheers PhiRo

0
 

Author Comment

by:andrea_v
ID: 2650115
Adjusted points from 130 to 140
0
 

Author Comment

by:andrea_v
ID: 2650116
Many thanks to phiro for his "fast" answers!
0
 
LVL 1

Expert Comment

by:phiro
ID: 2652633
You're welcome !
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question