Page 1 of 1

C++ Builder

PostPosted: Tue Apr 07, 2020 2:06 pm
by AndyBell

Are there any examples of using MadShell for C++ Builder?

I have no Pascal knowledge and the generated .hpp files aren't making any sense to me...


Re: C++ Builder

PostPosted: Wed Apr 08, 2020 10:19 am
by madshi
Something like this seems to work for me:

Code: Select all
#include "madShell.h"

  _di_IShortCut shortCut = NewShortCut("D:\\Desktop\\test.exe");
  shortCut->WorkingDir = "D:\\Desktop";
  shortCut->ShowCmd    = SW_SHOWMAXIMIZED;

Generally, madShell uses Delphi type interfaces which are reference counted and automatically freed by the compiler. So you don't have to free/release "shortCut" in the example above, it's done automatically by Delphi/C++.

Re: C++ Builder

PostPosted: Wed Jun 03, 2020 7:15 pm
by AndyBell

Thanks for the tip and sorry for not replying sooner...

Using the LMD shell notify component, I'm getting a PItemIDList for, say, the Drive Add event.

I use this code to get the _di_IIDList:

_di_IIDList list = IDList(aPIDL);

But I can't get any useful info from this. For example, if I try:

_di_IIDList b = list->GetPath();
String c = b->GetStrBuf();

to get some info about the Drive that's been added, variable c is null. The _di_IIDList returned by GetPath(); seems to be a valid object.

The docs on IIDList seem to indicate that GetPath and GetStrBuf should return what I'm after, but I can't make them work...


Re: C++ Builder

PostPosted: Thu Jun 04, 2020 9:00 am
by madshi
Are you sure that the PIDL is both valid and absolute? If it's a relative PIDL, then madShell won't be able to interpret it without having a reference to the "parent folder".

For example, if you were to ask properties about a folder named "Bla", then you would not get any useful results, unless you provide the full path (e.g. "C:\Program Files\Bla"), not just the relative path "Bla".