Solved

Passing a Picture from PictureBox to OLE

Posted on 1998-01-08
4
394 Views
Last Modified: 2012-05-04
Hello!

  I'm trying to pass an image from a PictureBox control to a OLE container, so I can edit the pictue.
   I use this:
      SavePicture Picture1.Picture, App.Path & "\myfile.bmp"
      OLE1.CreateEmbed App.Path & "\myfile.bmp", "Paint.Picture"
   The problem is that the Class of the OLE object is not "Paint.Picture", but "Package"

  Is it possible to pass directly the image from the PictureBox to the OLE?, Or if it is not, what is wrong with my code?
  Thank you!
0
Comment
Question by:taco
[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
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:rantanen
ID: 1449852
Taco,

your code works at least in my computer (VB5 (SP2), Win95) if I make following

    SavePicture Picture1.Picture, App.Path & "\myfile.bmp"
    OLE1.Class = "Paint.Picture"
    OLE1.CreateEmbed App.Path & "\myfile.bmp"

I think your problem is that you have set the Class type at design time and CreateEmbed ignores the type, if SourceDoc is specified (as you did)

HTH
0
 

Author Comment

by:taco
ID: 1449853
The problem I have I think is because all my graphic files (GIF, JPEG, BMP are asociated to ACDSee program (it's a graphic viewer), and when I do the .createembed, OLE container ignores the class I'm giving to it, and inserts the file as a 'Package' Class, so when I double click the picture (it's just the icon) it opens ACDSee, but I want to open Paintbrush to edit the picture.
   Anyway I would like to know if I can do it directly, from my PictureBox to the OLE.
0
 
LVL 4

Accepted Solution

by:
rantanen earned 70 total points
ID: 1449854
Taco,

it is not possible to transfer a bitmap from PictureBox to OLE control directly - you have to go thru a disk file. (It works only the other way around).

To avoid the association problem, rename your files something else than myfile.bmp, for example myfile.xxx and then use the code you had.
0
 

Author Comment

by:taco
ID: 1449855
Well, I've tried that and doesn't seems to work. I even create an asociation between my *.xxx files and PaintBrush, so I can
open my files double clicking them in my Windows Explorer. But my OLE control doesn't recognize this asociation, and when I
try to Embed  my *.xxx file as a PBrush file, OLE control doesn't wants to, and make ma a 'Package' class.
      Anyway I think you are pointing in the right direction, rantanen, so I will try a little bit more and if I get nothing better I will accept and grade your answer. Thank you.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

688 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