Skip to content

Commit 857448c

Browse files
committed
Implemented User Manual option into Help menu.
Implemented Check for updates... option into Help menu.
1 parent 857af9d commit 857448c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7523
-7
lines changed

CheckForUpdatesDlg.cpp

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/* Copyright (C) 2014-2024 Stefan-Mihai MOGA
2+
This file is part of IntelliLink application developed by Stefan-Mihai MOGA.
3+
IntelliLink is an alternative Windows version to Online Link Managers!
4+
5+
IntelliLink is free software: you can redistribute it and/or modify it
6+
under the terms of the GNU General Public License as published by the Open
7+
Source Initiative, either version 3 of the License, or any later version.
8+
9+
IntelliLink is distributed in the hope that it will be useful, but
10+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12+
13+
You should have received a copy of the GNU General Public License along with
14+
IntelliLink. If not, see <http://www.opensource.org/licenses/gpl-3.0.html>*/
15+
16+
// CheckForUpdatesDlg.cpp : implementation file
17+
//
18+
19+
#include "stdafx.h"
20+
#include "IntelliTask.h"
21+
#include "CheckForUpdatesDlg.h"
22+
23+
#include "genUp4win/genUp4win.h"
24+
#ifdef _DEBUG
25+
#pragma comment(lib, "x64/Debug/genUp4win.lib")
26+
#else
27+
#pragma comment(lib, "x64/Release/genUp4win.lib")
28+
#endif
29+
30+
// CCheckForUpdatesDlg dialog
31+
32+
IMPLEMENT_DYNAMIC(CCheckForUpdatesDlg, CDialogEx)
33+
34+
CCheckForUpdatesDlg::CCheckForUpdatesDlg(CWnd* pParent /*=nullptr*/)
35+
: CDialogEx(IDD_CheckForUpdatesDlg, pParent)
36+
{
37+
m_nUpdateThreadID = 0;
38+
m_hUpdateThread = nullptr;
39+
}
40+
41+
CCheckForUpdatesDlg::~CCheckForUpdatesDlg()
42+
{
43+
}
44+
45+
void CCheckForUpdatesDlg::DoDataExchange(CDataExchange* pDX)
46+
{
47+
CDialogEx::DoDataExchange(pDX);
48+
DDX_Control(pDX, IDC_STATUS, m_ctrlStatusMessage);
49+
DDX_Control(pDX, IDC_PROGRESS, m_ctrlProgress);
50+
}
51+
52+
BEGIN_MESSAGE_MAP(CCheckForUpdatesDlg, CDialogEx)
53+
ON_WM_TIMER()
54+
END_MESSAGE_MAP()
55+
56+
// CCheckForUpdatesDlg message handlers
57+
CCheckForUpdatesDlg* g_dlgCheckForUpdates = nullptr;
58+
void UI_Callback(int, const std::wstring& strMessage)
59+
{
60+
if (g_dlgCheckForUpdates != nullptr)
61+
{
62+
g_dlgCheckForUpdates->m_ctrlStatusMessage.SetWindowText(strMessage.c_str());
63+
g_dlgCheckForUpdates->m_ctrlStatusMessage.UpdateWindow();
64+
}
65+
}
66+
67+
bool g_bThreadRunning = false;
68+
bool g_bNewUpdateFound = false;
69+
DWORD WINAPI UpdateThreadProc(LPVOID lpParam)
70+
{
71+
UNREFERENCED_PARAMETER(lpParam);
72+
73+
g_bThreadRunning = true;
74+
if (g_dlgCheckForUpdates != nullptr)
75+
{
76+
g_dlgCheckForUpdates->m_ctrlProgress.SetMarquee(TRUE, 30);
77+
}
78+
const DWORD nLength = _MAX_PATH;
79+
TCHAR lpszFilePath[nLength] = { 0, };
80+
GetModuleFileName(nullptr, lpszFilePath, nLength);
81+
g_bNewUpdateFound = CheckForUpdates(lpszFilePath, APPLICATION_URL, UI_Callback);
82+
if (g_dlgCheckForUpdates != nullptr)
83+
{
84+
g_dlgCheckForUpdates->m_ctrlProgress.SetMarquee(FALSE, 30);
85+
}
86+
g_bThreadRunning = false;
87+
88+
::ExitThread(0);
89+
return 0;
90+
}
91+
92+
BOOL CCheckForUpdatesDlg::OnInitDialog()
93+
{
94+
CDialogEx::OnInitDialog();
95+
96+
#ifdef _DEBUG
97+
const DWORD nLength = _MAX_PATH;
98+
TCHAR lpszFilePath[nLength] = { 0, };
99+
GetModuleFileName(nullptr, lpszFilePath, nLength);
100+
WriteConfigFile(lpszFilePath, INSTALLER_URL);
101+
#endif
102+
103+
g_dlgCheckForUpdates = this;
104+
m_hUpdateThread = ::CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)UpdateThreadProc, this, 0, &m_nUpdateThreadID);
105+
m_nTimerID = SetTimer(0x1234, 100, nullptr);
106+
107+
return TRUE; // return TRUE unless you set the focus to a control
108+
// EXCEPTION: OCX Property Pages should return FALSE
109+
}
110+
111+
void CCheckForUpdatesDlg::OnCancel()
112+
{
113+
while (g_bThreadRunning)
114+
Sleep(1000);
115+
CDialogEx::OnCancel();
116+
}
117+
118+
void CCheckForUpdatesDlg::OnTimer(UINT_PTR nIDEvent)
119+
{
120+
CDialogEx::OnTimer(nIDEvent);
121+
122+
if (m_nTimerID == nIDEvent)
123+
{
124+
if (!g_bThreadRunning)
125+
{
126+
CDialogEx::OnCancel();
127+
if (g_bNewUpdateFound)
128+
{
129+
PostQuitMessage(0);
130+
}
131+
}
132+
}
133+
}

