problem to call a dll function in .NET

I have the following code in VB6 to create a picture object: Dim IPic As IPicture Private Declare Function OleCreatePictureIndirect _ Lib "olepro32.dll" ( PicDesc As PicBmp, RefIID As GUID, _ ByVal fPictureOwnsHandle As Long, IPic As Image) As Long The IPic is to store the picture object created. After I convert this code to VB.NET, it becomes Dim IPic As Image Private Declare Function OleCreatePictureIndirect _ Lib "olepro32.dll" ( PicDesc As PicBmp, RefIID As GUID, _ ByVal fPictureOwnsHandle As Integer, IPic As Image) As Integer r = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic) The problem is that IPic is now the data type of Image while the last parameter of the OleCreatePictureIndirect () function in olepro32.dll is still expecting a data type IPicture. So, when running the code, the program thows an execption that the data type is not matched. Can someone help: how to solve this problem. To see the all the code, please go to: http://support.microsoft.com/default.aspx?scid=kb;en-us;161299 (This is to capture and print a VB6 form. Now I hope I could upgrade it to VB.NET) Thanks,

1 Reply

IJ Inquisitor Jax September 2, 2003 08:07 AM UTC

I have the same problem. Does anyone have an answer??

Loader.
Up arrow icon