Context Menu object reference is re-used each time.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1165 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
rainwater 2002-09-24 13:39:31 +00:00
parent 42bee80396
commit ba40bb2d26
2 changed files with 11 additions and 10 deletions

View file

@ -76,6 +76,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
static HINSTANCE hRichEditDLL = 0; static HINSTANCE hRichEditDLL = 0;
static HMENU hmnu = 0;
if (!hRichEditDLL) hRichEditDLL= LoadLibrary("RichEd32.dll"); if (!hRichEditDLL) hRichEditDLL= LoadLibrary("RichEd32.dll");
switch (msg) { switch (msg) {
case WM_INITDIALOG: case WM_INITDIALOG:
@ -122,15 +123,15 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
case WM_CONTEXTMENU: case WM_CONTEXTMENU:
{ {
if ((HWND)wParam==GetDlgItem(g_hwnd,IDC_LOGWIN)) { if ((HWND)wParam==GetDlgItem(g_hwnd,IDC_LOGWIN)) {
HMENU m = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDM_LOGWIN)); if (!hmnu) {
if (m) { hmnu = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDM_LOGWIN));
HMENU s = GetSubMenu(m,0); if (hmnu) hmnu = GetSubMenu(hmnu,0);
if (s) { }
int xPos,yPos; if (hmnu) {
xPos = (int)(short)LOWORD(lParam); int xPos,yPos;
yPos = (int)(short)HIWORD(lParam); xPos = (int)(short)LOWORD(lParam);
TrackPopupMenu(s,NULL,xPos,yPos,0,g_hwnd,0); yPos = (int)(short)HIWORD(lParam);
} TrackPopupMenu(hmnu,NULL,xPos,yPos,0,g_hwnd,0);
} }
} }
return TRUE; return TRUE;

View file

@ -30,7 +30,7 @@
#undef _RICHEDIT_VER #undef _RICHEDIT_VER
// Defines // Defines
#define NSIS_URL "http://sourceforge.net/projects/nsis/" #define NSIS_URL "http://nsis.sourceforge.net/"
#define USAGE "Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSI\"" #define USAGE "Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSI\""
#define COPYRIGHT "Copyright (c) 2002 Robert Rainwater" #define COPYRIGHT "Copyright (c) 2002 Robert Rainwater"
#define DOCPATH "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/nsis/NSIS/docs/index.html?rev=HEAD" #define DOCPATH "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/nsis/NSIS/docs/index.html?rev=HEAD"