mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fix for win32 file icon extraction.
This commit is contained in:
parent
5b92d8cc8f
commit
5fc80a9b79
4 changed files with 40 additions and 27 deletions
|
|
@ -37,7 +37,7 @@ DirectoryContentsList::DirectoryContentsList (const FileFilter* const fileFilter
|
|||
|
||||
DirectoryContentsList::~DirectoryContentsList()
|
||||
{
|
||||
clear();
|
||||
stopSearching();
|
||||
}
|
||||
|
||||
void DirectoryContentsList::setIgnoresHiddenFiles (const bool shouldIgnoreHiddenFiles)
|
||||
|
|
@ -88,12 +88,16 @@ void DirectoryContentsList::setTypeFlags (const int newFlags)
|
|||
}
|
||||
}
|
||||
|
||||
void DirectoryContentsList::clear()
|
||||
void DirectoryContentsList::stopSearching()
|
||||
{
|
||||
shouldStop = true;
|
||||
thread.removeTimeSliceClient (this);
|
||||
|
||||
fileFindHandle = nullptr;
|
||||
}
|
||||
|
||||
void DirectoryContentsList::clear()
|
||||
{
|
||||
stopSearching();
|
||||
|
||||
if (files.size() > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ private:
|
|||
ScopedPointer <DirectoryIterator> fileFindHandle;
|
||||
bool volatile shouldStop;
|
||||
|
||||
void stopSearching();
|
||||
void changed();
|
||||
bool checkNextFile (bool& hasChanged);
|
||||
bool addFile (const File& file, bool isDir,
|
||||
|
|
|
|||
|
|
@ -2874,13 +2874,20 @@ void Desktop::getCurrentMonitorPositions (Array <Rectangle<int> >& monitorCoords
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
static HICON extractFileHICON (const File& file)
|
||||
{
|
||||
WORD iconNum = 0;
|
||||
WCHAR name [MAX_PATH * 2];
|
||||
file.getFullPathName().copyToUTF16 (name, sizeof (name));
|
||||
|
||||
return ExtractAssociatedIcon ((HINSTANCE) Process::getCurrentModuleInstanceHandle(),
|
||||
name, &iconNum);
|
||||
}
|
||||
|
||||
Image juce_createIconForFile (const File& file)
|
||||
{
|
||||
Image image;
|
||||
WORD iconNum = 0;
|
||||
|
||||
HICON icon = ExtractAssociatedIcon ((HINSTANCE) Process::getCurrentModuleInstanceHandle(),
|
||||
const_cast <WCHAR*> (file.getFullPathName().toWideCharPointer()), &iconNum);
|
||||
HICON icon = extractFileHICON (file);
|
||||
|
||||
if (icon != 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue