Flicker reduction by A. Schiffler

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2546 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-05-11 16:57:42 +00:00
parent 02ca2f505b
commit 103fd23c3e
2 changed files with 19 additions and 15 deletions

View file

@ -84,9 +84,16 @@ static int g_file_size;
static void progress_callback(char *msg, int read_bytes) static void progress_callback(char *msg, int read_bytes)
{ {
// flicker reduction by A. Schiffler
static DWORD dwLastTick = 0;
DWORD dwThisTick = GetTickCount();
if (g_dialog) if (g_dialog)
{
if (dwThisTick - dwLastTick > 500)
{ {
SetDlgItemText (g_dialog, IDC_STATIC2, msg); SetDlgItemText (g_dialog, IDC_STATIC2, msg);
dwLastTick = dwThisTick;
}
if (g_file_size) SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM)MulDiv(read_bytes,30000,g_file_size), 0); if (g_file_size) SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM)MulDiv(read_bytes,30000,g_file_size), 0);
} }
} }
@ -167,7 +174,6 @@ __declspec(dllexport) void download (HWND parent,
if (hFile == INVALID_HANDLE_VALUE) { if (hFile == INVALID_HANDLE_VALUE) {
wsprintf (buf, "Unable to open %s", filename); wsprintf (buf, "Unable to open %s", filename);
error=buf; error=buf;
goto done;
} else { } else {
if (parent) if (parent)
{ {
@ -215,7 +221,7 @@ __declspec(dllexport) void download (HWND parent,
g_hwndProgressBar = GetDlgItem (dlg, IDC_PROGRESS1); g_hwndProgressBar = GetDlgItem (dlg, IDC_PROGRESS1);
JNL_HTTPGet *get; JNL_HTTPGet *get = 0;
{ {
WSADATA wsaData; WSADATA wsaData;
@ -397,7 +403,8 @@ __declspec(dllexport) void download (HWND parent,
if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),0); if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),0);
} }
done: if (get) delete get;
}
if (g_cancelled) { if (g_cancelled) {
pushstring("cancel"); pushstring("cancel");
@ -408,9 +415,6 @@ done:
DeleteFile(filename); DeleteFile(filename);
pushstring(error); pushstring(error);
} }
if (get) delete get;
}
} }

Binary file not shown.