Skip to main content
Inspiring
November 11, 2016
Question

PNGArt class on Windows

  • November 11, 2016
  • 1 reply
  • 340 views

Hello,

I am using the PNGArt class to load a png file to display in my plugin and this works fine on Mac OS X.

But on Windows nothing is displayed, which I think is strange.

I use the following code:

  PNGArt *pa = new PNGArt();

  bool isAValidSysFile = false;

  IDFile thumbFile = FileUtils::FileURLToSysFile(PMString(thumbimgfile.c_str()), &isAValidSysFile);

  if (isAValidSysFile)

  {

  pa->SetFile(thumbFile);

  PMMatrix identityMatrix;

  pa->Draw(gPort, identityMatrix, 0);

  }

  delete pa;

I am using this in a class that inherits from CControlView.

I also tried using the SHGetFileInfo method, but that does not work either:

// WERKT NIET

//SHFILEINFO info;

//::SHGetFileInfo(L”thumb.png"/*thumbimgfileStr.c_str()*/, 0, &info, sizeof(info), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_SHELLICONSIZE | SHGFI_TYPENAME | SHGFI_DISPLAYNAME);

//RsrcID iconID = (RsrcID)info.hIcon;

//

//

//

//PNGIcon thumbnailPNG;

//thumbnailPNG.LoadIcon(kJCPluginID, iconID);

//thumbnailPNG.DrawIcon(gPort);

But the following works, but is not what I need:

// dit werkt wel.. maar is niet zoals het moet.

//PNGIcon thumbnailPNG;

//thumbnailPNG.LoadIcon(pluginid, someresourceid);

//thumbnailPNG.DrawIcon(gPort);

What do I need to do to be able to display the icon in the Windows version?

This topic has been closed for replies.

1 reply

Inspiring
November 15, 2016

Problem solved and had nothing to do with PNGArt class.