Can't see IActiveDesktop?

This is a discussion on Can't see IActiveDesktop? within the C++ Programming forums, part of the General Programming Boards category; I'm fiddling with COM and as a first program I thought I'd have a fiddle with IActiveDesktop. According to MSDN ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Can't see IActiveDesktop?

    I'm fiddling with COM and as a first program I thought I'd have a fiddle with IActiveDesktop. According to MSDN I need to include shlobj.h, which I do, but this code fails to compile:

    Code:
    #include <iostream>
    #include <windows.h>
    #include <shobjidl.h>
    #include <shlguid.h>
    #include <shlobj.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        HRESULT hr = 0;
        IShellLink *pISL;
        IActiveDesktop *pIAD;
    
        CoInitialize(0);
    
        hr = CoCreateInstance(CLSID_ShellLink,
                              NULL, // no aggregation
                              CLSCTX_INPROC_SERVER,
                              IID_IShellLink,
                              (void **) &pISL);
    
        if (SUCCEEDED(hr))
        {
    
            pISL->Release();
        }
        else
        {
            CoUninitialize();
            cout << "Error creating COM object [" << hr << "]" << endl;
            return -1;
        }
    
        CoUninitialize();
        return 0;
    }
    (I was looking at IShellLink too).

    Errors:

    Code:
    c:\Documents and Settings\lee\Desktop\COMStuff\COMStuff.cpp(12) : error C2065: 'IActiveDesktop' : undeclared identifier
    c:\Documents and Settings\lee\Desktop\COMStuff\COMStuff.cpp(12) : error C2065: 'pIAD' : undeclared identifier
    Am I missing something here? If I right click IActiveDesktop and "Go to definition" it takes me to shlobj.h so I know it's there.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    It's ok I had a search for IActiveDesktop on koders and found that some software used wininet.h too. Why the hell doesn't MSDN say that? Or any of the tutorials you read?

    Stoopid world.

    EDIT: While on the subject, are there any good tutorials out there? The best one I've found was on codeproject and the MSDN docs are quite easy to follow. I just thought there would have been more articles on it.
    Last edited by cboard_member; 04-07-2006 at 02:16 AM.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WChar to char
    By MK4554 in forum C++ Programming
    Replies: 19
    Last Post: 04-20-2006, 12:14 AM
  2. IActiveDesktop
    By MK4554 in forum C Programming
    Replies: 0
    Last Post: 04-02-2006, 11:35 AM
  3. COM and IActiveDesktop
    By dalek in forum Windows Programming
    Replies: 14
    Last Post: 04-17-2004, 08:59 PM
  4. wallpaper option
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 08-29-2001, 03:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21