Solved

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

Posted on 2004-08-18
13
245 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now