Skip to content

Commit

Permalink
Up to 0.9.8
Browse files Browse the repository at this point in the history
* Improve recent menu
  • Loading branch information
little-brother committed Jan 30, 2023
1 parent 7baa03f commit beb765d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#define MAX_RECENT_FILES 10

#define APP_NAME TEXT("sqlite-x")
#define APP_VERSION TEXT("0.9.7")
#define APP_VERSION TEXT("0.9.8")
#ifdef __MINGW64__
#define APP_PLATFORM 64
#else
Expand Down Expand Up @@ -314,8 +314,8 @@ LRESULT CALLBACK cbMainWnd(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

if (cmd >= IDM_RECENT && cmd < IDM_RECENT + MAX_RECENT_FILES) {
TCHAR path16[MAX_PATH + 1];
GetMenuString(GetSubMenu(GetMenu(hWnd), 0), cmd, path16, MAX_PATH, MF_BYCOMMAND);
ListLoadW (hWnd, path16, 0);
if (GetMenuString(GetSubMenu(GetMenu(hWnd), 0), cmd, path16, MAX_PATH, MF_BYCOMMAND))
ListLoadW (hWnd, path16, 0);
}
}
break;
Expand All @@ -333,11 +333,13 @@ void updateRecentList(HWND hWnd) {

TCHAR* buf16 = calloc(20 * MAX_PATH, sizeof(TCHAR));
if (GetPrivateProfileString(APP_NAME, TEXT("recent"), NULL, buf16, 20 * MAX_PATH, iniPath)) {
InsertMenu(hMenu, IDM_EXIT, MF_BYCOMMAND | MF_STRING, IDM_SEPARATOR2, NULL);
int i = 0;
TCHAR* path16 = _tcstok(buf16, TEXT("?"));
while (path16 != NULL && i < MAX_RECENT_FILES) {
if (_taccess(path16, 0) == 0) {
if (i == 0)
InsertMenu(hMenu, IDM_EXIT, MF_BYCOMMAND | MF_STRING, IDM_SEPARATOR2, NULL);

InsertMenu(hMenu, IDM_SEPARATOR2, MF_BYCOMMAND | MF_STRING, IDM_RECENT + i, path16);
i++;
}
Expand Down

0 comments on commit beb765d

Please sign in to comment.