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)
{
// flicker reduction by A. Schiffler
static DWORD dwLastTick = 0;
DWORD dwThisTick = GetTickCount();
if (g_dialog)
{
SetDlgItemText (g_dialog, IDC_STATIC2, msg);
if (dwThisTick - dwLastTick > 500)
{
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);
}
}
@ -167,7 +174,6 @@ __declspec(dllexport) void download (HWND parent,
if (hFile == INVALID_HANDLE_VALUE) {
wsprintf (buf, "Unable to open %s", filename);
error=buf;
goto done;
} else {
if (parent)
{
@ -215,7 +221,7 @@ __declspec(dllexport) void download (HWND parent,
g_hwndProgressBar = GetDlgItem (dlg, IDC_PROGRESS1);
JNL_HTTPGet *get;
JNL_HTTPGet *get = 0;
{
WSADATA wsaData;
@ -397,20 +403,18 @@ __declspec(dllexport) void download (HWND parent,
if (wasen) EnableWindow(GetDlgItem(parent,IDCANCEL),0);
}
done:
if (g_cancelled) {
pushstring("cancel");
DeleteFile(filename);
} else if (error == NULL) {
pushstring("success");
} else {
DeleteFile(filename);
pushstring(error);
}
if (get) delete get;
}
if (g_cancelled) {
pushstring("cancel");
DeleteFile(filename);
} else if (error == NULL) {
pushstring("success");
} else {
DeleteFile(filename);
pushstring(error);
}
}

Binary file not shown.