Solved

SHGetMalloc not compiling

Posted on 1998-12-04
4
423 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

17 Experts available now in Live!

Get 1:1 Help Now