Click to See Complete Forum and Search --> : Passing a picture object between processes


apatankar
October 2nd, 1999, 01:16 PM
I have a ActiveX EXE which has the following code


public Function GetPic(sPicPath as string) as Picture
Dim pic as Picture
set pic = LoadPicture(sPicPath)
set GetPic = pic
End Function




But this just gives me an 'Automation Error' or 'Method Failed' error, can i achieve this through any other means as i want to pass the picture object from the server to the client.

RAJESH SHARMA
October 2nd, 1999, 01:24 PM
USE THE CLIPBOARD FOR THE PURPOSE.
THE ALGO GOES AS FOLLOWS

FROM THE SENDING PROCESS SET THE PICTURE PROPERTY OF THE PICTURE CONTROL TO THE IMAGE TO BE TRANSFERRED.

THEN OPEN THE CLIPBOARD USING API CALLS

SET THE CLIPBOARD DATA TO CF_BITMAP

TRANSFER THE IMAGE TO THE CLIPBOARD

AT THE RECIEVING END GET THE CLIPBOARD DATA AGAIN TO A PICTURE CONTROL

Ravi Kiran
October 4th, 1999, 01:50 AM
Try defining it as an Object

public Function GetPic(sPicPath as string) as Object
Dim pic as Picture
set pic = LoadPicture(sPicPath)
set GetPic = pic
End Function




While using, make sure you "cast" it back into approp type, as : (Client code)
dim IPic as Picture
set IPic = GetPic(somepath)
... use it
set IPic = Nothing

Also make sure you set it to Nothing after done with it!

RK

Ravi Kiran
October 4th, 1999, 02:22 AM
Hi,

sorry, that piece of code i wrote before doesn't work. I checked it!. I will let you know more, if i happend to find out. Sorry again, for the wrong answer


RK

November 18th, 1999, 05:44 AM
But what happens if the Activex server is running on the Remote machine how can you get the access to the server clipboard

Nilesh