Need to step through C++ COM code - how do I write an executable to hook into the code?

Hi,

We have a COM module written in C++ that is called very frequently from a web page. Now I need to debug this code and therefore I want to create another project (I'm using VS.NET) that calls the code so I can step through it. Well I haven't found a way to instantiate the main class; in fact when I include the header SelectOnChange.h I get some compiler errors:
c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(12): error C2065: 'CLSID_SelectOnChange' : undeclared identifier
c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(14): error C2065: 'ISelectOnChange' : undeclared identifier
c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(14): error C2065: 'IID_ISelectOnChange' : undeclared identifier
c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(14): error C2065: 'LIBID_CHANGELib' : undeclared identifier
c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(15): fatal error C1903: unable to recover from previous error(s); stopping compilation

SelectOnChange.h:
[code]
// SelectOnChange.h : Declaration of the CSelectOnChange

#ifndef __SELECTONCHANGE_H_
#define __SELECTONCHANGE_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CSelectOnChange
class ATL_NO_VTABLE CSelectOnChange :
      public CComObjectRootEx<CComSingleThreadModel>,
      public CComCoClass<CSelectOnChange, &CLSID_SelectOnChange>,
      public ISupportErrorInfo,
      public IDispatchImpl<ISelectOnChange, &IID_ISelectOnChange, &LIBID_CHANGELib>
{
public:
      CSelectOnChange()
      {
      }

DECLARE_REGISTRY_RESOURCEID(IDR_SELECTONCHANGE)
DECLARE_NOT_AGGREGATABLE(CSelectOnChange)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CSelectOnChange)
      COM_INTERFACE_ENTRY(ISelectOnChange)
      COM_INTERFACE_ENTRY(IDispatch)
      COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()

// ISupportsErrorInfo
      STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// ISelectOnChange
public:
      STDMETHOD(SelectOnChange)(/*[in]*/ BSTR compId, /*[in]*/ BSTR newVal, /*[in]*/ BSTR prevVal);
      STDMETHOD(CommitRollBack)(/*[in]*/ BSTR commitString);
      STDMETHOD(get_UnDisableString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(get_UnRequireString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(get_RequireString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(get_ExceptionString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(get_ErrorString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(get_AlertString)(/*[out, retval]*/ VARIANT *pVal);
      STDMETHOD(put_ProdLine)(/*[in]*/ BSTR newVal);
      STDMETHOD(put_QuoteId)(/*[in]*/ BSTR newVal);
      STDMETHOD(put_Account)(/*[in]*/ BSTR newVal);

private:
      CComVariant ExceptionString,RequiredString,UnRequireString,UndisableString,ErrorString,AlertString;
      CComBSTR prodLine,quoteId,AccountName;
};

#endif //__SELECTONCHANGE_H_
[/code]





Should I even include this header? The DLL entry point is in Change.cpp. Here is Change.h:
[code]


/* this ALWAYS GENERATED file contains the definitions for the interfaces */


 /* File created by MIDL compiler version 6.00.0361 */
/* at Tue Nov 16 09:19:22 2004
 */
/* Compiler settings for .\Change.idl:
    Oicf, W1, Zp8, env=Win32 (32b run)
    protocol : dce , ms_ext, c_ext, robust
    error checks: allocation ref bounds_check enum stub_data
    VC __declspec() decoration level:
         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING(  )

#pragma warning( disable: 4049 )  /* more than 64k source lines */


/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__

#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/

#ifndef __Change_h__
#define __Change_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */

#ifndef __ISelectOnChange_FWD_DEFINED__
#define __ISelectOnChange_FWD_DEFINED__
typedef interface ISelectOnChange ISelectOnChange;
#endif       /* __ISelectOnChange_FWD_DEFINED__ */


#ifndef __SelectOnChange_FWD_DEFINED__
#define __SelectOnChange_FWD_DEFINED__

#ifdef __cplusplus
typedef class SelectOnChange SelectOnChange;
#else
typedef struct SelectOnChange SelectOnChange;
#endif /* __cplusplus */

#endif       /* __SelectOnChange_FWD_DEFINED__ */


/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"

#ifdef __cplusplus
extern "C"{
#endif

void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );

#ifndef __ISelectOnChange_INTERFACE_DEFINED__
#define __ISelectOnChange_INTERFACE_DEFINED__

/* interface ISelectOnChange */
/* [unique][helpstring][dual][uuid][object] */


EXTERN_C const IID IID_ISelectOnChange;

#if defined(__cplusplus) && !defined(CINTERFACE)
   
    MIDL_INTERFACE("598BA394-9C36-4C91-A5BC-92FFE5219EEF")
    ISelectOnChange : public IDispatch
    {
    public:
        virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Account(
            /* [in] */ BSTR newVal) = 0;
       
        virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_QuoteId(
            /* [in] */ BSTR newVal) = 0;
       
        virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ProdLine(
            /* [in] */ BSTR newVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AlertString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ExceptionString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RequireString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_UnRequireString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_UnDisableString(
            /* [retval][out] */ VARIANT *pVal) = 0;
       
        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CommitRollBack(
            /* [in] */ BSTR commitString) = 0;
       
        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SelectOnChange(
            /* [in] */ BSTR compId,
            /* [in] */ BSTR newVal,
            /* [in] */ BSTR prevVal) = 0;
       
    };
   
#else       /* C style interface */

    typedef struct ISelectOnChangeVtbl
    {
        BEGIN_INTERFACE
       
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
            ISelectOnChange * This,
            /* [in] */ REFIID riid,
            /* [iid_is][out] */ void **ppvObject);
       
        ULONG ( STDMETHODCALLTYPE *AddRef )(
            ISelectOnChange * This);
       
        ULONG ( STDMETHODCALLTYPE *Release )(
            ISelectOnChange * This);
       
        HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
            ISelectOnChange * This,
            /* [out] */ UINT *pctinfo);
       
        HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
            ISelectOnChange * This,
            /* [in] */ UINT iTInfo,
            /* [in] */ LCID lcid,
            /* [out] */ ITypeInfo **ppTInfo);
       
        HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
            ISelectOnChange * This,
            /* [in] */ REFIID riid,
            /* [size_is][in] */ LPOLESTR *rgszNames,
            /* [in] */ UINT cNames,
            /* [in] */ LCID lcid,
            /* [size_is][out] */ DISPID *rgDispId);
       
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
            ISelectOnChange * This,
            /* [in] */ DISPID dispIdMember,
            /* [in] */ REFIID riid,
            /* [in] */ LCID lcid,
            /* [in] */ WORD wFlags,
            /* [out][in] */ DISPPARAMS *pDispParams,
            /* [out] */ VARIANT *pVarResult,
            /* [out] */ EXCEPINFO *pExcepInfo,
            /* [out] */ UINT *puArgErr);
       
        /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Account )(
            ISelectOnChange * This,
            /* [in] */ BSTR newVal);
       
        /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_QuoteId )(
            ISelectOnChange * This,
            /* [in] */ BSTR newVal);
       
        /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ProdLine )(
            ISelectOnChange * This,
            /* [in] */ BSTR newVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AlertString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ErrorString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExceptionString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequireString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_UnRequireString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_UnDisableString )(
            ISelectOnChange * This,
            /* [retval][out] */ VARIANT *pVal);
       
        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CommitRollBack )(
            ISelectOnChange * This,
            /* [in] */ BSTR commitString);
       
        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SelectOnChange )(
            ISelectOnChange * This,
            /* [in] */ BSTR compId,
            /* [in] */ BSTR newVal,
            /* [in] */ BSTR prevVal);
       
        END_INTERFACE
    } ISelectOnChangeVtbl;

    interface ISelectOnChange
    {
        CONST_VTBL struct ISelectOnChangeVtbl *lpVtbl;
    };

   

#ifdef COBJMACROS


#define ISelectOnChange_QueryInterface(This,riid,ppvObject)      \
    (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)

#define ISelectOnChange_AddRef(This)      \
    (This)->lpVtbl -> AddRef(This)

#define ISelectOnChange_Release(This)      \
    (This)->lpVtbl -> Release(This)


#define ISelectOnChange_GetTypeInfoCount(This,pctinfo)      \
    (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)

#define ISelectOnChange_GetTypeInfo(This,iTInfo,lcid,ppTInfo)      \
    (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)

#define ISelectOnChange_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)      \
    (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)

#define ISelectOnChange_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)      \
    (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


#define ISelectOnChange_put_Account(This,newVal)      \
    (This)->lpVtbl -> put_Account(This,newVal)

#define ISelectOnChange_put_QuoteId(This,newVal)      \
    (This)->lpVtbl -> put_QuoteId(This,newVal)

#define ISelectOnChange_put_ProdLine(This,newVal)      \
    (This)->lpVtbl -> put_ProdLine(This,newVal)

#define ISelectOnChange_get_AlertString(This,pVal)      \
    (This)->lpVtbl -> get_AlertString(This,pVal)

#define ISelectOnChange_get_ErrorString(This,pVal)      \
    (This)->lpVtbl -> get_ErrorString(This,pVal)

#define ISelectOnChange_get_ExceptionString(This,pVal)      \
    (This)->lpVtbl -> get_ExceptionString(This,pVal)

#define ISelectOnChange_get_RequireString(This,pVal)      \
    (This)->lpVtbl -> get_RequireString(This,pVal)

#define ISelectOnChange_get_UnRequireString(This,pVal)      \
    (This)->lpVtbl -> get_UnRequireString(This,pVal)

#define ISelectOnChange_get_UnDisableString(This,pVal)      \
    (This)->lpVtbl -> get_UnDisableString(This,pVal)

#define ISelectOnChange_CommitRollBack(This,commitString)      \
    (This)->lpVtbl -> CommitRollBack(This,commitString)

#define ISelectOnChange_SelectOnChange(This,compId,newVal,prevVal)      \
    (This)->lpVtbl -> SelectOnChange(This,compId,newVal,prevVal)

#endif /* COBJMACROS */


#endif       /* C style interface */



/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_put_Account_Proxy(
    ISelectOnChange * This,
    /* [in] */ BSTR newVal);


void __RPC_STUB ISelectOnChange_put_Account_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_put_QuoteId_Proxy(
    ISelectOnChange * This,
    /* [in] */ BSTR newVal);


void __RPC_STUB ISelectOnChange_put_QuoteId_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_put_ProdLine_Proxy(
    ISelectOnChange * This,
    /* [in] */ BSTR newVal);


void __RPC_STUB ISelectOnChange_put_ProdLine_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_AlertString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_AlertString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_ErrorString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_ErrorString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_ExceptionString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_ExceptionString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_RequireString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_RequireString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_UnRequireString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_UnRequireString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_get_UnDisableString_Proxy(
    ISelectOnChange * This,
    /* [retval][out] */ VARIANT *pVal);


void __RPC_STUB ISelectOnChange_get_UnDisableString_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_CommitRollBack_Proxy(
    ISelectOnChange * This,
    /* [in] */ BSTR commitString);


void __RPC_STUB ISelectOnChange_CommitRollBack_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISelectOnChange_SelectOnChange_Proxy(
    ISelectOnChange * This,
    /* [in] */ BSTR compId,
    /* [in] */ BSTR newVal,
    /* [in] */ BSTR prevVal);


void __RPC_STUB ISelectOnChange_SelectOnChange_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);



