Archived

This topic is now archived and is closed to further replies.

COM problem

This topic is 5380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi! I wanted to call a simple COM interface method in an API application, but the visual C++ compiler says: "use of undefined type ''IActiveDesktop''". What''s the problem? I included all libs and head files which are necessary. IActiveDesktop* pIAD; CoInitialize ( NULL ); CoCreateInstance( CLSID_ActiveDesktop,NULL,CLSCTX_INPROC_SERVER,IID_IActiveDesktop,(void**) &pIAD ); pIAD->AddRef(); //no matter which method, compiler returns error bye chris

Share this post


Link to post
Share on other sites
- Include "wininet.h" *before* you include "shlobj.h"

- Make sure you have a reasonably up to date version of the Platform SDK and the paths for the header and lib files from that are ABOVE the default ones in MSVC (in Tools->Options->Directories)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
where can I get the latest version of the Platform SDK? I was at microsofts site, but its very confusing, cause there are many SDKs. And I'm not sure if the "Core SDK" is only for VS .NET...

bye chris

[edited by - Zoomby on March 25, 2003 9:22:39 AM]

Share this post


Link to post
Share on other sites
The SDK Update Site


From their FAQ: "Q: What version of Microsoft Visual Studio is required to build the Platform SDK samples?

To build the Platform SDK samples, you need either Microsoft Visual Studio® .NET or Microsoft Visual Studio 6.0 with Service Pack 5."


However, I haven't updated yet (I still have VC6 SP5) so I can't verify that the FAQ is correct.

[edited by - Solo on March 25, 2003 3:43:33 PM]

Share this post


Link to post
Share on other sites
If including wininet.h first isn''t fixing the problem with the old Platform SDK, you can persuade it to use the **beta** features:

do #define WINVER 0x500 **before** all your Windows header file includes - with that you should be able to use all the features that were "new" at the time the MSVC 6 version of the PSDK came out (i.e. Win98 stuff such as multi monitor and Active Desktop).

However you will be using **beta** symbols and libs so you''ll get a compilation warning about that and obviously some things added or fixed at the end of that PSDK beta won''t be right so I''d advise caution about actually shipping any app built with that symbol defined.

The Platform SDK is pretty neutral, and you mainly only care about the headers and libs so I think newer PSDKs should be fine for you with older versions of MSVC. I think all the warning they give on their site means is "we''re not TESTING or SUPPORTING these with MSVC 6 any more, *but* they''ll probably work fine" - that''s the way it''s been in the past.

For the ActiveDesktop stuff I''d say components you''d be more interested in are:

Shell, InetSDK, User

though I dunno if there''s any cross dependencies with the core headers.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites