Skip to content

Commit 2ed7095

Browse files
author
YooLc
committed
Add icon for taskbar, but failed to add icon for title bar
1 parent c8d907f commit 2ed7095

File tree

7 files changed

+29
-14
lines changed

7 files changed

+29
-14
lines changed

compiled/CodeEditor_private.res

4.3 KB
Binary file not shown.

lib/graphics.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ void repaint()
818818

819819
static void InitDisplay(void)
820820
{
821-
WNDCLASS wndcls;
821+
WNDCLASSEX wndcls;
822822
RECT bounds, consoleRect, graphicsRect;
823823
double screenHeight, screenWidth, xSpace, ySpace;
824824
double xScale, yScale, scaleFactor;
@@ -857,18 +857,20 @@ static void InitDisplay(void)
857857
g_mouse = NULL;
858858
g_timer = NULL;
859859

860+
wndcls.cbSize = sizeof(WNDCLASSEX);
860861
wndcls.cbClsExtra = 0;
861862
wndcls.cbWndExtra = 0;
862863
wndcls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
863864
wndcls.hCursor = LoadCursor(NULL, IDC_ARROW);
864-
wndcls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
865+
wndcls.hIcon = (HICON)LoadImage(NULL, "IDI_ICON", IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0);
866+
wndcls.hIconSm = (HICON)LoadImage(NULL, "IDI_ICON", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
865867
wndcls.hInstance = NULL;
866868
wndcls.lpfnWndProc = GraphicsEventProc;
867869
wndcls.lpszClassName = "Graphics Window";
868870
wndcls.lpszMenuName = NULL;
869871
wndcls.style = CS_HREDRAW | CS_VREDRAW;
870872

871-
RegisterClass(&wndcls);
873+
RegisterClassEx(&wndcls);
872874

873875
graphicsWindow = CreateWindow(
874876
GWClassName,

prjdev/CodeEditor.dev

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IncludeVersionInfo=0
2929
SupportXPThemes=0
3030
CompilerSet=0
3131
CompilerSettings=0000000000000000001000000
32-
UnitCount=43
32+
UnitCount=45
3333

3434
[VersionInfo]
3535
Major=1
@@ -450,8 +450,8 @@ Priority=1000
450450
OverrideBuildCmd=0
451451
BuildCmd=
452452

453-
[Unit44]
454-
FileName=..\src\ioutils.h
453+
[Unit31]
454+
FileName=..\src\menu.h
455455
CompileCpp=0
456456
Folder=src
457457
Compile=1
@@ -460,8 +460,8 @@ Priority=1000
460460
OverrideBuildCmd=0
461461
BuildCmd=
462462

463-
[Unit31]
464-
FileName=..\src\menu.h
463+
[Unit32]
464+
FileName=..\src\menu.c
465465
CompileCpp=0
466466
Folder=src
467467
Compile=1
@@ -470,20 +470,29 @@ Priority=1000
470470
OverrideBuildCmd=0
471471
BuildCmd=
472472

473-
[Unit32]
474-
FileName=..\src\menu.c
473+
[Unit43]
474+
FileName=..\res\icon.ico
475+
Folder=res
476+
Compile=0
477+
Link=0
478+
Priority=1000
479+
OverrideBuildCmd=0
480+
BuildCmd=
481+
482+
[Unit45]
483+
FileName=..\res\icon.h
475484
CompileCpp=0
476-
Folder=src
485+
Folder=res
477486
Compile=1
478487
Link=1
479488
Priority=1000
480489
OverrideBuildCmd=0
481490
BuildCmd=
482491

483-
[Unit43]
484-
FileName=..\res\OIG.ico
492+
[Unit44]
493+
FileName=..\res\icon.rc
485494
Folder=res
486-
Compile=0
495+
Compile=1
487496
Link=0
488497
Priority=1000
489498
OverrideBuildCmd=0

prjdev/CodeEditor_private.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
22
/* DO NOT EDIT! */
33

4+
#include "../res/icon.rc"
45

56
A ICON "CodeEditor.ico"

res/icon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define IDI_ICON 20000

res/icon.ico

1 Byte
Binary file not shown.

res/icon.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "icon.h"
2+
IDI_ICON ICON "../res/icon.ico"

0 commit comments

Comments
 (0)