C++ Builder

delphi package - easy access to shell apis

C++ Builder

Postby AndyBell » Tue Apr 07, 2020 2:06 pm

Hi

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...

Andy
AndyBell
 
Posts: 2
Joined: Tue Apr 07, 2020 2:04 pm

Re: C++ Builder

Postby madshi » Wed Apr 08, 2020 10:19 am

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;
  shortCut->Save("D:\\desktop\\test.lnk");

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++.
madshi
Site Admin
 
Posts: 10305
Joined: Sun Mar 21, 2004 5:25 pm

Re: C++ Builder

Postby AndyBell » Wed Jun 03, 2020 7:15 pm

Hi

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...

Andy
AndyBell
 
Posts: 2
Joined: Tue Apr 07, 2020 2:04 pm

Re: C++ Builder

Postby madshi » Thu Jun 04, 2020 9:00 am

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".
madshi
Site Admin
 
Posts: 10305
Joined: Sun Mar 21, 2004 5:25 pm


Return to madShell

Who is online

Users browsing this forum: No registered users and 1 guest

cron