Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB6 to c# Compatibility problems - Microsoft.VisualBasic.Compatibility.dll and stdole

Posted on 2005-04-11
9
Medium Priority
?
2,075 Views
Last Modified: 2012-06-21
Hi All,
We have an odd situation with c# code that uses a call to Microsoft.VisualBasic.Compatibility.VB6
We have got an SDK from a vendor and we are trying to convert a stdole.IPictureDisp object to a System.Drawing.Image.

They do this using this code.
pictureBox1.Image  = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureDispToImage(pic.Picture);
where pic.Picture is a stdole.IPictureDisp object.

This code works perfectly fine on my pc and others that have Visual Studio installed but wont run on the pc that only have the framework installed.
It throws an error saying that it couldnt find stdole or one of its dependencies.

So we had a look and compared a PC with Visual studio and one without and they both had stdole files in the same place.
We noticed that C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Microsoft.VisualBasic.Compatibility.dll was missing from the PC without Visual Studio
so we copied that over as well.
However it doesnt seem to affect it.

Does anybody have any ideas what we could be missing. We cant work out the dependancies of stdole to fix it.
Thanks
Dave


0
Comment
Question by:CoreSupport
  • 6
  • 3
9 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 13752359
Look at %ProgramFiles%\Microsoft.net\Primary Interop Assemblies\stdole.dll.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13752368
Another topic area for asking C# questions:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/

Bob
0
 

Author Comment

by:CoreSupport
ID: 13753011
Hi there,
Thanks for the rapid reply! We found that the Microsoft.net folder wasnt on the machines that didnt have Visual Studio on them and we copied it over.
It doesnt seem to make a difference though.

I dont think its picking up the fact that the dll is there now. Is there something else you have to do to get it to pick up the file? A restart maybe?

I also noticed that an example solution that comes with the sdk has a reference to stdole.
Its pointing to C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll
However this example isnt working either.

I went to the assembly folder but its not a normal folder...I dont know enough about the assembly to play around with it :(

Any ideas?
Thanks
D
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 13753049
End of DLL hell--right ;)

Here's a thought:

Dependency Walker -- Profiling
http://support.microsoft.com/default.aspx?scid=kb;en-us;830761#2a3

Bob
0
 

Author Comment

by:CoreSupport
ID: 13753606
DLL hell and I feel like I'm wearing a blindfold!
Thanks for the dependancy walker tip...
Thats brilliant!
I 'll give it a go now.
Dave
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13753723
Good luck, Dave, you're gonna need it.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13753773
http://www.mcse.ms/archive107-2003-11-38226.html

Direct usage of stdole that might be useful.  It uses the stdole Primary Interoperability Assembly -- PIA -->  %ProgramFiles%\Microsoft.net\Primary Interop Assemblies\stdole.dll:

Public Class ImageConverter
Inherits System.Windows.Forms.AxHost
' converts a IPicture to .Net image format

Public Sub New()
MyBase.New("3AFF760D-9937-4f65-95B7-258AB7CB4E78")
End Sub

Public Shared Function ImageToIPicture(ByVal Image As _
System.Drawing.Image) As stdole.StdPicture
ImageToIPicture = AxHost.GetIPictureFromPicture(Image)
End Function

Public Shared Function IPictureToImage(ByVal Image As
stdole.StdPicture) _ As System.Drawing.Image
IPictureToImage = AxHost.GetPictureFromIPicture(Image)
End Function
End Class

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 13753839
Also, if you want to put an assembly into the Global Assembly Cache:

How Do I...Work with the global assembly cache?
http://samples.gotdotnet.com/quickstart/howto/doc/gac.aspx

Bob
0
 

Author Comment

by:CoreSupport
ID: 13753874
Hi there!!
well stdole ...never want to see it again!
I noticed that the example project had the stdole dll as a reference.
So I got visual studio to embed it in my project and it worked!!!
Great stuff.
Thanks a million for all your help Bob!!
Legend
Dave
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 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