Refresh banner's text when erased and minize along with the installer window
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2568 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4ba745368c
commit
409385923a
3 changed files with 68 additions and 16 deletions
|
@ -14,45 +14,101 @@
|
||||||
|
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
HWND hwBanner;
|
HWND hwBanner;
|
||||||
|
HWND hwParent;
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
unsigned int myatoi(char *s);
|
unsigned int myatoi(char *s);
|
||||||
|
long oldProc;
|
||||||
|
|
||||||
BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
if (hwndDlg == hwParent)
|
||||||
|
{
|
||||||
|
if (uMsg == WM_SIZE)
|
||||||
|
{
|
||||||
|
ShowWindow(hwBanner, wParam == SIZE_MINIMIZED ? SW_HIDE : SW_SHOW);
|
||||||
|
}
|
||||||
|
return CallWindowProc(
|
||||||
|
(WNDPROC) oldProc,
|
||||||
|
hwndDlg,
|
||||||
|
uMsg,
|
||||||
|
wParam,
|
||||||
|
lParam
|
||||||
|
);
|
||||||
|
}
|
||||||
if (uMsg == WM_INITDIALOG)
|
if (uMsg == WM_INITDIALOG)
|
||||||
{
|
{
|
||||||
popstring(buf);
|
popstring(buf);
|
||||||
while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t')) {
|
while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t'))
|
||||||
|
{
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
|
|
||||||
popstring(buf);
|
popstring(buf);
|
||||||
id = myatoi(buf);
|
id = myatoi(buf);
|
||||||
|
|
||||||
popstring(buf);
|
popstring(buf);
|
||||||
SetDlgItemText(hwndDlg,id,buf);
|
SetDlgItemText(hwndDlg, id, buf);
|
||||||
|
|
||||||
popstring(buf);
|
popstring(buf);
|
||||||
}
|
}
|
||||||
SetWindowText(hwndDlg,buf);
|
SetWindowText(hwndDlg, buf);
|
||||||
SetDlgItemText(hwndDlg,IDC_STR,buf);
|
SetDlgItemText(hwndDlg, IDC_STR, buf);
|
||||||
}
|
}
|
||||||
|
if (uMsg == WM_CLOSE)
|
||||||
|
{
|
||||||
|
hwBanner = 0;
|
||||||
|
DestroyWindow(hwndDlg);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD WINAPI BannerCreator(void *lpParameter)
|
||||||
|
{
|
||||||
|
oldProc = SetWindowLong((HWND) lpParameter, GWL_WNDPROC, (long)bannerProc);
|
||||||
|
|
||||||
|
hwParent = (HWND) lpParameter;
|
||||||
|
|
||||||
|
hwBanner = CreateDialog(
|
||||||
|
GetModuleHandle(0),
|
||||||
|
MAKEINTRESOURCE(IDD_VERIFY),
|
||||||
|
(HWND) lpParameter,
|
||||||
|
bannerProc
|
||||||
|
);
|
||||||
|
|
||||||
|
{
|
||||||
|
BOOL bRet;
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
while (hwBanner && (bRet = GetMessage(&msg, NULL, 0, 0)))
|
||||||
|
{
|
||||||
|
if (bRet != -1)
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||||
{
|
{
|
||||||
EXDLL_INIT();
|
DWORD dwThreadId;
|
||||||
|
|
||||||
hwBanner = CreateDialog(
|
g_stringsize = string_size;
|
||||||
GetModuleHandle(0),
|
g_stacktop = stacktop;
|
||||||
MAKEINTRESOURCE(IDD_VERIFY),
|
|
||||||
hwndParent,
|
CreateThread(0, 0, BannerCreator, (void *) hwndParent, 0, &dwThreadId);
|
||||||
bannerProc
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||||
{
|
{
|
||||||
DestroyWindow(hwBanner);
|
if (oldProc)
|
||||||
|
SetWindowLong(hwndParent, GWL_WNDPROC, oldProc);
|
||||||
|
|
||||||
|
SendMessage(hwBanner, WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
|
|
Binary file not shown.
4
TODO.txt
4
TODO.txt
|
@ -18,10 +18,6 @@ NSIS
|
||||||
|
|
||||||
* move no custom to compiler (custom as just another inst type)
|
* move no custom to compiler (custom as just another inst type)
|
||||||
|
|
||||||
PLUGINS
|
|
||||||
|
|
||||||
* Banner doesn't refresh and doesn't stay on top
|
|
||||||
|
|
||||||
-- Before NSIS 2 Final --
|
-- Before NSIS 2 Final --
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue