From ed98242af851d0745446701f2133fd604c695524 Mon Sep 17 00:00:00 2001 From: winsped <248554933+snow32a@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:25:01 +0300 Subject: [PATCH] implementation of channel icons --- discordapi.h | 4 ++-- main.c | 16 ++++++++++++---- rc/res.h | 1 + rc/res.o | Bin 144154 -> 145020 bytes rc/res.rc | 1 + rc/tc.bmp | Bin 0 -> 822 bytes 6 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 rc/tc.bmp diff --git a/discordapi.h b/discordapi.h index 891d021..a1e576b 100755 --- a/discordapi.h +++ b/discordapi.h @@ -3,9 +3,9 @@ int DiscordSendMessage(const char *channelID, const char* content); int DiscordListGuildChannels(char* guildID, DiscordChannel** out); #define GUILD_TEXT 0 -#define CHANNEL_TYPE_DM 1 +#define DM_CHANNEL 1 #define GUILD_VOICE 2 -#define GROUPCHAT 3 +#define GROUPCHAT_CHANNEL 3 #define GUILD_CATEGORY 4 #define GUILD_ANNOUNCEMENT 5 int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs); diff --git a/main.c b/main.c index 72cd4c6..10b79d9 100755 --- a/main.c +++ b/main.c @@ -72,6 +72,7 @@ int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, PSTR pCmdLine, InitSnowsControls(); hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1); hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1); + ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_TC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255)); hInstance = hinstance; @@ -272,6 +273,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, TVS_LINESATROOT | TVS_HASBUTTONS, 90, 0, 128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL); + TreeView_SetImageList(hChTree, hChannelImgList, 0); hDMsList = CreateWindowExA( WS_EX_CLIENTEDGE, WC_LISTVIEWA, NULL, WS_CHILD | WS_VISIBLE, 90, 0, 128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL); @@ -389,7 +391,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, HTREEITEM hParent = TVI_ROOT; int pfpidx = 0; for (int i = 0; i < cnt; i++) { - if (dms[i].type == CHANNEL_TYPE_DM) { + if (dms[i].type == DM_CHANNEL) { printf("%s\n", dms[i].receipents[0].Username); if (dms[i].receipents[0].avatar) { @@ -456,7 +458,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, channel_compare, NULL, NULL); for (int i = 0; i < ChannelCount; i++) { char *VisualName; - VisualName = malloc(strlen(Channels[i].name+1)); + VisualName = malloc(strlen(Channels[i].name)+1); strcpy(VisualName, Channels[i].name); TVINSERTSTRUCT tvInsert = {0}; HTREEITEM hParent = TVI_ROOT; @@ -473,12 +475,18 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, tvInsert.hParent = hParent; // Parent is the root item tvInsert.hInsertAfter = TVI_LAST; tvInsert.item.mask = - TVIF_TEXT | TVIF_PARAM | TVIF_STATE; + TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE; tvInsert.item.pszText = (VisualName); tvInsert.item.lParam = (LPARAM) & (Channels[i]); tvInsert.item.state = TVIS_EXPANDED; tvInsert.item.stateMask = TVIS_EXPANDED; - + if(Channels[i].type==GUILD_VOICE){ + tvInsert.item.iImage=1; + }else if(Channels[i].type==GUILD_ANNOUNCEMENT){ + tvInsert.item.iImage=2; + }else{ + tvInsert.item.iImage=0; + } HTREEITEM lres = (HTREEITEM)SendMessage( hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert); if (Channels[i].type == GUILD_CATEGORY) { diff --git a/rc/res.h b/rc/res.h index 4049a05..e5da783 100644 --- a/rc/res.h +++ b/rc/res.h @@ -1,4 +1,5 @@ #define IDI_BACKCORDIC 101 #define IDI_BACKCORDBANNERIC 102 +#define IDI_CHANNEL_TC 110 #define IDI_CHANNEL_VC 111 #define IDI_CHANNEL_ANC 112 \ No newline at end of file diff --git a/rc/res.o b/rc/res.o index 3ee846f72381091a8eb1801b07f46e5d643334ff..29e82c5e343f7f3a625de06b7eec427b2431e8ec 100644 GIT binary patch delta 820 zcmbRBjN{K64lW-?Mg|Z_Gn>dICHTXXiNS_}fx*O#2_(qCI?+_wa03HF1DFRVSQye6 z7#IQ=7#i{z7#K1b7#i{!z=|3Q7#J94Ol%aNctV7glZAod!^Dl^h71rZ;My4&7#Tp4 z0$9XT85kH&Ol%Z)Q($CZFkob0sBu83+Th5@puvnV=Y|U-!wCeJVSy_ng9}1A!wa`& zJ;v>NjEr*}q$D8fm>C#^xFHxKz`!thp@)sc0WkQF1i%6ZCNK05m4>K1aNq!38ZH8o zuZQy>dJY^ofF=Uh_y7NYh!h&h$;k;9LAD2%dbnZ+28ILrNDhPB1W|!(7F-16W&(ba z0Linnv!m&Uh=BBi{0!kC+XxXs)|lVb1>#OzBv?870UaEEW@l%II|yPoJ3IU2 vg&qni0I6LgHvj+t diff --git a/rc/res.rc b/rc/res.rc index d4231b6..653de46 100644 --- a/rc/res.rc +++ b/rc/res.rc @@ -2,5 +2,6 @@ IDI_BACKCORDIC RCDATA "backcord_icon.png" IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp" +IDI_CHANNEL_TC BITMAP "tc.bmp" IDI_CHANNEL_VC BITMAP "vc.bmp" IDI_CHANNEL_ANC BITMAP "anc.bmp" \ No newline at end of file diff --git a/rc/tc.bmp b/rc/tc.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a58ccf451862d2c24d2371d320c9c6f977117546 GIT binary patch literal 822 zcmZ?rHDhJ~12YB&1`P%V1_3B$WRL)hGcYqS2ysI&M1XAj*)XFhw9L zAta_OrU*nOoMd2NU}tAXvjR;7t{CDGG+DR_$c8{vLTtxMvV#G#7OcwPf?(w+?u5Gv Z;s7`oVl_KEJF*Be8)6iG5oB5FvH>WO1GE4D literal 0 HcmV?d00001