Solved

SHGetMalloc not compiling

Posted on 1998-12-04
4
427 Views
Last Modified: 2010-04-04
I am using Delphi 3. The following code is not compiling. It gives the error 'Actual and formal parameters are different. What is the problem?

  Var
    alloc: IMalloc;
  Begin
    If Succeeded(SHGetMalloc(alloc)) Then Begin

I am using Delphi 3. I got the above code from a sample which is supposed to work. I have included ole2 unit.

Please help.
Sanjay
0
Comment
Question by:skanade
  • 2
4 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 1349269
Dosn't this procedure need as the first parameter dwMemContext (Longint) like the coGetMalloc equivalent procedure?
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1349270
uses shlobj, activex;
.
procedure TForm1.Button1Click(Sender: TObject);
var  alloc: IMAlloc;
begin
  if ShGetMalloc( alloc)=NOERROR then...
end;

0
 

Author Comment

by:skanade
ID: 1349271
Thanks! It worked. The real problem was that I used ole2 unit instead of activex. When I changed uses to use activex, my code worked as well. BTW, in the sample code, after calling Free on a Pidl, it calls Release as well:

      alloc.Free(pidl);
    {$IFNDEF VER100}
      alloc.Release;
    {$ENDIF}

Is a call to release necessary?

Thanks,
Sanjay
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1349272
As far as I know you don't need this in D3. From Delphi's help file:
"...
VER100      Always defined, indicating that this is version 10.0 of the Object Pascal compiler. Each version has corresponding predefined symbols; for example, version 10.1 would have VER101 defined, version 10.5 would have VER105 defined, and so on..."
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now