Skip to content

Instantly share code, notes, and snippets.

@ethanhs
Created June 7, 2015 21:11
Show Gist options
  • Save ethanhs/c171b429d9b48a2b3435 to your computer and use it in GitHub Desktop.
Save ethanhs/c171b429d9b48a2b3435 to your computer and use it in GitHub Desktop.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <commoncontrols.h>
#include <CommCtrl.h>
#include <shellapi.h>
HICON JumboIcon(LPTSTR pszPath)
{
//const int ILD_TRANSPARENT=1;
SHFILEINFO sfi;
if (!SHGetFileInfo(pszPath, 0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX)) return NULL;
IImageList *piml;
if (FAILED(SHGetImageList(SHIL_JUMBO, IID_PPV_ARGS(&piml)))) return NULL;
HICON hico;
piml->GetIcon(sfi.iIcon, ILD_TRANSPARENT, &hico);
piml->Release();
return hico;
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->tabWidget->setTabText(0,QString("Hi"));
LPTSTR pszPath = L"C:\\Users\\Ethan Smith\\Desktop\\foo.sb2";;
qDebug() << JumboIcon(pszPath);
}
MainWindow::~MainWindow()
{
delete ui;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment