?
Solved

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

Posted on 2004-08-18
13
Medium Priority
?
252 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
[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
13 Comments
 

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 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