?
Solved

SHGetMalloc not compiling

Posted on 1998-12-04
4
Medium Priority
?
431 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 200 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

764 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