Click here to Skip to main content
16,004,453 members
Home / Discussions / COM
   

COM

 
QuestionCross platform development with object inheritance from compiled DLLs. Pin
KernelTintin24-Jul-08 15:43
KernelTintin24-Jul-08 15:43 
QuestionHow to pass Array of objects from com TO C# Pin
sivasankar anumula22-Jul-08 22:06
sivasankar anumula22-Jul-08 22:06 
QuestionHow to find reference count Pin
Ramu.e21-Jul-08 19:58
Ramu.e21-Jul-08 19:58 
AnswerRe: How to find reference count Pin
CPallini21-Jul-08 21:43
mveCPallini21-Jul-08 21:43 
QuestionCompilation error: Cannot convert char to LPWSTR Pin
V K 220-Jul-08 19:43
V K 220-Jul-08 19:43 
QuestionRe: Compilation error: Cannot convert char to LPWSTR Pin
CPallini20-Jul-08 22:46
mveCPallini20-Jul-08 22:46 
AnswerRe: Compilation error: Cannot convert char to LPWSTR Pin
Member 37611484-Aug-08 19:14
Member 37611484-Aug-08 19:14 
QuestionInstantiating COM objects Pin
Member 465324617-Jul-08 10:47
Member 465324617-Jul-08 10:47 
Hey guys,

I don't know much Windows programming (and my C++ is a little rusty), I'm hoping you all can give me a hand. I'm trying to instantiate an IShellMenu object (http://msdn.microsoft.com/en-us/library/bb774901(VS.85).aspx).

MSDN says to create an object I need to: "call CoCreateInstance with the rclsid parameter set to CLSID_MenuBand and the riid parameter set to IID_IShellMenu. You must first initialize the interface by calling IShellMenu::Initialize, and then initialize the menu band by calling IShellMenu::SetShellFolder."

The first step is easy enough, I'm doing this:

IShellMenu *aTest;
HRESULT aRes = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu, (void **)&aTest);


But I'm running into trouble when I call aTest->Initialize(). More specifically, the first parameter needs to a pointer to an IShellMenuCallback object and I can't figure out how to instantiate something that implements that interface. Ideally, this is what I'd like to do:

class CallbackTestImpl1 : public IShellMenuCallback
{
public:
    CallbackTestImpl1() { }
    ~CallbackTestImpl1() { }

    // Implement the virtual method
    HRESULT STDMETHODCALLTYPE IShellMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
        return S_OK;
    }
};

IShellMenu *aTest;
HRESULT aRes = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu, (void **)&aTest);
IShellMenuCallback *aCallbackTest = new CallbackTestImpl1();
aRes = aTest->Initialize(aCallbackTest, -1, ANCESTORDEFAULT, SMINIT_DEFAULT);


However, Visual Studio complains about my new CallbackTestImpl1() line claiming that it cannot instantiate abstract class. I've looked through the header file that declares IShellMenuCallback (shobjidl.h) and can't find any other methods that I'm not implementing. Am I missing something obvious or is there a better way to instantiate something that implements the IShellMenuCallback interface?

Any help would be much appreciated!
AnswerRe: Instantiating COM objects Pin
Member 69787017-Jul-08 11:20
Member 69787017-Jul-08 11:20 
AnswerRe: Instantiating COM objects Pin
ekklesia30-Jul-08 16:05
ekklesia30-Jul-08 16:05 
QuestionAll instances of a class? Pin
jsp_clarke17-Jul-08 0:39
jsp_clarke17-Jul-08 0:39 
QuestionPass Parameter to Activex using HTML Pin
_tasleem16-Jul-08 21:27
_tasleem16-Jul-08 21:27 
QuestionDoes _IDTExtensiblity2 interface work for OE/ Windows Mail addins? Pin
dolly16-Jul-08 0:12
dolly16-Jul-08 0:12 
GeneralNEW to COM Pin
kDevloper15-Jul-08 2:12
kDevloper15-Jul-08 2:12 
GeneralRe: NEW to COM Pin
Perspx15-Jul-08 10:54
Perspx15-Jul-08 10:54 
GeneralRe: NEW to COM Pin
kDevloper15-Jul-08 18:41
kDevloper15-Jul-08 18:41 
GeneralRe: NEW to COM Pin
Perspx15-Jul-08 19:51
Perspx15-Jul-08 19:51 
GeneralRe: NEW to COM Pin
kDevloper15-Jul-08 20:32
kDevloper15-Jul-08 20:32 
GeneralRe: NEW to COM Pin
Michael Dunn22-Jul-08 11:45
sitebuilderMichael Dunn22-Jul-08 11:45 
GeneralRe: NEW to COM Pin
kDevloper25-Jul-08 20:10
kDevloper25-Jul-08 20:10 
QuestionREMOTE DESKTOP COM ACTIVE X CONTROL Pin
dementia12314-Jul-08 3:44
dementia12314-Jul-08 3:44 
AnswerRe: REMOTE DESKTOP COM ACTIVE X CONTROL Pin
dementia1231-Aug-08 9:16
dementia1231-Aug-08 9:16 
QuestionPassing C# exception through COM to get _com_error Pin
Green Fuze12-Jul-08 23:51
Green Fuze12-Jul-08 23:51 
QuestionQuestion regarding path - dumb question.... Pin
1.21 Gigawatts11-Jul-08 1:19
1.21 Gigawatts11-Jul-08 1:19 
AnswerRe: Question regarding path - dumb question.... Pin
Baltoro19-Jul-08 7:44
Baltoro19-Jul-08 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.