p2 added icon and renamed

This commit is contained in:
acidburn
2025-12-03 13:24:05 -05:00
parent 94615948f8
commit b7f9692e30
3 changed files with 30 additions and 12 deletions
+20 -7
View File
@@ -11,6 +11,8 @@
int swprintf_s(wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format, ...);
#endif
#define IDI_APP 101
#define IDM_FILE_NEW 1001
#define IDM_FILE_OPEN 1002
#define IDM_FILE_SAVE 1003
@@ -74,7 +76,7 @@ static void UpdateTitle(HWND hwnd)
}
WCHAR title[512];
swprintf_s(title, ARRAYSIZE(title), L"%s - Notepad Clone", name);
swprintf_s(title, ARRAYSIZE(title), L"%s - ClasicNotepad", name);
SetWindowTextW(hwnd, title);
}
@@ -156,7 +158,7 @@ static HMENU BuildMenu(void)
AppendMenuW(hFormat, MF_STRING, IDM_FORMAT_FONT, L"&Font...");
HMENU hHelp = CreatePopupMenu();
AppendMenuW(hHelp, MF_STRING, IDM_HELP_ABOUT, L"&About Notepad Clone");
AppendMenuW(hHelp, MF_STRING, IDM_HELP_ABOUT, L"&About ClasicNotepad");
AppendMenuW(hMenu, MF_POPUP, (UINT_PTR)hFile, L"&File");
AppendMenuW(hMenu, MF_POPUP, (UINT_PTR)hEdit, L"&Edit");
@@ -426,7 +428,7 @@ static void ChooseFontAndApply(HWND hwnd)
static void ShowAbout(HWND hwnd)
{
MessageBoxW(hwnd, L"Notepad Clone\nBuilt with Win32 API in C.", L"About", MB_OK | MB_ICONINFORMATION);
MessageBoxW(hwnd, L"ClasicNotepad\nBuilt with Win32 API in C.", L"About", MB_OK | MB_ICONINFORMATION);
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -536,11 +538,22 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
wc.cbSize = sizeof(wc);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
HICON hIconLarge = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDI_APP));
HICON hIconSmall = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDI_APP));
if (!hIconLarge)
{
hIconLarge = LoadIcon(NULL, IDI_APPLICATION);
}
if (!hIconSmall)
{
hIconSmall = LoadIcon(NULL, IDI_APPLICATION);
}
wc.hIcon = hIconLarge;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = L"NotepadCloneClass";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wc.lpszClassName = L"ClasicNotepadClass";
wc.hIconSm = hIconSmall;
if (!RegisterClassExW(&wc))
{
@@ -548,7 +561,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
return -1;
}
HWND hwnd = CreateWindowExW(0, wc.lpszClassName, L"Notepad Clone", WS_OVERLAPPEDWINDOW,
HWND hwnd = CreateWindowExW(0, wc.lpszClassName, L"ClasicNotepad", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL);
if (!hwnd)
+10 -5
View File
@@ -1,13 +1,18 @@
CC = gcc
TARGET = notepad_clone.exe
SRC = notepad_clone.c
WINDRES = windres
TARGET = ClasicNotepad.exe
SRC = ClasicNotepad.c
RES = ClasicNotepad.res
CFLAGS = -Wall -Wextra -std=c11 -mwindows
LDLIBS = -luser32 -lgdi32 -lcomdlg32
$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $@ $< $(LDLIBS)
$(TARGET): $(SRC) $(RES)
$(CC) $(CFLAGS) -o $@ $(SRC) $(RES) $(LDLIBS)
$(RES): ClasicNotepad.rc app.ico
$(WINDRES) -O coff ClasicNotepad.rc $(RES)
.PHONY: clean
clean:
del /f /q $(TARGET) 2>NUL || true
del /f /q $(TARGET) $(RES) 2>NUL || true
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB