Solved

Passing a picture object between an ActiveX exe and a regular exe.

Posted on 2004-08-18
13
246 Views
Last Modified: 2010-05-02
What I have right now is a standalone activex exe that acts as a server for programs to connect to using GetObject().  I am passing data between the programs, but I can't pass any VB pictures between them because I get an error

"Method of 'GetPicture' of object '_test' failed."

Where GetPicture is the function/property I am calling to get the picture and 'test' is the class module in the activex exe.  The activex exe project is here: http://www.vbforums.com/attachment.php?s=&postid=1765076

and then make a standard exe with this code:
----------------------------------------------------
Private Sub Form_Load()
Dim obj As Object

Set obj = GetObject(, "TestEXE.Test")
Set Me.Picture = obj.getpicture
End Sub
----------------------------------------------------

Compile the ActiveX exe and run it.  When you run the StandardEXE part, you will see the error.

Does anyone know of a way around this, or possibly another solution?
0
Comment
Question by:alexkwok
13 Comments
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11834086
0
 

Author Comment

by:alexkwok
ID: 11834385
I don't want to work with byte arrays unless I absolutely need to.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11838411
getobject has 2 parameters .. u r specifying the second parameter .. so no pathname is specified ..

This is what MSDN says ...
If PathName is a zero-length string (""), GetObject returns a new object instance of the specified type. If the PathName argument is omitted, GetObject returns a currently active object of the specified type. If no object of the specified type exists, an error occurs.

So my question is .. is ur activex exe running when u test from the client machine ..
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11838417
one more question ... y not just use the "NEW" keyword and create a ne instance of the object instead of getobject??
0
 

Author Comment

by:alexkwok
ID: 11843236
This whole activex exe thing works right now.  I'm not trying to create a new instance, I am getting the current existing object so it can be used as a server for programs to GetObject() into.  I'm 100% sure that it is working as it should because it's only possible for the server to start once.

My problem isn't "ActiveX cannot create object" because I am not getting that error.
0
 

Author Comment

by:alexkwok
ID: 11843257
And I know you can just open another copy of the program, but I meant without doing that, the program will not spawn different copies of itself.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:alexkwok
ID: 11845277
I did what I wanted to do in a different way, so I'll have my points refunded.
0
 

Author Comment

by:alexkwok
ID: 11849210
@Rejojohny

first post: Yes the activex exe is running.

for second post: I'm not trying or wanting to create a new instance.  I wanted a way to have a single program that acts as a server for many other "clients" to GetObject() into.
0
 

Author Comment

by:alexkwok
ID: 11849227
In any case, a bigger part of the project was taking an hIcon and converting it to a IPicture and sending that IPicture over to the client exe.  Sending only the hIcon didn't work because the hIcon was destroyed after use (from another program), so I just used DuplicateIcon() API to maintain a copy of it, and sent that copy over.  I didn't really send the picture over because that just wasn't possible (limitations with VB and threading) and byte arrays ruined the alpha bits of the icon, so sending the hIcon was a much better solution anyways.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11862578
is there a specific reason for u to use the getobject .. like some variables to be shared between multiple clients or something like that because the same can be acheived by specifying the instancing property of ur class as "Multiuse" .. the one instance of your object created would provide multiple objects to multiple client applications without duplication of resources or global data.
0
 

Author Comment

by:alexkwok
ID: 11867300
I made a C dll that hooks the system tray.  I made a program that took data from the dll and process it so that the icons etc can be accessible from another VB program that wants to.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11875745
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…

863 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

26 Experts available now in Live!

Get 1:1 Help Now