Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SHGetMalloc not compiling

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

618 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