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
Solved

OLE Container problem

Posted on 2000-03-22
9
719 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
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
using Access 8 75
Adding to a VBA? 6 78
Microsoft C++ code failing in executable that worked 9 110
How to Add / Edit Windows Menu 4 68
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

829 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