CheckForUpdatesDlg.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* Copyright (C) 2014-2024 Stefan-Mihai MOGA
2+
This file is part of IntelliLink application developed by Stefan-Mihai MOGA.
3+
IntelliLink is an alternative Windows version to Online Link Managers!
4+
5+
IntelliLink is free software: you can redistribute it and/or modify it
6+
under the terms of the GNU General Public License as published by the Open
7+
Source Initiative, either version 3 of the License, or any later version.
8+
9+
IntelliLink is distributed in the hope that it will be useful, but
10+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12+
13+
You should have received a copy of the GNU General Public License along with
14+
IntelliLink. If not, see <http://www.opensource.org/licenses/gpl-3.0.html>*/
15+
16+
#pragma once
17+
18+
#include "VersionInfo.h"
19+
20+
// CCheckForUpdatesDlg dialog
21+
22+
class CCheckForUpdatesDlg : public CDialogEx
23+
{
24+
DECLARE_DYNAMIC(CCheckForUpdatesDlg)
25+
26+
public:
27+
CCheckForUpdatesDlg(CWnd* pParent = nullptr); // standard constructor
28+
virtual ~CCheckForUpdatesDlg();
29+
30+
// Dialog Data
31+
#ifdef AFX_DESIGN_TIME
32+
enum { IDD = IDD_CheckForUpdatesDlg };
33+
#endif
34+
35+
public:
36+
CStatic m_ctrlStatusMessage;
37+
CProgressCtrl m_ctrlProgress;
38+
CVersionInfo m_pVersionInfo;
39+
protected:
40+
DWORD m_nUpdateThreadID;
41+
HANDLE m_hUpdateThread;
42+
UINT_PTR m_nTimerID;
43+
44+
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
45+
46+
protected:
47+
// Generated message map functions
48+
virtual BOOL OnInitDialog();
49+
virtual void OnCancel();
50+
afx_msg void OnTimer(UINT_PTR nIDEvent);
51+
52+
DECLARE_MESSAGE_MAP()
53+
};

0 commit comments

Comments
 (0)