-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented User Manual option into Help menu.
Implemented Check for updates... option into Help menu.
- Loading branch information
Showing
66 changed files
with
7,529 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* Copyright (C) 2014-2024 Stefan-Mihai MOGA | ||
This file is part of IntelliPort application developed by Stefan-Mihai MOGA. | ||
IntelliPort is an alternative Windows version to the famous HyperTerminal! | ||
IntelliPort is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by the Open | ||
Source Initiative, either version 3 of the License, or any later version. | ||
IntelliPort is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along with | ||
IntelliPort. If not, see <http://www.opensource.org/licenses/gpl-3.0.html>*/ | ||
|
||
// CheckForUpdatesDlg.cpp : implementation file | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "IntelliPort.h" | ||
#include "CheckForUpdatesDlg.h" | ||
|
||
#include "genUp4win/genUp4win.h" | ||
#ifdef _DEBUG | ||
#pragma comment(lib, "x64/Debug/genUp4win.lib") | ||
#else | ||
#pragma comment(lib, "x64/Release/genUp4win.lib") | ||
#endif | ||
|
||
// CCheckForUpdatesDlg dialog | ||
|
||
IMPLEMENT_DYNAMIC(CCheckForUpdatesDlg, CDialogEx) | ||
|
||
CCheckForUpdatesDlg::CCheckForUpdatesDlg(CWnd* pParent /*=nullptr*/) | ||
: CDialogEx(IDD_CheckForUpdatesDlg, pParent) | ||
{ | ||
m_nUpdateThreadID = 0; | ||
m_hUpdateThread = nullptr; | ||
} | ||
|
||
CCheckForUpdatesDlg::~CCheckForUpdatesDlg() | ||
{ | ||
} | ||
|
||
void CCheckForUpdatesDlg::DoDataExchange(CDataExchange* pDX) | ||
{ | ||
CDialogEx::DoDataExchange(pDX); | ||
DDX_Control(pDX, IDC_STATUS, m_ctrlStatusMessage); | ||
DDX_Control(pDX, IDC_PROGRESS, m_ctrlProgress); | ||
} | ||
|
||
BEGIN_MESSAGE_MAP(CCheckForUpdatesDlg, CDialogEx) | ||
ON_WM_TIMER() | ||
END_MESSAGE_MAP() | ||
|
||
// CCheckForUpdatesDlg message handlers | ||
CCheckForUpdatesDlg* g_dlgCheckForUpdates = nullptr; | ||
void UI_Callback(int, const std::wstring& strMessage) | ||
{ | ||
if (g_dlgCheckForUpdates != nullptr) | ||
{ | ||
g_dlgCheckForUpdates->m_ctrlStatusMessage.SetWindowText(strMessage.c_str()); | ||
g_dlgCheckForUpdates->m_ctrlStatusMessage.UpdateWindow(); | ||
} | ||
} | ||
|
||
bool g_bThreadRunning = false; | ||
bool g_bNewUpdateFound = false; | ||
DWORD WINAPI UpdateThreadProc(LPVOID lpParam) | ||
{ | ||
UNREFERENCED_PARAMETER(lpParam); | ||
|
||
g_bThreadRunning = true; | ||
if (g_dlgCheckForUpdates != nullptr) | ||
{ | ||
g_dlgCheckForUpdates->m_ctrlProgress.SetMarquee(TRUE, 30); | ||
} | ||
const DWORD nLength = _MAX_PATH; | ||
TCHAR lpszFilePath[nLength] = { 0, }; | ||
GetModuleFileName(nullptr, lpszFilePath, nLength); | ||
g_bNewUpdateFound = CheckForUpdates(lpszFilePath, APPLICATION_URL, UI_Callback); | ||
if (g_dlgCheckForUpdates != nullptr) | ||
{ | ||
g_dlgCheckForUpdates->m_ctrlProgress.SetMarquee(FALSE, 30); | ||
} | ||
g_bThreadRunning = false; | ||
|
||
::ExitThread(0); | ||
return 0; | ||
} | ||
|
||
BOOL CCheckForUpdatesDlg::OnInitDialog() | ||
{ | ||
CDialogEx::OnInitDialog(); | ||
|
||
#ifdef _DEBUG | ||
const DWORD nLength = _MAX_PATH; | ||
TCHAR lpszFilePath[nLength] = { 0, }; | ||
GetModuleFileName(nullptr, lpszFilePath, nLength); | ||
WriteConfigFile(lpszFilePath, INSTALLER_URL); | ||
#endif | ||
|
||
g_dlgCheckForUpdates = this; | ||
m_hUpdateThread = ::CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)UpdateThreadProc, this, 0, &m_nUpdateThreadID); | ||
m_nTimerID = SetTimer(0x1234, 100, nullptr); | ||
|
||
return TRUE; // return TRUE unless you set the focus to a control | ||
// EXCEPTION: OCX Property Pages should return FALSE | ||
} | ||
|
||
void CCheckForUpdatesDlg::OnCancel() | ||
{ | ||
while (g_bThreadRunning) | ||
Sleep(1000); | ||
CDialogEx::OnCancel(); | ||
} | ||
|
||
void CCheckForUpdatesDlg::OnTimer(UINT_PTR nIDEvent) | ||
{ | ||
CDialogEx::OnTimer(nIDEvent); | ||
|
||
if (m_nTimerID == nIDEvent) | ||
{ | ||
if (!g_bThreadRunning) | ||
{ | ||
CDialogEx::OnCancel(); | ||
if (g_bNewUpdateFound) | ||
{ | ||
PostQuitMessage(0); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Copyright (C) 2014-2024 Stefan-Mihai MOGA | ||
This file is part of IntelliPort application developed by Stefan-Mihai MOGA. | ||
IntelliPort is an alternative Windows version to the famous HyperTerminal! | ||
IntelliPort is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by the Open | ||
Source Initiative, either version 3 of the License, or any later version. | ||
IntelliPort is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along with | ||
IntelliPort. If not, see <http://www.opensource.org/licenses/gpl-3.0.html>*/ | ||
|
||
#pragma once | ||
|
||
#include "VersionInfo.h" | ||
|
||
// CCheckForUpdatesDlg dialog | ||
|
||
class CCheckForUpdatesDlg : public CDialogEx | ||
{ | ||
DECLARE_DYNAMIC(CCheckForUpdatesDlg) | ||
|
||
public: | ||
CCheckForUpdatesDlg(CWnd* pParent = nullptr); // standard constructor | ||
virtual ~CCheckForUpdatesDlg(); | ||
|
||
// Dialog Data | ||
#ifdef AFX_DESIGN_TIME | ||
enum { IDD = IDD_CheckForUpdatesDlg }; | ||
#endif | ||
|
||
public: | ||
CStatic m_ctrlStatusMessage; | ||
CProgressCtrl m_ctrlProgress; | ||
CVersionInfo m_pVersionInfo; | ||
protected: | ||
DWORD m_nUpdateThreadID; | ||
HANDLE m_hUpdateThread; | ||
UINT_PTR m_nTimerID; | ||
|
||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support | ||
|
||
protected: | ||
// Generated message map functions | ||
virtual BOOL OnInitDialog(); | ||
virtual void OnCancel(); | ||
afx_msg void OnTimer(UINT_PTR nIDEvent); | ||
|
||
DECLARE_MESSAGE_MAP() | ||
}; |
Oops, something went wrong.