Solved

Passing a Picture from PictureBox to OLE

Posted on 1998-01-08
4
385 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now