"change folder icon with python" Code Answer's

You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "change folder icon with python" answered properly. Developers are finding an appropriate answer about change folder icon with python related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like change folder icon with python. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on change folder icon with python. 

change folder icon with python

By Silly SlothSilly Sloth on May 14, 2021
import os
import ctypes
from ctypes import POINTER, Structure, c_wchar, c_int, sizeof, byref
from ctypes.wintypes import BYTE, WORD, DWORD, LPWSTR, LPSTR
import win32api    

HICON = c_int
LPTSTR = LPWSTR
TCHAR = c_wchar
MAX_PATH = 260
FCSM_ICONFILE = 0x00000010
FCS_FORCEWRITE = 0x00000002
SHGFI_ICONLOCATION = 0x000001000    

class GUID(Structure):
    _fields_ = [
        ('Data1', DWORD),
        ('Data2', WORD),
        ('Data3', WORD),
        ('Data4', BYTE * 8)]

class SHFOLDERCUSTOMSETTINGS(Structure):
    _fields_ = [
        ('dwSize', DWORD),
        ('dwMask', DWORD),
        ('pvid', POINTER(GUID)),
        ('pszWebViewTemplate', LPTSTR),
        ('cchWebViewTemplate', DWORD),
        ('pszWebViewTemplateVersion', LPTSTR),
        ('pszInfoTip', LPTSTR),
        ('cchInfoTip', DWORD),
        ('pclsid', POINTER(GUID)),
        ('dwFlags', DWORD),
        ('pszIconFile', LPTSTR),
        ('cchIconFile', DWORD),
        ('iIconIndex', c_int),
        ('pszLogo', LPTSTR),
        ('cchLogo', DWORD)]

class SHFILEINFO(Structure):
    _fields_ = [
        ('hIcon', HICON),
        ('iIcon', c_int),
        ('dwAttributes', DWORD),
        ('szDisplayName', TCHAR * MAX_PATH),
        ('szTypeName', TCHAR * 80)]    

def seticon(folderpath, iconpath, iconindex):
    """Set folder icon.

    >>> seticon(".", "C:\\Windows\\system32\\SHELL32.dll", 10)

    """
    shell32 = ctypes.windll.shell32

    folderpath = unicode(os.path.abspath(folderpath), 'mbcs')
    iconpath = unicode(os.path.abspath(iconpath), 'mbcs')

    fcs = SHFOLDERCUSTOMSETTINGS()
    fcs.dwSize = sizeof(fcs)
    fcs.dwMask = FCSM_ICONFILE
    fcs.pszIconFile = iconpath
    fcs.cchIconFile = 0
    fcs.iIconIndex = iconindex

    hr = shell32.SHGetSetFolderCustomSettings(byref(fcs), folderpath,
                                              FCS_FORCEWRITE)
    if hr:
        raise WindowsError(win32api.FormatMessage(hr))

    sfi = SHFILEINFO()
    hr = shell32.SHGetFileInfoW(folderpath, 0, byref(sfi), sizeof(sfi),
                                SHGFI_ICONLOCATION)
    if hr == 0:
        raise WindowsError(win32api.FormatMessage(hr))

    index = shell32.Shell_GetCachedImageIndexW(sfi.szDisplayName, sfi.iIcon, 0)
    if index == -1:
        raise WindowsError()

    shell32.SHUpdateImageW(sfi.szDisplayName, sfi.iIcon, 0, index)

Source: stackoverflow.com

Add Comment

0

All those coders who are working on the Whatever based application and are stuck on change folder icon with python can get a collection of related answers to their query. Programmers need to enter their query on change folder icon with python related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about change folder icon with python for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of change folder icon with python while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "change folder icon with python". Visit this developer's friendly online web community, CodeProZone, and get your queries like change folder icon with python resolved professionally and stay updated to the latest Whatever updates. 

Whatever answers related to "change folder icon with python"

View All Whatever queries

Whatever queries related to "change folder icon with python"

change folder icon with python How to add icon to mat-icon-button how to add an icon in the Material UI Text Field and show tooltip for that icon star icon border, hollow icon bookmark fevorite how specify authentication not required for for folder in htaccess folder stackoverflow How to change the “recent apps tray” icon on android? dev change icon dynamically chrome extension developer material ui change icon size on xs screen Explain why Boehm’s spiral model is an adaptable model that can support both change avoidance and change tolerance activities "write code to change the value of a pointer. write code to change the value to which the pointer points" mdi icon size and color how to align custom icon without font awesome bootstrap 4 button with icon font awesome icon showing square how to rotate icon or text in flutter button with icon rails How to make mat-icon disabled in angular? release icon font awesome ie showing close icon show disabled icon on disabled button flutter icon button remove min size no icon in task bar cross icon flutter icon as button flutter how to put the search icon within the search bar flutter appbar icon center customize navbar-toggler-icon instagram icon font awesome pencil icon notification icon badge android icon-chevron why isnt my icon showing up on my visual studio form search view icon color 3d touch flutter app icon matterial button with icon only android p-tabview icon sementic ui icon seller icon font awesome firebase notification icon not showing close icon uitextfield add image icon right Icon button color is not visible bootsrap icon button codepen apple-touch-icon in blogger what size is google play apps icon fa fa icon call string data to icon in flutter launcher icon not showing in android push notification team fortress 2 icon ui lable with icon to the left end icon flutter textfield icon pacs circular icon button flutter how to use bootstrap icon after npm install document.querySelector("body > ntp-app").shadowRoot.querySelector("#mostVisited").shadowRoot.querySelector("#container > a:nth-child(3) > div.tile-icon > img") vector icon color always black kubernetes clusters icon semantic ui clickable icon wpf material design icon button aws copy folder from local to s3 cmd to copy file to another folder in mac how to access startup folder windows 10 how delete folder terminal mac shortcut for creating a new folder how to open current folder in terminal mac tar folder macos vs code a project folder from the command line mac osx open folder from cli INNO setup check if folder exists terraform s3 create folder how to delete a folder from aws s3 bucket using commands how to covert whole folder of jpg images to png using imagemagick epic games rocket league folder the sims 4 mods folder collection folder api prettier "folder" format command line windows create folder with . deleting everything inside a folder using batch unzip destination folder unzip specific folder linux android tablet resource folder Trellis project folder structure django give access to media folder .m2 folder in unix Could not scan for classes inside which d oes not appear to be a file nor a folder run yarn in folder vs code wont open folder how to move another item into another folder on the command line what to do if the image is not present in drawable folder of android studio i3wm save folder windows stretched how to find pandoc template folder How to delete image from folder in Android programmatically find type of files in folder npx create-react-app current folder rename folder shortcut html incliude all css from folder Install React Navigation into main project folder zip a folder in colab bash batch remove string from folder names Install React Navigation dependencies into main project folder convert folder to zip command line fs get random file in folder pyrebase download folder windows folder needs permissions sharepoint logs folder htdocs folder collection folder svn exclude bin obj folder Deleting all files from the cache folder in ionic vscode search in folder shortcut to create a new folder in windows 10 shortcut for making new folder node.js folder structure Where does maven store all dependencies in computer folder structure? applescript get all files in folder with extension desktop background change with python change port in spring boot how to change sweet alert 2 theme in react change default branch github how to change 404 page in apache change record location vlc change table size latex change column type snowflake ionic 5 change app name change the color of the description of a url latex flutter change beta fo stabel how to change status bar color change src with inpute type="file" change directory in cmd doesn't work when does change detection get triggered in angular change woocommerce default sort order flutter change color of circular progress indicator wordpress change favicon change file recursively stepper button color change flutter expo cli change account how to change background color of list view in flutter change wrd port number for cmd xamarin uwp RequestedTheme="Light" change button style ios emulator change to dark mode change max upload size wordpress htaccess status change is last week identity server change login url ionic change size of label godot change collision shape size how to change global variable in batch How to Change BASH Prompt Color change theme by jupyterthemes textarea ng-change vim change language highlighting bootstrap nav tab change url change font programmatically android jupyter notebook change ip address How to change color VSCode change vs code title bar theme color aws cli ec2 how to change IAM role how to change endpoint for each image upload uppy aws configure change default profile bootstrap change column width how to change array value mongodb how to change directory in terminal mac change background create_text tkinter c++ change cursor color shortcut to change case in eclipse change dns in openvpn config latex change section style hockey how does the logo change change nan to 0 power bi c programm pointer change in function change sagemath prompt color how to change current cluster config how to change the font size of a uilabel change items loop how to change pause text .bat how to change order in bar chart r how to change the layout of view in mvc aws route53 change-batch change div background color when radio button selected unbuntu shortcut change tab from same kind of window how to change color of date input android change time zone using adb change images click div Change the button text to say "Click me to toggle a hidden secret!" and make the text toggle between fading in and out each time it is clicked. change tick size ggplot change file content bash how to change domain name in heroku change default boot grub roblox studio change size script change kernel from a jupyter cell change node version [https://github.com/nvm-sh/nvm] flutter google map change camera position change next port how to change the position input file magento 2 change customer group programmatically how to change date format in excel how to change windows wallpaper from command line how can we change alphabet in text 3 Django LogEntry or Change History

Browse Other Code Languages

CodeProZone