Created
September 3, 2014 15:47
-
-
Save ynkdir/af96e73b7ab1cbf01032 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// > cl /LD set_icon.c user32.lib | |
// :call libcallnr('path/to/set_icon.dll', 'set_icon', v:windowid . ',' . 'path/to/myvim.ico') | |
#include <windows.h> | |
#include <stdio.h> | |
__declspec(dllexport) int set_icon(char **args) | |
{ | |
HWND hWnd; | |
char iconpath[1024]; | |
HICON hIcon; | |
if (sscanf(args, "%d,%s", &hWnd, &iconpath) != 2) | |
return -1; | |
hIcon = (HICON)LoadImage(NULL, iconpath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | |
if (hIcon == NULL) | |
return -2; | |
SendMessage(hWnd, WM_SETICON, ICON_BIG, hIcon); | |
SendMessage(hWnd, WM_SETICON, ICON_SMALL, hIcon); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment