Still Lost with DLL

Still Trying to get my COM .NET C# DLL to Run in VS6 C++

Created the TLB File from the DLL (Check)
Opened the TLB File in the Class Wizard (Check)
Code Compiles & Appears to Link Without Error
DLL's H File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Machine generated IDispatch wrapper class(es) created with ClassWizard
/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Interface wrapper class

class PGPDLL_Interface : public COleDispatchDriver
{
public:
    PGPDLL_Interface() {}        // Calls COleDispatchDriver default constructor
    PGPDLL_Interface(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    PGPDLL_Interface(const QSTDLL_Interface& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

// Attributes
public:

// Operations
public:
    CString InternalErrorReason();
    BOOL PGPComOpen();
    CString PGPSystemStatus();
};
/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Events wrapper class

class PGPDLL_Events : public COleDispatchDriver
{
public:
    PGPDLL_Events() {}        // Calls COleDispatchDriver default constructor
    PGPDLL_Events(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    PGPDLL_Events(const QSTDLL_Events& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

// Attributes
public:

// Operations
public:
};


Dll's cpp File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Machine generated IDispatch wrapper class(es) created with ClassWizard

#include "stdafx.h"
#include "pgpinterface2.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Interface properties

/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Interface operations

CString PGPDLL_Interface::InternalErrorReason()
{
    CString result;
    InvokeHelper(0x1, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
    return result;
}

BOOL PGPDLL_Interface::PGPComOpen()
{
    BOOL result;
    InvokeHelper(0x2, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
    return result;
}


CString PGPDLL_Interface::PGPSystemStatus()
{
    CString result;
    InvokeHelper(0x9, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
    return result;
}



/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Events properties

/////////////////////////////////////////////////////////////////////////////
// PGPDLL_Events operations 


Code That's is supposed to Call & Use the DLL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
....
#include "pgpinterface2.h"
....
ASAIG::ASAIG()
{
   
    PGPDLL_Interface MyInterface;
    MyConnection = MyInterface.PGPComOpen();
    CString SystemStatus;
    SystemStatus = MyInterface.InternalErrorReason();
    SystemStatus = MyInterface.PGPSystemStatus();


}


The Code Runs but isn't working.
Example MyInterface.InternalErrorReason();
Is Supposed to return by default the value stored here
1
2
3
4
5
private string MyInternalErrorReason = "No Error Default";
        public string InternalErrorReason()
        {
            return MyInternalErrorReason;
        }


But Returns Nothing (NULL)

FYI When I Use the DLL in VS2010 C#,or VB it works fine
Ok also tried to Load This DLL (Project set for .NET 2.0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Runtime.InteropServices;

namespace DummyDLL
{
    /// <summary>
    /// Interface ?? For Dummy DLL
    /// </summary>
    [ComVisible(true),Guid("1AD5F0CD-0B34-41E5-B831-2A6A691F1371")]
    public interface DummyDLL_Interface
    {
        /// <summary>
        /// Returns Last Internal Error
        /// </summary>
        /// <returns>Last Error</returns>
        [DispId(1)]
        string InternalError();
        /// <summary>
        /// Returns Last Function Called
        /// </summary>
        /// <returns>Last Function</returns>
        [DispId(2)]
        string LastCommand();
        /// <summary>
        /// Nothing Really, Sets Last Function and Returns True
        /// </summary>
        /// <returns>Always True</returns>
        [DispId(3)]
        bool JunkCommand();
    
    }
    /// <summary>
    /// Their Are no Events
    /// </summary>
    [ComVisible(true),Guid("D03BB687-E84E-4BD0-8273-7E966F3C965A"),InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface DummyDLL_Events
    {
        // Their Are no Events :)
    }

    [ComVisible(true),Guid("70242E77-0027-411D-A59B-71FD12656C51"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(DummyDLL_Events))]
    public class DummyDLL_Class : DummyDLL_Interface
    {
        private string InitalError = "NoError";
        private string LastRunCommand = "none";
        public string InternalError()
        {
            LastRunCommand = "InternalError";
            return InitalError;
        }
        public string LastCommand()
        {
            string TempBuffer = LastRunCommand;
            LastRunCommand="LastCommand";
            return TempBuffer;
        }
        public bool JunkCommand()
        {
            LastRunCommand="JunkCommand";
            return true;
        }
    }
}


Called via
1
2
3
4
5
6
7
8
9
10
11
12
13
14
ASAIG::ASAIG()
{
	CString SystemStatus;
	DummyDLL_Interface MyDummyInterface;
	
	SystemStatus = MyDummyInterface.LastCommand();
	MyConnection = MyDummyInterface.JunkCommand();
	SystemStatus = MyDummyInterface.LastCommand();
	SystemStatus = MyDummyInterface.InternalError();
	SystemStatus = MyDummyInterface.QstSystemStatus();
	


}

Put a Break in the trace at the first systemStatus line so I could watch them, compiles fine, but I'm not getting any thing returned from the DLL.

I Ran "RegAsm DummyDLL.dll /TLB:DummyDLL.TLB /codebase /verbose" and got the following
1
2
3
4
5
6
7
8
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.3053
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

Types registered successfully
Type 'D' exported.
Type 'D' exported.
Type 'D' exported.
Assembly exported to 'E:\Release\DummyDLL.TLB', and the type library was registered successfully


ITypeLib Viewer shows this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Generated .IDL file (by the OLE/COM Object Viewer)
// 
// typelib filename: DummyDLL.TLB

[
  uuid(03279875-E6FF-4D56-B096-16EA9BEB4434),
  version(1.0)
]
library DummyDLL
{
    // TLib :     // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
    importlib("mscorlib.tlb");
    // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");

    // Forward declare all types defined in this typelib
    interface DummyDLL_Interface;
    dispinterface DummyDLL_Events;

    [
      odl,
      uuid(1AD5F0CD-0B34-41E5-B831-2A6A691F1371),
      version(1.0),
      dual,
      oleautomation,
        custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "DummyDLL.DummyDLL_Interface")    

    ]
    interface DummyDLL_Interface : IDispatch {
        [id(0x00000001)]
        HRESULT InternalError([out, retval] BSTR* pRetVal);
        [id(0x00000002)]
        HRESULT LastCommand([out, retval] BSTR* pRetVal);
        [id(0x00000003)]
        HRESULT JunkCommand([out, retval] VARIANT_BOOL* pRetVal);
    };

    [
      uuid(D03BB687-E84E-4BD0-8273-7E966F3C965A),
      version(1.0),
        custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "DummyDLL.DummyDLL_Events")    

    ]
    dispinterface DummyDLL_Events {
        properties:
        methods:
    };

    [
      uuid(70242E77-0027-411D-A59B-71FD12656C51),
      version(1.0),
        custom({0F21F359-AB84-41E8-9A78-36D110E6D2F9}, "DummyDLL.DummyDLL_Class")
    ]
    coclass DummyDLL_Class {
        interface _Object;
        [default] interface DummyDLL_Interface;
        [default, source] dispinterface DummyDLL_Events;
    };
};


The Compiled DummyDLL.dll & DummyDLL.TLB is also here -> http://www.pgp-protector.com/help/DummyDLL.zip
Can anyone help with this?
Topic archived. No new replies allowed.