StartMenu.dll, lets the user select the start menu folder
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1621 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
996b0bb15a
commit
9777905f55
9 changed files with 736 additions and 0 deletions
46
Contrib/StartMenu/Example.nsi
Normal file
46
Contrib/StartMenu/Example.nsi
Normal file
|
@ -0,0 +1,46 @@
|
|||
!verbose 3
|
||||
!include "${NSISDIR}\Examples\WinMessages.nsh"
|
||||
!verbose 4
|
||||
|
||||
Name "StartMenu.dll test"
|
||||
|
||||
OutFile "StartMenu Test.exe"
|
||||
|
||||
XPStyle on
|
||||
|
||||
Page directory
|
||||
DirText "This installer will create some shortcuts to MakeNSIS in the start menu.$\nFor this it needs NSIS's folder path." \
|
||||
"Please specify the path in which you have installed NSIS:"
|
||||
InstallDir "${NSISDIR}"
|
||||
Function .onVerifyInstDir
|
||||
IfFileExists $INSTDIR\makensis.exe +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Page custom StartMenuGroupSelect
|
||||
Function StartMenuGroupSelect
|
||||
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:StartMenu.dll test Setup: Start Menu Folder"
|
||||
|
||||
StartMenu::Select /autoadd "StartMenu.dll test"
|
||||
Pop $R0
|
||||
|
||||
StrCpy $1 $R0 5
|
||||
StrCmp $1 "error" 0 +3
|
||||
; error
|
||||
MessageBox MB_OK $R0
|
||||
Return
|
||||
StrCmp $R0 "cancel" 0 +2
|
||||
Quit
|
||||
StrCmp $R0 "back" 0 +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Page instfiles
|
||||
Section
|
||||
CreateDirectory $SMPROGRAMS\$R0
|
||||
CreateShortCut $SMPROGRAMS\$R0\MakeNSIS.lnk $INSTDIR\makensis.exe
|
||||
|
||||
SetShellVarContext All
|
||||
CreateDirectory $SMPROGRAMS\$R0
|
||||
CreateShortCut "$SMPROGRAMS\$R0\All users MakeNSIS.lnk" $INSTDIR\makensis.exe
|
||||
SectionEnd
|
17
Contrib/StartMenu/Readme.txt
Normal file
17
Contrib/StartMenu/Readme.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
StartMenu.dll shows a custom page that lets the user select a start menu program
|
||||
folder to put shortcuts in.
|
||||
|
||||
To show the dialog use the Select function. This function has one required parameter
|
||||
which is the program group default name, and some more optional parameters:
|
||||
/autoadd - automatically adds the program name to the selected folder
|
||||
/noicon - doesn't show the icon in the top left corner
|
||||
/text [please select...] - sets the top text to something else than "Select
|
||||
the Start Menu folder in which..."
|
||||
|
||||
The function pushes the folder selection back to the stack. It does not push the
|
||||
full path but only the selected sub-folder. It's up to you to decide if to put
|
||||
it in the current user or all users start menu.
|
||||
|
||||
Look at Example.nsi for an example.
|
||||
|
||||
Created by Amir Szekely (aka KiCHiK)
|
315
Contrib/StartMenu/StartMenu.c
Normal file
315
Contrib/StartMenu/StartMenu.c
Normal file
|
@ -0,0 +1,315 @@
|
|||
#include <windows.h>
|
||||
#include "exdll.h"
|
||||
#include "resource.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
HWND hwParent;
|
||||
HWND hwChild;
|
||||
HWND hwStartMenuSelect;
|
||||
HWND hwIcon;
|
||||
HWND hwText;
|
||||
HWND hwLocation;
|
||||
HWND hwDirList;
|
||||
|
||||
char buf[MAX_PATH];
|
||||
char text[1024];
|
||||
char progname[1024];
|
||||
|
||||
int autoadd = 0;
|
||||
int g_done = 0;
|
||||
int noicon = 0;
|
||||
|
||||
void *lpWndProcOld;
|
||||
|
||||
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK ParentWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
void AddFolderFromReg(char *name, HKEY rootKey);
|
||||
void PopulateListWithDir(char *dir);
|
||||
|
||||
void __declspec(dllexport) Select(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
{
|
||||
hwParent = hwndParent;
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
{
|
||||
int cw_vis;
|
||||
|
||||
hwChild = FindWindowEx(hwndParent, NULL, "#32770", NULL); // find window to replace
|
||||
if (!hwChild) hwChild = GetDlgItem(hwndParent, 1018);
|
||||
if (!hwChild)
|
||||
{
|
||||
pushstring("error finding childwnd");
|
||||
return;
|
||||
}
|
||||
|
||||
popstring(buf);
|
||||
|
||||
while (buf[0] == '/')
|
||||
{
|
||||
if (!lstrcmpi(buf+1, "noicon"))
|
||||
noicon = 1;
|
||||
else if (!lstrcmpi(buf+1, "text"))
|
||||
popstring(text);
|
||||
else if (!lstrcmpi(buf+1, "autoadd"))
|
||||
autoadd = 1;
|
||||
if (popstring(buf))
|
||||
*buf = 0;
|
||||
}
|
||||
if (*buf) lstrcpy(progname, buf);
|
||||
else
|
||||
{
|
||||
pushstring("error reading parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
cw_vis = IsWindowVisible(hwChild);
|
||||
if (cw_vis) ShowWindow(hwChild, SW_HIDE);
|
||||
|
||||
hwStartMenuSelect = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG), hwndParent, dlgProc);
|
||||
if (!hwStartMenuSelect)
|
||||
{
|
||||
pushstring("error creating dialog");
|
||||
g_done = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpWndProcOld = (void *) SetWindowLong(hwndParent, GWL_WNDPROC, (long) ParentWndProc);
|
||||
}
|
||||
|
||||
while (!g_done)
|
||||
{
|
||||
MSG msg;
|
||||
int nResult = GetMessage(&msg, NULL, 0, 0);
|
||||
if (!IsDialogMessage(hwStartMenuSelect,&msg) && !IsDialogMessage(hwndParent,&msg) && !TranslateMessage(&msg))
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
SetWindowLong(hwndParent, GWL_WNDPROC, (long) lpWndProcOld);
|
||||
|
||||
if (cw_vis) ShowWindow(hwChild, SW_SHOW);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (message == WM_COMMAND && (LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDOK || LOWORD(wParam) == 3))
|
||||
{
|
||||
PostMessage(hwStartMenuSelect, WM_USER+666, 0, LOWORD(wParam));
|
||||
return 0;
|
||||
}
|
||||
if (message == WM_CLOSE)
|
||||
{
|
||||
PostMessage(hwStartMenuSelect, WM_USER+666, 0, IDCANCEL);
|
||||
return 0;
|
||||
}
|
||||
return CallWindowProc((long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long))lpWndProcOld,hwnd,message,wParam,lParam);
|
||||
}
|
||||
|
||||
#define ProgressiveSetWindowPos(hwWindow, x, cx, cy) \
|
||||
SetWindowPos( \
|
||||
hwWindow, \
|
||||
0, \
|
||||
x, \
|
||||
y_offset, \
|
||||
cx, \
|
||||
cy, \
|
||||
SWP_NOACTIVATE \
|
||||
); \
|
||||
\
|
||||
y_offset += cy + 5;
|
||||
|
||||
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
RECT dialog_r, temp_r, icon_r;
|
||||
|
||||
HFONT hFont = (HFONT)SendMessage(hwParent, WM_GETFONT, 0, 0);
|
||||
|
||||
int y_offset = 0;
|
||||
|
||||
GetWindowRect(hwChild, &dialog_r);
|
||||
ScreenToClient(hwParent, (LPPOINT) &dialog_r);
|
||||
ScreenToClient(hwParent, ((LPPOINT) &dialog_r)+1);
|
||||
SetWindowPos(
|
||||
hwndDlg,
|
||||
0,
|
||||
dialog_r.left,
|
||||
dialog_r.top,
|
||||
dialog_r.right - dialog_r.left,
|
||||
dialog_r.bottom - dialog_r.top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE
|
||||
);
|
||||
|
||||
hwIcon = GetDlgItem(hwndDlg, IDC_NSISICON);
|
||||
hwText = GetDlgItem(hwndDlg, IDC_TEXT);
|
||||
hwLocation = GetDlgItem(hwndDlg, IDC_LOCATION);
|
||||
hwDirList = GetDlgItem(hwndDlg, IDC_DIRLIST);
|
||||
|
||||
SendMessage(hwndDlg, WM_SETFONT, (WPARAM) hFont, TRUE);
|
||||
SendMessage(hwIcon, WM_SETFONT, (WPARAM) hFont, TRUE);
|
||||
SendMessage(hwText, WM_SETFONT, (WPARAM) hFont, TRUE);
|
||||
SendMessage(hwLocation, WM_SETFONT, (WPARAM) hFont, TRUE);
|
||||
SendMessage(hwDirList, WM_SETFONT, (WPARAM) hFont, TRUE);
|
||||
|
||||
if (!noicon)
|
||||
{
|
||||
SendMessage(
|
||||
hwIcon,
|
||||
STM_SETIMAGE,
|
||||
IMAGE_ICON,
|
||||
(LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(103))
|
||||
);
|
||||
}
|
||||
SetWindowPos(
|
||||
hwIcon,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
32,
|
||||
32,
|
||||
SWP_NOACTIVATE | (noicon ? SWP_HIDEWINDOW : 0)
|
||||
);
|
||||
|
||||
if (!*text)
|
||||
lstrcpy(text, "Select the Start Menu folder in which you would like to create the program's shortcuts:");
|
||||
|
||||
GetWindowRect(hwIcon, &icon_r);
|
||||
icon_r.right += 5;
|
||||
icon_r.bottom += 5;
|
||||
ScreenToClient(hwndDlg, ((LPPOINT) &icon_r) + 1);
|
||||
|
||||
ProgressiveSetWindowPos(
|
||||
hwText,
|
||||
noicon ? 0 : icon_r.right,
|
||||
dialog_r.right - dialog_r.left - (noicon ? 0 : icon_r.right),
|
||||
icon_r.bottom
|
||||
);
|
||||
|
||||
SendMessage(hwText, WM_SETTEXT, 0, (LPARAM) text);
|
||||
|
||||
GetWindowRect(hwLocation, &temp_r);
|
||||
|
||||
ProgressiveSetWindowPos(
|
||||
hwLocation,
|
||||
0,
|
||||
dialog_r.right - dialog_r.left,
|
||||
temp_r.bottom - temp_r.top
|
||||
);
|
||||
|
||||
SendMessage(hwLocation, WM_SETTEXT, 0, (LPARAM) progname);
|
||||
|
||||
ProgressiveSetWindowPos(
|
||||
hwDirList,
|
||||
0,
|
||||
dialog_r.right - dialog_r.left,
|
||||
dialog_r.bottom - dialog_r.top - y_offset
|
||||
);
|
||||
|
||||
AddFolderFromReg("Programs", HKEY_LOCAL_MACHINE);
|
||||
AddFolderFromReg("Programs", HKEY_CURRENT_USER);
|
||||
|
||||
ShowWindow(hwndDlg, SW_SHOWNA);
|
||||
SetFocus(GetDlgItem(hwParent, IDOK));
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDC_DIRLIST && HIWORD(wParam) == LBN_SELCHANGE)
|
||||
{
|
||||
SendMessage(hwDirList, LB_GETTEXT, SendMessage(hwDirList, LB_GETCURSEL, 0, 0), (WPARAM)buf);
|
||||
if (autoadd)
|
||||
{
|
||||
lstrcat(buf, "\\");
|
||||
lstrcat(buf, progname);
|
||||
}
|
||||
SendMessage(hwLocation, WM_SETTEXT, 0, (LPARAM) buf);
|
||||
}
|
||||
break;
|
||||
case WM_USER+666:
|
||||
g_done = 1;
|
||||
switch (lParam) {
|
||||
case IDOK:
|
||||
SendMessage(hwLocation, WM_GETTEXT, MAX_PATH, (LPARAM) buf);
|
||||
pushstring(buf);
|
||||
break;
|
||||
case IDCANCEL:
|
||||
pushstring("cancel");
|
||||
break;
|
||||
case 3:
|
||||
pushstring("back");
|
||||
break;
|
||||
}
|
||||
DestroyWindow(hwndDlg);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
g_hInstance=hInst;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void AddFolderFromReg(char *name, HKEY rootKey)
|
||||
{
|
||||
DWORD dwResult;
|
||||
DWORD dwLength = MAX_PATH;
|
||||
DWORD dwType = REG_SZ;
|
||||
HKEY hKey;
|
||||
|
||||
char szName[20] = "Common ";
|
||||
|
||||
lstrcpy(szName + 7, name);
|
||||
|
||||
dwResult = RegOpenKeyEx(
|
||||
rootKey,
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey
|
||||
);
|
||||
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
{
|
||||
dwResult = RegQueryValueEx(
|
||||
hKey,
|
||||
rootKey == HKEY_LOCAL_MACHINE ? szName : szName + 7,
|
||||
NULL,
|
||||
&dwType,
|
||||
(BYTE *) buf,
|
||||
&dwLength
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
PopulateListWithDir(buf);
|
||||
}
|
||||
|
||||
void PopulateListWithDir(char *dir)
|
||||
{
|
||||
//DWORD idx;
|
||||
WIN32_FIND_DATA FileData;
|
||||
HANDLE hSearch;
|
||||
|
||||
lstrcat(dir, "\\*.");
|
||||
hSearch = FindFirstFile(dir, &FileData);
|
||||
if (hSearch != INVALID_HANDLE_VALUE) do
|
||||
{
|
||||
if (*(WORD*)FileData.cFileName != *(WORD*)".")
|
||||
{
|
||||
if (*(WORD*)FileData.cFileName != *(WORD*)".." || FileData.cFileName[2])
|
||||
{
|
||||
if (SendMessage(hwDirList, LB_FINDSTRINGEXACT, -1, (LPARAM)FileData.cFileName) == LB_ERR)
|
||||
SendMessage(hwDirList, LB_ADDSTRING, 0, (LPARAM)FileData.cFileName);
|
||||
/*idx = */
|
||||
/*SendMessage(hwDirList, LB_SETITEMDATA, (WPARAM)idx,
|
||||
(LPARAM)ExtractAssociatedIcon(g_hInstance, FileData.cFileName, (WORD*)&idx));*/
|
||||
}
|
||||
}
|
||||
} while (FindNextFile(hSearch, &FileData));
|
||||
}
|
116
Contrib/StartMenu/StartMenu.dsp
Normal file
116
Contrib/StartMenu/StartMenu.dsp
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Microsoft Developer Studio Project File - Name="StartMenu" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=StartMenu - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StartMenu.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "StartMenu.mak" CFG="StartMenu - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "StartMenu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "StartMenu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "StartMenu - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "StartMenu_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "StartMenu_EXPORTS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/StartMenu.dll" /opt:nowin98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "StartMenu - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "StartMenu_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "StartMenu_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "StartMenu - Win32 Release"
|
||||
# Name "StartMenu - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StartMenu.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ExDLL.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StartMenu.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
Contrib/StartMenu/StartMenu.dsw
Normal file
29
Contrib/StartMenu/StartMenu.dsw
Normal file
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "StartMenu"=.\StartMenu.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
100
Contrib/StartMenu/StartMenu.rc
Normal file
100
Contrib/StartMenu/StartMenu.rc
Normal file
|
@ -0,0 +1,100 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG DIALOG DISCARDABLE 0, 0, 137, 98
|
||||
STYLE DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON "",IDC_NSISICON,21,18,20,20,WS_CLIPSIBLINGS
|
||||
EDITTEXT IDC_LOCATION,59,20,40,12,ES_AUTOHSCROLL |
|
||||
WS_CLIPSIBLINGS
|
||||
LTEXT "",IDC_TEXT,17,65,55,11,WS_CLIPSIBLINGS
|
||||
LISTBOX IDC_DIRLIST,76,42,48,40,LBS_SORT | LBS_NOINTEGRALHEIGHT |
|
||||
WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 130
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 91
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
93
Contrib/StartMenu/exdll.h
Normal file
93
Contrib/StartMenu/exdll.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
#ifndef _EXDLL_H_
|
||||
#define _EXDLL_H_
|
||||
|
||||
// only include this file from one place in your DLL.
|
||||
// (it is all static, if you use it in two places it will fail)
|
||||
|
||||
#define EXDLL_INIT() { \
|
||||
g_stringsize=string_size; \
|
||||
g_stacktop=stacktop; \
|
||||
g_variables=variables; }
|
||||
|
||||
|
||||
typedef struct _stack_t {
|
||||
struct _stack_t *next;
|
||||
char text[1]; // this should be the length of string_size
|
||||
} stack_t;
|
||||
|
||||
|
||||
static int g_stringsize;
|
||||
static stack_t **g_stacktop;
|
||||
static char *g_variables;
|
||||
|
||||
static int popstring(char *str); // 0 on success, 1 on empty stack
|
||||
static void pushstring(char *str);
|
||||
|
||||
enum
|
||||
{
|
||||
INST_0, // $0
|
||||
INST_1, // $1
|
||||
INST_2, // $2
|
||||
INST_3, // $3
|
||||
INST_4, // $4
|
||||
INST_5, // $5
|
||||
INST_6, // $6
|
||||
INST_7, // $7
|
||||
INST_8, // $8
|
||||
INST_9, // $9
|
||||
INST_R0, // $R0
|
||||
INST_R1, // $R1
|
||||
INST_R2, // $R2
|
||||
INST_R3, // $R3
|
||||
INST_R4, // $R4
|
||||
INST_R5, // $R5
|
||||
INST_R6, // $R6
|
||||
INST_R7, // $R7
|
||||
INST_R8, // $R8
|
||||
INST_R9, // $R9
|
||||
INST_CMDLINE, // $CMDLINE
|
||||
INST_INSTDIR, // $INSTDIR
|
||||
INST_OUTDIR, // $OUTDIR
|
||||
INST_EXEDIR, // $EXEDIR
|
||||
INST_LANG, // $LANGUAGE
|
||||
__INST_LAST
|
||||
};
|
||||
|
||||
|
||||
// utility functions (not required but often useful)
|
||||
static int popstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop || !*g_stacktop) return 1;
|
||||
th=(*g_stacktop);
|
||||
lstrcpy(str,th->text);
|
||||
*g_stacktop = th->next;
|
||||
GlobalFree((HGLOBAL)th);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pushstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop) return;
|
||||
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
|
||||
lstrcpyn(th->text,str,g_stringsize);
|
||||
th->next=*g_stacktop;
|
||||
*g_stacktop=th;
|
||||
}
|
||||
|
||||
static char *getuservariable(int varnum)
|
||||
{
|
||||
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
|
||||
return g_variables+varnum*g_stringsize;
|
||||
}
|
||||
|
||||
static void setuservariable(int varnum, char *var)
|
||||
{
|
||||
if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
|
||||
lstrcpy(g_variables + varnum*g_stringsize, var);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif//_EXDLL_H_
|
20
Contrib/StartMenu/resource.h
Normal file
20
Contrib/StartMenu/resource.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by StartMenu.rc
|
||||
//
|
||||
#define IDD_DIALOG 101
|
||||
#define IDC_NSISICON 1001
|
||||
#define IDC_LOCATION 1002
|
||||
#define IDC_TEXT 1003
|
||||
#define IDC_DIRLIST 1004
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1005
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
BIN
Plugins/StartMenu.dll
Normal file
BIN
Plugins/StartMenu.dll
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue