Solved

SHGetMalloc not compiling

Posted on 1998-12-04
4
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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