#endif       /* __ISelectOnChange_INTERFACE_DEFINED__ */



#ifndef __CHANGELib_LIBRARY_DEFINED__
#define __CHANGELib_LIBRARY_DEFINED__

/* library CHANGELib */
/* [helpstring][version][uuid] */


EXTERN_C const IID LIBID_CHANGELib;

EXTERN_C const CLSID CLSID_SelectOnChange;

#ifdef __cplusplus

class DECLSPEC_UUID("47DA3E91-702D-4214-B432-19A3DC0B89BB")
SelectOnChange;
#endif
#endif /* __CHANGELib_LIBRARY_DEFINED__ */

/* Additional Prototypes for ALL interfaces */

unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * );
unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * );
unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * );

unsigned long             __RPC_USER  VARIANT_UserSize(     unsigned long *, unsigned long            , VARIANT * );
unsigned char * __RPC_USER  VARIANT_UserMarshal(  unsigned long *, unsigned char *, VARIANT * );
unsigned char * __RPC_USER  VARIANT_UserUnmarshal(unsigned long *, unsigned char *, VARIANT * );
void                      __RPC_USER  VARIANT_UserFree(     unsigned long *, VARIANT * );

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif
[/code]



Thanks in advance!
Bryan_WebbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
>>in fact when I include the header SelectOnChange.h I get some compiler errors

The compiler is absolutely right here - you're lacking the declaration of 'ISelectOnChange'. You'll need to include the header file that has it before including SelectOnChange.h
0
Bryan_WebbAuthor Commented:
jkr,

Thank you for your quick response! Changing the order of which I include the headers did eliminate the compiler errors, but I still can't instantiate my class.

I guess I don't understand how the interface ISelectOnChange, SelectOnChange and CSelectOnChange are related. I cannot instantiate CSelectOnChange because it is abstract. When I try to instantiate SelectOnChange I get compiler error of "SelectOnChange has no constructors".

Your help will be appreciated!

Regards,
Bryan
0
jkrCommented:
Well, according to what you posted, it has a constructor:

public:
    CSelectOnChange()
    {
    }

and I can't spot any abstract methods. What is the compiler complaining about?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Bryan_WebbAuthor Commented:
SelectOnChange *soc = new SelectOnChange();
yields the compiler error:
c:\Inetpub\wwwroot\utilities\C Projects\TestChange\TestChange.cpp(18): error C2514: 'SelectOnChange' : class has no default constructor

while
CSelectOnChange *soc = new CSelectOnChange();
yields
c:\Inetpub\wwwroot\utilities\C Projects\TestChange\TestChange.cpp(19): error C2259: 'CSelectOnChange' : cannot instantiate abstract class

If I put both of these lines in, this is the result:
c:\Inetpub\wwwroot\utilities\C Projects\TestChange\TestChange.cpp(18): error C2514: 'SelectOnChange' : class has no constructors
c:\Inetpub\wwwroot\utilities\C Projects\TestChange\TestChange.cpp(19): error C2259: 'CSelectOnChange' : cannot instantiate abstract class
        due to following members:
        'HRESULT CSelectOnChange::QueryInterface(const IID &,void ** ) throw()' : pure virtual function was not defined
        c:\Inetpub\wwwroot\utilities\C Projects\Change\SelectOnChange.h(30) : see declaration of 'CSelectOnChange::QueryInterface'
        'ULONG CSelectOnChange::AddRef(void) throw()' : pure virtual function was not defined
0
jkrCommented:
Ah, now it's getting clearer - you need to implement all 'IUnknown' methods on your own.
0
ChizlCommented:
Why are you making this so difficult.   Just create a VBS file, put it under "Projects" | "Settings" | "Debug" to use "c:\winnt\system32\wscript.exe" as the executable and "<path of VBS>\test.vbs" under Program arguments.

Creating it for C++ is easy if you understand IDL files, but explaining what to look for is much more difficult.  Try the above in VBS and you will have no problem debugging.

I'll give my shot at trying to explain where and what you gotta look for to know what your interface is from C++.

If you go into your Test Project "Debug" directory you will find a "YourDLL.tlh".  Open it and you will find your interface..  The Interface usuaully looks something like this:
IYourObjectPtr or _YourObjectPtr

So first you will need to do something like this:
#import "FullPath\Your.dll" \
    no_namespace

Second:
_YourObjectClassPtr      pYourObjectClass = NULL;

Third:
pYourObjectClass.CreateInstance(__uuidof(YourObjectClass));

Now you should be able to access all the functions of pYourObjectClass object.
0
Bryan_WebbAuthor Commented:
Chizl,

I did what you suggested and yes I can access all the object methods but I can't step through the code still, which is what I really need. I guess by doing CreateObject I call the compiled code?
 
0
ChizlCommented:
Sounds like your compiler's Active Configuration isn't in Debug mode.
0
Bryan_WebbAuthor Commented:
Chizl,

It is in debug mode. The breakpoints I have set just don't fire. What could be the problem??

0
Bryan_WebbAuthor Commented:
This is the data under debugging in project properties:

Command:C:\WINDOWS\system32\wscript.exe
"c:\Inetpub\wwwroot\utilities\c projects\Change\Test\test.vbs"
0
Bryan_WebbAuthor Commented:
Sorry accidentally submitted. I meant to say:

This is the data under debugging in project properties:

Command:  C:\WINDOWS\system32\wscript.exe
Command Arguments:   "c:\Inetpub\wwwroot\utilities\c projects\Change\Test\test.vbs"

test.vbs:
Set oExcpObj = CreateObject("Change.SelectOnChange")    
oExcpObj.QuoteId = "03-0000-000-201-00-SMURF_3379"
oExcpObj.ProdLine = "LV_DSII_SWGR"
oExcpObj.Account = "production"
id = "03-0000-000-201-00-SMURF_3379"
curvalue = "LV_DSII_SWGR*global*inpTypesOfConstruction*PCR_mounted_flush_with_wall"
oldvalue = "Freestanding"
oExcpObj.SelectOnChange id,curvalue,oldvalue
tempAlertString = oExcpObj.AlertString
tempErrorString = oExcpObj.ErrorString
MsgBox("hej")
0
ChizlCommented:
Humm...   Sounds like a compiler issue if you can't debug your DLL.   May want to try updating service pack or reinstalling it.   This isn't a config issue, it's defenatly a versioning or corrupt issue.
0
Bryan_WebbAuthor Commented:
Chizl,

Thakns for your responses. I don't think  it it an issue with the compiler as I tried it on another machine. The last thing I tried was to create a C# project and go through COM Interop, as I read the following on MSDN:
___
You can also step between C++ code to any .NET Framework language and vice versa. Code written for .NET-based applications can work with C++ code through Platform Invoke, COM Interoperability, or through Managed Extensions for C++. You can seamlessly step into and debug from one language to the other, and again, the debugger will have a single callstack showing all the components. To enable debugging between the common language runtime code and C++ code running natively, you need to change an option in your launching project settings. In Solution Explorer, locate your startup project (this project's name will be bolded). This is the project that gets launched when you press F5. To debug both runtime code and native code, the startup project has to be configured to support both types of debugging. To do this, open your project properties and select the Debugging folder under Configuration Properties.

For Visual Basic .NET or Visual C#™ projects:
Make sure the Enable Unmanaged Debugging option is selected. In Visual Basic, this option is selected via a checkbox. In Visual C# this is a drop-down list option.
___


This is the C# code:
                  SelectOnChangeClass oExcpObj = new SelectOnChangeClass();
                  oExcpObj.QuoteId = "03-0000-000-201-00-SMURF_3379";
                  oExcpObj.ProdLine = "LV_DSII_SWGR";
                  oExcpObj.Account = "production";
                  string id = "03-0000-000-201-00-SMURF_3379";
                  string curvalue = "LV_DSII_SWGR*global*inpTypesOfConstruction*PCR_mounted_flush_with_wall";
                  string oldvalue = "Freestanding";
                  oExcpObj.SelectOnChange(id,curvalue,oldvalue);


I still can't step into the object methods. The reference added is pointing to the debug dll.



0
ChizlCommented:
Well I do this every day..   I run with VC6 with the latest SP.   Most all I develop are ATL/STL COM objects that are access by Extended Stored Procs or other C++/VB applications.   I have never heard of the issue you seem to be having.   I just throw a VBS out there and setup my compiler to debug, set my way points, and hit F5.

Sorry, but I can't think of anything else it could be.
0
Bryan_WebbAuthor Commented:
I'm running VS.NET - could that be the problem? I could install VC6 I guess.
0
Bryan_WebbAuthor Commented:
I installed VC6 and SP5 - same results.
0
moduloCommented:
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bryan_WebbAuthor Commented:
The problem was that I was running COM+. The IDE can't step between processes so once I uninstalled it from COM+ and registered the COM serevr using regsvr32 it worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.