Advertisement

COM problem

Started by March 24, 2003 02:35 PM
6 comments, last by Zoomby 21 years, 7 months ago
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
- 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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Advertisement
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]
Oh man, I think you''re right. The latest Platform SDK is .Net only (went that way sometime last year). You need to get the mid-2002 Platform SDK...
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Alright, but where to get older SDKs?

bye
chris
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]
// Ryan
Advertisement
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

thanks for all the replies!
bye
chris

This topic is closed to new replies.

Advertisement