🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10636

Re: trying to acces to a file by means of a link file

#10636
From: Damon Chandler (TeamB)
Date: Tue, 06 Apr 2004 13:19
45 lines
2684 bytes
Hi Frank,
   The HRESULT value of -2147221008 corresponds to the error 
"CoInitialize() has not been called."  You can determine this by 
including <ComObj.hpp>, and then by passing the return value of 
CoCreateInstance() to the OleCheck() VCL function.  In this case, 
OleCheck(-2147221008) returns the string "CoInitialize() has not been 
called."

So in your code, call...

   CoInitialize(NULL);
   //
   // add your code here...
   //
   CoUnintialize();

Alternatively, you can call CoInitialize(NULL) in your form's 
constructor, and then call CoUninitialize() in the destructor.

I read about the NO_WIN32_LEAN_AND_MEAN workaround in a post that 
someone had made to this group a while back.  Apprarently, the 
workaround was mentioned in a README file that accompanied either BCB5 
or BCB6 (I don't recall which, and I don't usually read README files to 
closely :).

Good luck,
--
Damon (TeamB)


Frank Chisme wrote:
> Hello Damon,
> 
> Now my compiler doesn�t give an error (with the NO_WIN32_LEAN_AND_MEAN
> conditional), but the function:
> 
>  if (SUCCEEDED(CoCreateInstance(CLSID_ShellLink,
> NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(void **)&psl))) {
> 
> gives an error (not SUCCEDDED). But I don�t know how to solve it, in fact, I
> even don�t know which the error is. All I have achieved is to know that the
> error si -2147221008
> 
> And how did you figure out that it was mandatory to establish the
> NO_WIN32_LEAN_AND_MEAN conditional?
Technical Details
Message-ID: <4072adfa$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <406c1fc2$1@newsgroups.borland.com> <406cbe4b$1@newsgroups.borland.com> <406d38cc$1@newsgroups.borland.com> <406d644f$1@newsgroups.borland.com> <40726d3a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,a53a58dfad4a9f1a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-06 06:40:16 PST
Date: Tue, 06 Apr 2004 09:19:11 -0400
From: "Damon Chandler (TeamB)" <dmc27@cornell.edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: trying to acces to a file by means of a link file
References: <406c1fc2$1@newsgroups.borland.com> <406cbe4b$1@newsgroups.borland.com> <406d38cc$1@newsgroups.borland.com> <406d644f$1@newsgroups.borland.com> <40726d3a@newsgroups.borland.com>
In-Reply-To: <40726d3a@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 24.58.5.101
Message-ID: <4072adfa$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081257466 24.58.5.101 (6 Apr 2004 06:17:46 -0800)
Lines: 45
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail