mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
DEVEL15-windows-shell-ext-reformat-20070130
reformat the source code to make it easier to read/edit
(cherry picked from commit 908918a89d
)
This commit is contained in:
parent
1bef8a99ad
commit
7414591639
@ -43,10 +43,10 @@ static const IID IID_IShellExt =
|
||||
// CAfsShlExt
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAfsShlExt, CWinApp)
|
||||
//{{AFX_MSG_MAP(CAfsShlExt)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CAfsShlExt)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -54,9 +54,9 @@ END_MESSAGE_MAP()
|
||||
|
||||
CAfsShlExt::CAfsShlExt()
|
||||
{
|
||||
/* Start up sockets */
|
||||
WSADATA WSAjunk;
|
||||
WSAStartup(0x0101, &WSAjunk);
|
||||
/* Start up sockets */
|
||||
WSADATA WSAjunk;
|
||||
WSAStartup(0x0101, &WSAjunk);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -70,16 +70,16 @@ HINSTANCE g_hInstance;
|
||||
|
||||
BOOL CAfsShlExt::InitInstance()
|
||||
{
|
||||
// Load our translated resources
|
||||
TaLocale_LoadCorrespondingModuleByName (m_hInstance, TEXT("afs_shl_ext.dll"));
|
||||
// Load our translated resources
|
||||
TaLocale_LoadCorrespondingModuleByName (m_hInstance, TEXT("afs_shl_ext.dll"));
|
||||
|
||||
// Register all OLE server (factories) as running. This enables the
|
||||
// OLE libraries to create objects from other applications.
|
||||
COleObjectFactory::RegisterAll();
|
||||
// Register all OLE server (factories) as running. This enables the
|
||||
// OLE libraries to create objects from other applications.
|
||||
COleObjectFactory::RegisterAll();
|
||||
|
||||
SetHelpPath(m_pszHelpFilePath);
|
||||
SetHelpPath(m_pszHelpFilePath);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -87,13 +87,13 @@ BOOL CAfsShlExt::InitInstance()
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return AfxDllGetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return AfxDllGetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
#ifdef COMMENT
|
||||
// This test is correct and we really do want to allow the extension to be loaded and
|
||||
@ -102,65 +102,65 @@ STDAPI DllCanUnloadNow(void)
|
||||
// until someone has time to figure out how to debug this.
|
||||
// Jeffrey Altman - 2 Oct 2005
|
||||
|
||||
if (!nCMRefCount && !nSERefCount && !nICRefCount && !nTPRefCount && !nXPRefCount)
|
||||
return S_OK;
|
||||
if (!nCMRefCount && !nSERefCount && !nICRefCount && !nTPRefCount && !nXPRefCount)
|
||||
return S_OK;
|
||||
#endif
|
||||
return S_FALSE;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
int WideCharToLocal(LPTSTR pLocal, LPCWSTR pWide, DWORD dwChars)
|
||||
{
|
||||
*pLocal = 0;
|
||||
WideCharToMultiByte( CP_ACP, 0, pWide, -1, pLocal, dwChars, NULL, NULL);
|
||||
return lstrlen(pLocal);
|
||||
*pLocal = 0;
|
||||
WideCharToMultiByte( CP_ACP, 0, pWide, -1, pLocal, dwChars, NULL, NULL);
|
||||
return lstrlen(pLocal);
|
||||
}
|
||||
|
||||
LRESULT DoRegCLSID(HKEY hKey,PTCHAR szSubKey,PTCHAR szData,PTCHAR szValue=NULL)
|
||||
{
|
||||
DWORD dwDisp;
|
||||
LRESULT lResult;
|
||||
HKEY thKey;
|
||||
lResult = RegCreateKeyEx(hKey, szSubKey, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
|
||||
&thKey, &dwDisp);
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
lResult = RegSetValueEx(thKey, szValue, 0, REG_SZ,
|
||||
(LPBYTE)szData, (lstrlen(szData) + 1)
|
||||
* sizeof(TCHAR));
|
||||
RegCloseKey(thKey);
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return lResult;
|
||||
DWORD dwDisp;
|
||||
LRESULT lResult;
|
||||
HKEY thKey;
|
||||
lResult = RegCreateKeyEx(hKey, szSubKey, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
|
||||
&thKey, &dwDisp);
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
lResult = RegSetValueEx(thKey, szValue, 0, REG_SZ,
|
||||
(LPBYTE)szData, (lstrlen(szData) + 1)
|
||||
* sizeof(TCHAR));
|
||||
RegCloseKey(thKey);
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
return lResult;
|
||||
}
|
||||
|
||||
// by exporting DllRegisterServer, you can use regsvr.exe
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
LRESULT lResult;
|
||||
DWORD dwDisp;
|
||||
TCHAR szSubKey[MAX_PATH];
|
||||
TCHAR szCLSID[MAX_PATH];
|
||||
HKEY hKey;
|
||||
LRESULT lResult;
|
||||
DWORD dwDisp;
|
||||
TCHAR szSubKey[MAX_PATH];
|
||||
TCHAR szCLSID[MAX_PATH];
|
||||
TCHAR szModule[MAX_PATH];
|
||||
LPWSTR pwsz;
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
COleObjectFactory::UpdateRegistryAll();
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
COleObjectFactory::UpdateRegistryAll();
|
||||
|
||||
StringFromIID(IID_IShellExt, &pwsz);
|
||||
if(pwsz)
|
||||
StringFromIID(IID_IShellExt, &pwsz);
|
||||
if(pwsz)
|
||||
{
|
||||
WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
|
||||
LPMALLOC pMalloc;
|
||||
CoGetMalloc(1, &pMalloc);
|
||||
if(pMalloc)
|
||||
{
|
||||
WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
|
||||
LPMALLOC pMalloc;
|
||||
CoGetMalloc(1, &pMalloc);
|
||||
if(pMalloc)
|
||||
{
|
||||
(pMalloc->Free)(pwsz);
|
||||
(pMalloc->Release)();
|
||||
}
|
||||
} else {
|
||||
return E_FAIL;
|
||||
(pMalloc->Free)(pwsz);
|
||||
(pMalloc->Release)();
|
||||
}
|
||||
} else {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
[HKEY_CLASSES_ROOT\CLSID\{$CLSID}\InprocServer32]
|
||||
@ -168,25 +168,25 @@ STDAPI DllRegisterServer(void)
|
||||
"ThreadingModel"="Apartment"
|
||||
*/
|
||||
HMODULE hModule=GetModuleHandle("afs_shl_ext.dll");
|
||||
DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
|
||||
wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szModule))!=NOERROR)
|
||||
return lResult;
|
||||
DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
|
||||
wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szModule))!=NOERROR)
|
||||
return lResult;
|
||||
|
||||
wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,"Apartment","ThreadingModel"))!=NOERROR)
|
||||
return lResult;
|
||||
wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,"Apartment","ThreadingModel"))!=NOERROR)
|
||||
return lResult;
|
||||
|
||||
/*
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\AFS Client Shell Extension]
|
||||
@="{EA3775F2-28BE-11D3-9C8D-00105A24ED29}"
|
||||
*/
|
||||
|
||||
wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
|
||||
if ((lResult=DoRegCLSID(HKEY_LOCAL_MACHINE,szSubKey,szCLSID))!=NOERROR)
|
||||
return lResult;
|
||||
wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
|
||||
if ((lResult=DoRegCLSID(HKEY_LOCAL_MACHINE,szSubKey,szCLSID))!=NOERROR)
|
||||
return lResult;
|
||||
|
||||
//If running on NT, register the extension as approved.
|
||||
//If running on NT, register the extension as approved.
|
||||
/*
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
|
||||
"{$(CLSID)}"="AFS Client Shell Extension"
|
||||
@ -218,130 +218,129 @@ STDAPI DllRegisterServer(void)
|
||||
@="{$(CLSID)}"
|
||||
*/
|
||||
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szCLSID))!=NOERROR)
|
||||
return lResult;
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
|
||||
if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szCLSID))!=NOERROR)
|
||||
return lResult;
|
||||
|
||||
|
||||
/* Below needs to be merged with above */
|
||||
|
||||
/* Below needs to be merged with above */
|
||||
wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||
szSubKey,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisp);
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||
szSubKey,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisp);
|
||||
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
//Create the value string.
|
||||
lResult = RegSetValueEx( hKey,
|
||||
NULL,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szCLSID,
|
||||
(lstrlen(szCLSID) + 1) * sizeof(TCHAR));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else
|
||||
return SELFREG_E_CLASS;
|
||||
|
||||
//If running on NT, register the extension as approved.
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
GetVersionEx(&osvi);
|
||||
if(VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
|
||||
{
|
||||
lstrcpy( szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
|
||||
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||
szSubKey,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisp);
|
||||
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
//Create the value string.
|
||||
lResult = RegSetValueEx( hKey,
|
||||
NULL,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szCLSID,
|
||||
(lstrlen(szCLSID) + 1) * sizeof(TCHAR));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else
|
||||
return SELFREG_E_CLASS;
|
||||
TCHAR szData[MAX_PATH];
|
||||
|
||||
//If running on NT, register the extension as approved.
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
GetVersionEx(&osvi);
|
||||
if(VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
|
||||
{
|
||||
lstrcpy( szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
|
||||
//Create the value string.
|
||||
lstrcpy(szData, STR_EXT_TITLE);
|
||||
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||
szSubKey,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisp);
|
||||
lResult = RegSetValueEx( hKey,
|
||||
szCLSID,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szData,
|
||||
(lstrlen(szData) + 1) * sizeof(TCHAR));
|
||||
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
TCHAR szData[MAX_PATH];
|
||||
|
||||
//Create the value string.
|
||||
lstrcpy(szData, STR_EXT_TITLE);
|
||||
|
||||
lResult = RegSetValueEx( hKey,
|
||||
szCLSID,
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szData,
|
||||
(lstrlen(szData) + 1) * sizeof(TCHAR));
|
||||
|
||||
RegCloseKey(hKey);
|
||||
} else
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
return S_OK;
|
||||
RegCloseKey(hKey);
|
||||
} else
|
||||
return SELFREG_E_CLASS;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//returnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, keyName, 0, KEY_ALL_ACCESS, ®istryKey);
|
||||
|
||||
LRESULT DoValueDelete(HKEY hKey,PTCHAR pszSubKey,PTCHAR szValue=NULL)
|
||||
{
|
||||
LRESULT lResult;
|
||||
HKEY thKey;
|
||||
if (szValue==NULL) {
|
||||
lResult=RegDeleteKey(hKey, pszSubKey);
|
||||
return lResult;
|
||||
}
|
||||
lResult = RegOpenKeyEx( hKey,
|
||||
pszSubKey,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&thKey);
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
lResult=RegDeleteValue(hKey, szValue);
|
||||
RegCloseKey(thKey);
|
||||
}
|
||||
LRESULT lResult;
|
||||
HKEY thKey;
|
||||
if (szValue==NULL) {
|
||||
lResult=RegDeleteKey(hKey, pszSubKey);
|
||||
return lResult;
|
||||
}
|
||||
lResult = RegOpenKeyEx( hKey,
|
||||
pszSubKey,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&thKey);
|
||||
if(NOERROR == lResult)
|
||||
{
|
||||
lResult=RegDeleteValue(hKey, szValue);
|
||||
RegCloseKey(thKey);
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
TCHAR szSubKey[MAX_PATH];
|
||||
TCHAR szCLSID[MAX_PATH];
|
||||
LPWSTR pwsz;
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
COleObjectFactory::UpdateRegistryAll(FALSE);
|
||||
StringFromIID(IID_IShellExt, &pwsz);
|
||||
if(pwsz)
|
||||
TCHAR szSubKey[MAX_PATH];
|
||||
TCHAR szCLSID[MAX_PATH];
|
||||
LPWSTR pwsz;
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
COleObjectFactory::UpdateRegistryAll(FALSE);
|
||||
StringFromIID(IID_IShellExt, &pwsz);
|
||||
if(pwsz)
|
||||
{
|
||||
WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
|
||||
LPMALLOC pMalloc;
|
||||
CoGetMalloc(1, &pMalloc);
|
||||
if(pMalloc)
|
||||
{
|
||||
WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
|
||||
LPMALLOC pMalloc;
|
||||
CoGetMalloc(1, &pMalloc);
|
||||
if(pMalloc)
|
||||
{
|
||||
(pMalloc->Free)(pwsz);
|
||||
(pMalloc->Release)();
|
||||
}
|
||||
} else {
|
||||
return E_FAIL;
|
||||
(pMalloc->Free)(pwsz);
|
||||
(pMalloc->Release)();
|
||||
}
|
||||
wsprintf(szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
|
||||
DoValueDelete(HKEY_LOCAL_MACHINE,szSubKey,szCLSID);
|
||||
wsprintf(szSubKey, TEXT("*\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_LOCAL_MACHINE, szSubKey);
|
||||
return S_OK;
|
||||
}
|
||||
} else {
|
||||
return E_FAIL;
|
||||
}
|
||||
wsprintf(szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
|
||||
DoValueDelete(HKEY_LOCAL_MACHINE,szSubKey,szCLSID);
|
||||
wsprintf(szSubKey, TEXT("*\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("Folder\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
|
||||
wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
|
||||
DoValueDelete(HKEY_LOCAL_MACHINE, szSubKey);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -21,396 +21,388 @@ extern "C" {
|
||||
|
||||
|
||||
/*
|
||||
ShowMessageBox:
|
||||
|
||||
This function takes three main arguements, the stringtable ID, the button types
|
||||
to be displayed (default = MB_OK) and the help table reference (default = 0, no
|
||||
help) and then a variable amount of arguements. The variable list does not need
|
||||
a special ending flag/character/number. The list is read only as needed, which
|
||||
is defined by the string table and the presence of any "%X" characters, where X
|
||||
is one of the printf format types. The order of the variable list MUST
|
||||
correspond to the order of types in the string table entry. If the string table
|
||||
calls for INT INT UINT CHAR* DOUBLE, then the arguement list had better be INT
|
||||
INT UINT CHAR* DOUBLE or else there will be serious problems (stack will be
|
||||
misread, general protection faults, garbage output, and other errors).
|
||||
|
||||
This function takes the arguements passed in the list and inserts them by
|
||||
parsing and pszcut/pszpaste the string table entry to add all the arguements passed
|
||||
in. This allows for any generic message to be created.
|
||||
|
||||
%i,d = Integer
|
||||
%u = unsigned int
|
||||
%x,X = Hex (takes an integer arguement, pszconverts it)
|
||||
%g,f,e = Double
|
||||
%s = String (char*)
|
||||
%l
|
||||
d = Long int
|
||||
x = long hex
|
||||
%c = character (one)
|
||||
%a = String Table Ref. (UINT)
|
||||
%o = CString object (prints the string of the object)
|
||||
default = prints out string so far, with error message attached at place of error.
|
||||
|
||||
Return type is the button pressed in the message box.
|
||||
ShowMessageBox:
|
||||
|
||||
This function takes three main arguements, the stringtable ID, the button types
|
||||
to be displayed (default = MB_OK) and the help table reference (default = 0, no
|
||||
help) and then a variable amount of arguements. The variable list does not need
|
||||
a special ending flag/character/number. The list is read only as needed, which
|
||||
is defined by the string table and the presence of any "%X" characters, where X
|
||||
is one of the printf format types. The order of the variable list MUST
|
||||
correspond to the order of types in the string table entry. If the string table
|
||||
calls for INT INT UINT CHAR* DOUBLE, then the arguement list had better be INT
|
||||
INT UINT CHAR* DOUBLE or else there will be serious problems (stack will be
|
||||
misread, general protection faults, garbage output, and other errors).
|
||||
|
||||
This function takes the arguements passed in the list and inserts them by
|
||||
parsing and pszcut/pszpaste the string table entry to add all the arguements passed
|
||||
in. This allows for any generic message to be created.
|
||||
|
||||
%i,d = Integer
|
||||
%u = unsigned int
|
||||
%x,X = Hex (takes an integer arguement, pszconverts it)
|
||||
%g,f,e = Double
|
||||
%s = String (char*)
|
||||
%l
|
||||
d = Long int
|
||||
x = long hex
|
||||
%c = character (one)
|
||||
%a = String Table Ref. (UINT)
|
||||
%o = CString object (prints the string of the object)
|
||||
default = prints out string so far, with error message attached at place of error.
|
||||
|
||||
Return type is the button pressed in the message box.
|
||||
|
||||
*/
|
||||
|
||||
UINT ShowMessageBox (UINT Id, UINT Button, UINT Help, ...) {
|
||||
|
||||
CString
|
||||
temp;
|
||||
char *pszstring,
|
||||
*pszpaste,
|
||||
*pszcut,
|
||||
*pszdone,
|
||||
*pszconvert;
|
||||
char
|
||||
chread;
|
||||
va_list
|
||||
params;
|
||||
int
|
||||
x;
|
||||
|
||||
pszconvert = new char[255];
|
||||
va_start(params, Help);
|
||||
LoadString (temp, Id);
|
||||
pszstring = temp.GetBuffer(512);
|
||||
strcpy(pszstring,pszstring);
|
||||
temp.ReleaseBuffer();
|
||||
// Look and see - is there a need to insert chars (95% of the time, there won't)
|
||||
if (!strstr(pszstring, "%")) {
|
||||
delete pszconvert;
|
||||
return AfxMessageBox(pszstring, Button, Help);
|
||||
}
|
||||
|
||||
x = strcspn(pszstring, "%");
|
||||
pszdone = new char[512];
|
||||
pszcut = new char[512];
|
||||
pszpaste = new char[512];
|
||||
strcpy(pszcut, &pszstring[x+2]);
|
||||
strncpy(pszpaste, pszstring, x);
|
||||
CString temp;
|
||||
char *pszstring,
|
||||
*pszpaste,
|
||||
*pszcut,
|
||||
*pszdone,
|
||||
*pszconvert;
|
||||
char chread;
|
||||
va_list params;
|
||||
int x;
|
||||
|
||||
pszconvert = new char[255];
|
||||
va_start(params, Help);
|
||||
LoadString (temp, Id);
|
||||
pszstring = temp.GetBuffer(512);
|
||||
strcpy(pszstring,pszstring);
|
||||
temp.ReleaseBuffer();
|
||||
// Look and see - is there a need to insert chars (95% of the time, there won't)
|
||||
if (!strstr(pszstring, "%")) {
|
||||
delete pszconvert;
|
||||
return AfxMessageBox(pszstring, Button, Help);
|
||||
}
|
||||
|
||||
x = strcspn(pszstring, "%");
|
||||
pszdone = new char[512];
|
||||
pszcut = new char[512];
|
||||
pszpaste = new char[512];
|
||||
strcpy(pszcut, &pszstring[x+2]);
|
||||
strncpy(pszpaste, pszstring, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszstring[x+1];
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
switch (chread) {
|
||||
case 'i' :
|
||||
case 'd' :
|
||||
{
|
||||
int anint = va_arg(params, int);
|
||||
_itoa( anint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
case 'u' :
|
||||
{
|
||||
UINT anuint = va_arg(params, UINT);
|
||||
_itoa( anuint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
{
|
||||
int ahex = va_arg(params, int);
|
||||
_itoa( ahex, pszconvert, 16);
|
||||
break;
|
||||
}
|
||||
case 'g' :
|
||||
case 'f' :
|
||||
case 'e' :
|
||||
{
|
||||
double adbl = va_arg(params, double);
|
||||
_gcvt( adbl, 10, pszconvert);
|
||||
break;
|
||||
}
|
||||
case 's' :
|
||||
{
|
||||
char *pStr = va_arg(params, char*);
|
||||
ASSERT(strlen(pStr) <= 255);
|
||||
strcpy(pszconvert, pStr);
|
||||
break;
|
||||
}
|
||||
case 'l' :
|
||||
{
|
||||
chread = pszdone[x+2];
|
||||
switch(chread) {
|
||||
case 'x' :
|
||||
{
|
||||
long int alhex = va_arg(params, long int);
|
||||
_ltoa(alhex, pszconvert, 16);
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
case 'd' :
|
||||
default :
|
||||
{
|
||||
long int along = va_arg(params, long int);
|
||||
_ltoa( along, pszconvert, 10);
|
||||
// For the L, there will be one character after it,
|
||||
// so move ahead another letter
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c' :
|
||||
{
|
||||
int letter = va_arg(params, int);
|
||||
pszconvert[0] = (char)letter;
|
||||
pszconvert[1] = '\0';
|
||||
break;
|
||||
}
|
||||
case 'a' :
|
||||
{
|
||||
CString zeta;
|
||||
char* lsc;
|
||||
UINT ls = va_arg(params, UINT);
|
||||
LoadString (zeta, ls);
|
||||
lsc = zeta.GetBuffer(255);
|
||||
strcpy(pszconvert, lsc);
|
||||
zeta.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
case 'o' :
|
||||
{
|
||||
CString get = va_arg(params, CString);
|
||||
char* ex = get.GetBuffer(255);
|
||||
strcpy(pszconvert,ex);
|
||||
get.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
AfxMessageBox(pszdone, Button, Help);
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
ASSERT(FALSE);
|
||||
return 0;
|
||||
}
|
||||
} // case
|
||||
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
// Now pszdone holds the entire message.
|
||||
// Check to see if there are more insertions to be made or not
|
||||
|
||||
if (!strstr(pszdone, "%")) {
|
||||
UINT rt_type = AfxMessageBox(pszdone, Button, Help);
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
return rt_type;
|
||||
} // if
|
||||
|
||||
// there are more insertions to make, prepare the strings to use.
|
||||
x = strcspn(pszdone, "%");
|
||||
strcpy(pszcut, &pszdone[x+2]);
|
||||
strncpy(pszpaste, pszdone, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszstring[x+1];
|
||||
chread = pszdone[x+1];
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
switch (chread) {
|
||||
case 'i' :
|
||||
case 'd' :
|
||||
{
|
||||
int anint = va_arg(params, int);
|
||||
_itoa( anint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
case 'u' :
|
||||
{
|
||||
UINT anuint = va_arg(params, UINT);
|
||||
_itoa( anuint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
{
|
||||
int ahex = va_arg(params, int);
|
||||
_itoa( ahex, pszconvert, 16);
|
||||
break;
|
||||
}
|
||||
case 'g' :
|
||||
case 'f' :
|
||||
case 'e' :
|
||||
{
|
||||
double adbl = va_arg(params, double);
|
||||
_gcvt( adbl, 10, pszconvert);
|
||||
break;
|
||||
}
|
||||
case 's' :
|
||||
{
|
||||
char *pStr = va_arg(params, char*);
|
||||
ASSERT(strlen(pStr) <= 255);
|
||||
strcpy(pszconvert, pStr);
|
||||
break;
|
||||
}
|
||||
case 'l' :
|
||||
{
|
||||
chread = pszdone[x+2];
|
||||
switch(chread) {
|
||||
case 'x' :
|
||||
{
|
||||
long int alhex = va_arg(params, long int);
|
||||
_ltoa(alhex, pszconvert, 16);
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
case 'd' :
|
||||
default :
|
||||
{
|
||||
long int along = va_arg(params, long int);
|
||||
_ltoa( along, pszconvert, 10);
|
||||
// For the L, there will be one character after it,
|
||||
// so move ahead another letter
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c' :
|
||||
{
|
||||
int letter = va_arg(params, int);
|
||||
pszconvert[0] = (char)letter;
|
||||
pszconvert[1] = '\0';
|
||||
break;
|
||||
}
|
||||
case 'a' :
|
||||
{
|
||||
CString zeta;
|
||||
char* lsc;
|
||||
UINT ls = va_arg(params, UINT);
|
||||
LoadString (zeta, ls);
|
||||
lsc = zeta.GetBuffer(255);
|
||||
strcpy(pszconvert, lsc);
|
||||
zeta.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
case 'o' :
|
||||
{
|
||||
CString get = va_arg(params, CString);
|
||||
char* ex = get.GetBuffer(255);
|
||||
strcpy(pszconvert,ex);
|
||||
get.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
AfxMessageBox(pszdone, Button, Help);
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
ASSERT(FALSE);
|
||||
return 0;
|
||||
}
|
||||
} // case
|
||||
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
// Now pszdone holds the entire message.
|
||||
// Check to see if there are more insertions to be made or not
|
||||
|
||||
if (!strstr(pszdone, "%")) {
|
||||
UINT rt_type = AfxMessageBox(pszdone, Button, Help);
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
return rt_type;
|
||||
} // if
|
||||
|
||||
// there are more insertions to make, prepare the strings to use.
|
||||
x = strcspn(pszdone, "%");
|
||||
strcpy(pszcut, &pszdone[x+2]);
|
||||
strncpy(pszpaste, pszdone, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszdone[x+1];
|
||||
|
||||
} // for
|
||||
ASSERT(FALSE);
|
||||
return 0;
|
||||
} // for
|
||||
ASSERT(FALSE);
|
||||
return 0;
|
||||
|
||||
} // ShowMessageBox
|
||||
|
||||
CString GetMessageString(UINT Id, ...)
|
||||
{
|
||||
CString
|
||||
temp;
|
||||
char *pszstring,
|
||||
*pszpaste,
|
||||
*pszcut,
|
||||
*pszdone,
|
||||
*pszconvert;
|
||||
char
|
||||
chread;
|
||||
va_list
|
||||
params;
|
||||
int
|
||||
x;
|
||||
CString strMsg;
|
||||
CString temp;
|
||||
char *pszstring,
|
||||
*pszpaste,
|
||||
*pszcut,
|
||||
*pszdone,
|
||||
*pszconvert;
|
||||
char chread;
|
||||
va_list params;
|
||||
int x;
|
||||
CString strMsg;
|
||||
|
||||
pszconvert = new char[255];
|
||||
va_start(params, Id);
|
||||
LoadString (temp, Id);
|
||||
pszstring = temp.GetBuffer(512);
|
||||
strcpy(pszconvert,pszstring);
|
||||
temp.ReleaseBuffer();
|
||||
pszconvert = new char[255];
|
||||
va_start(params, Id);
|
||||
LoadString (temp, Id);
|
||||
pszstring = temp.GetBuffer(512);
|
||||
strcpy(pszconvert,pszstring);
|
||||
temp.ReleaseBuffer();
|
||||
|
||||
// Look and see - is there a need to insert chars (95% of the time, there won't)
|
||||
if (!strstr(pszstring, "%")) {
|
||||
strMsg = pszconvert;
|
||||
delete pszconvert;
|
||||
return strMsg;
|
||||
}
|
||||
|
||||
x = strcspn(pszstring, "%");
|
||||
pszdone = new char[512];
|
||||
pszcut = new char[512];
|
||||
pszpaste = new char[512];
|
||||
strcpy(pszcut, &pszstring[x+2]);
|
||||
strncpy(pszpaste, pszstring, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszstring[x+1];
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
switch (chread) {
|
||||
case 'i' :
|
||||
case 'd' :
|
||||
{
|
||||
int anint = va_arg(params, int);
|
||||
_itoa( anint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
case 'u' :
|
||||
{
|
||||
UINT anuint = va_arg(params, UINT);
|
||||
_itoa( anuint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
{
|
||||
int ahex = va_arg(params, int);
|
||||
_itoa( ahex, pszconvert, 16);
|
||||
break;
|
||||
}
|
||||
case 'g' :
|
||||
case 'f' :
|
||||
case 'e' :
|
||||
{
|
||||
double adbl = va_arg(params, double);
|
||||
_gcvt( adbl, 10, pszconvert);
|
||||
break;
|
||||
}
|
||||
case 's' :
|
||||
{
|
||||
char *pStr = va_arg(params, char*);
|
||||
ASSERT(strlen(pStr) <= 255);
|
||||
strcpy(pszconvert, pStr);
|
||||
break;
|
||||
}
|
||||
case 'l' :
|
||||
{
|
||||
chread = pszdone[x+2];
|
||||
switch(chread) {
|
||||
case 'x' :
|
||||
{
|
||||
long int alhex = va_arg(params, long int);
|
||||
_ltoa(alhex, pszconvert, 16);
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
case 'd' :
|
||||
default :
|
||||
{
|
||||
long int along = va_arg(params, long int);
|
||||
_ltoa( along, pszconvert, 10);
|
||||
// For the L, there will be one character after it,
|
||||
// so move ahead another letter
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c' :
|
||||
{
|
||||
int letter = va_arg(params, int);
|
||||
pszconvert[0] = (char)letter;
|
||||
pszconvert[1] = '\0';
|
||||
break;
|
||||
}
|
||||
case 'a' :
|
||||
{
|
||||
CString zeta;
|
||||
char* lsc;
|
||||
UINT ls = va_arg(params, UINT);
|
||||
LoadString (zeta, ls);
|
||||
lsc = zeta.GetBuffer(255);
|
||||
strcpy(pszconvert, lsc);
|
||||
zeta.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
case 'o' :
|
||||
{
|
||||
CString get = va_arg(params, CString);
|
||||
char* ex = get.GetBuffer(255);
|
||||
strcpy(pszconvert,ex);
|
||||
get.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
strMsg = pszdone;
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
ASSERT(FALSE);
|
||||
return strMsg;
|
||||
}
|
||||
} // case
|
||||
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
// Now pszdone holds the entire message.
|
||||
// Check to see if there are more insertions to be made or not
|
||||
|
||||
if (!strstr(pszdone, "%")) {
|
||||
strMsg = pszdone;
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
return strMsg;
|
||||
} // if
|
||||
|
||||
// there are more insertions to make, prepare the strings to use.
|
||||
x = strcspn(pszdone, "%");
|
||||
strcpy(pszcut, &pszdone[x+2]);
|
||||
strncpy(pszpaste, pszdone, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszdone[x+1];
|
||||
|
||||
} // for
|
||||
ASSERT(FALSE);
|
||||
// Look and see - is there a need to insert chars (95% of the time, there won't)
|
||||
if (!strstr(pszstring, "%")) {
|
||||
strMsg = pszconvert;
|
||||
delete pszconvert;
|
||||
return strMsg;
|
||||
}
|
||||
|
||||
x = strcspn(pszstring, "%");
|
||||
pszdone = new char[512];
|
||||
pszcut = new char[512];
|
||||
pszpaste = new char[512];
|
||||
strcpy(pszcut, &pszstring[x+2]);
|
||||
strncpy(pszpaste, pszstring, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszstring[x+1];
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
switch (chread) {
|
||||
case 'i' :
|
||||
case 'd' :
|
||||
{
|
||||
int anint = va_arg(params, int);
|
||||
_itoa( anint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
case 'u' :
|
||||
{
|
||||
UINT anuint = va_arg(params, UINT);
|
||||
_itoa( anuint, pszconvert, 10);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x' :
|
||||
case 'X' :
|
||||
{
|
||||
int ahex = va_arg(params, int);
|
||||
_itoa( ahex, pszconvert, 16);
|
||||
break;
|
||||
}
|
||||
case 'g' :
|
||||
case 'f' :
|
||||
case 'e' :
|
||||
{
|
||||
double adbl = va_arg(params, double);
|
||||
_gcvt( adbl, 10, pszconvert);
|
||||
break;
|
||||
}
|
||||
case 's' :
|
||||
{
|
||||
char *pStr = va_arg(params, char*);
|
||||
ASSERT(strlen(pStr) <= 255);
|
||||
strcpy(pszconvert, pStr);
|
||||
break;
|
||||
}
|
||||
case 'l' :
|
||||
{
|
||||
chread = pszdone[x+2];
|
||||
switch(chread) {
|
||||
case 'x' :
|
||||
{
|
||||
long int alhex = va_arg(params, long int);
|
||||
_ltoa(alhex, pszconvert, 16);
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
case 'd' :
|
||||
default :
|
||||
{
|
||||
long int along = va_arg(params, long int);
|
||||
_ltoa( along, pszconvert, 10);
|
||||
// For the L, there will be one character after it,
|
||||
// so move ahead another letter
|
||||
strcpy(pszcut, &pszcut[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c' :
|
||||
{
|
||||
int letter = va_arg(params, int);
|
||||
pszconvert[0] = (char)letter;
|
||||
pszconvert[1] = '\0';
|
||||
break;
|
||||
}
|
||||
case 'a' :
|
||||
{
|
||||
CString zeta;
|
||||
char* lsc;
|
||||
UINT ls = va_arg(params, UINT);
|
||||
LoadString (zeta, ls);
|
||||
lsc = zeta.GetBuffer(255);
|
||||
strcpy(pszconvert, lsc);
|
||||
zeta.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
case 'o' :
|
||||
{
|
||||
CString get = va_arg(params, CString);
|
||||
char* ex = get.GetBuffer(255);
|
||||
strcpy(pszconvert,ex);
|
||||
get.ReleaseBuffer();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
strMsg = pszdone;
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
ASSERT(FALSE);
|
||||
return strMsg;
|
||||
}
|
||||
} // case
|
||||
|
||||
delete pszdone;
|
||||
pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
|
||||
strcpy(pszdone, pszpaste);
|
||||
strcat(pszdone, pszconvert);
|
||||
strcat(pszdone, pszcut);
|
||||
// Now pszdone holds the entire message.
|
||||
// Check to see if there are more insertions to be made or not
|
||||
|
||||
if (!strstr(pszdone, "%")) {
|
||||
strMsg = pszdone;
|
||||
delete pszcut;
|
||||
delete pszpaste;
|
||||
delete pszconvert;
|
||||
delete pszdone;
|
||||
return strMsg;
|
||||
} // if
|
||||
|
||||
// there are more insertions to make, prepare the strings to use.
|
||||
x = strcspn(pszdone, "%");
|
||||
strcpy(pszcut, &pszdone[x+2]);
|
||||
strncpy(pszpaste, pszdone, x);
|
||||
pszpaste[x] = '\0';
|
||||
chread = pszdone[x+1];
|
||||
|
||||
} // for
|
||||
ASSERT(FALSE);
|
||||
return strMsg;
|
||||
}
|
||||
|
||||
void LoadString (CString &Str, UINT id)
|
||||
{
|
||||
TCHAR szString[ 256 ];
|
||||
GetString (szString, id);
|
||||
Str = szString;
|
||||
TCHAR szString[ 256 ];
|
||||
GetString (szString, id);
|
||||
Str = szString;
|
||||
}
|
||||
|
||||
|
@ -29,29 +29,29 @@ static char THIS_FILE[] = __FILE__;
|
||||
CResultsDlg::CResultsDlg(DWORD nHelpID, CWnd* pParent /*=NULL*/)
|
||||
: CDialog()
|
||||
{
|
||||
InitModalIndirect (TaLocale_GetDialogResource (CResultsDlg::IDD), pParent);
|
||||
InitModalIndirect (TaLocale_GetDialogResource (CResultsDlg::IDD), pParent);
|
||||
|
||||
//{{AFX_DATA_INIT(CResultsDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
//{{AFX_DATA_INIT(CResultsDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_nHelpID = nHelpID;
|
||||
m_nHelpID = nHelpID;
|
||||
}
|
||||
|
||||
|
||||
void CResultsDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CResultsDlg)
|
||||
DDX_Control(pDX, IDC_RESULTS_LABEL, m_ResultsLabel);
|
||||
DDX_Control(pDX, IDC_LIST, m_List);
|
||||
//}}AFX_DATA_MAP
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CResultsDlg)
|
||||
DDX_Control(pDX, IDC_RESULTS_LABEL, m_ResultsLabel);
|
||||
DDX_Control(pDX, IDC_LIST, m_List);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CResultsDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CResultsDlg)
|
||||
ON_BN_CLICKED(IDHELP, OnHelp)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CResultsDlg)
|
||||
ON_BN_CLICKED(IDHELP, OnHelp)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -59,38 +59,38 @@ END_MESSAGE_MAP()
|
||||
|
||||
BOOL CResultsDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetWindowText(m_strDlgTitle);
|
||||
m_ResultsLabel.SetWindowText(m_strResultsTitle);
|
||||
SetWindowText(m_strDlgTitle);
|
||||
m_ResultsLabel.SetWindowText(m_strResultsTitle);
|
||||
|
||||
ASSERT(m_Files.GetSize() == m_Results.GetSize());
|
||||
ASSERT(m_Files.GetSize() == m_Results.GetSize());
|
||||
|
||||
m_List.SetTabStops(118);
|
||||
m_List.SetTabStops(118);
|
||||
|
||||
for (int i = 0; i < m_Files.GetSize(); i++) {
|
||||
CString strItem = m_Files[i] + "\t" + m_Results[i];
|
||||
m_List.AddString(strItem);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
for (int i = 0; i < m_Files.GetSize(); i++) {
|
||||
CString strItem = m_Files[i] + "\t" + m_Results[i];
|
||||
m_List.AddString(strItem);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CResultsDlg::SetContents(const CString& strDlgTitle, const CString& strResultsTitle, const CStringArray& files, const CStringArray& results)
|
||||
{
|
||||
m_strDlgTitle = strDlgTitle;
|
||||
m_strResultsTitle = strResultsTitle;
|
||||
m_strDlgTitle = strDlgTitle;
|
||||
m_strResultsTitle = strResultsTitle;
|
||||
|
||||
m_Files.RemoveAll();
|
||||
m_Files.Copy(files);
|
||||
m_Files.RemoveAll();
|
||||
m_Files.Copy(files);
|
||||
|
||||
m_Results.RemoveAll();
|
||||
m_Results.Copy(results);
|
||||
m_Results.RemoveAll();
|
||||
m_Results.Copy(results);
|
||||
}
|
||||
|
||||
void CResultsDlg::OnHelp()
|
||||
{
|
||||
ShowHelp(m_hWnd, m_nHelpID);
|
||||
ShowHelp(m_hWnd, m_nHelpID);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,18 +32,18 @@ extern ULONG nXPRefCount; // IPersistFile ref count
|
||||
|
||||
class CShellExt : public CCmdTarget
|
||||
{
|
||||
DECLARE_DYNCREATE(CShellExt)
|
||||
DECLARE_DYNCREATE(CShellExt)
|
||||
|
||||
BOOL m_bDirSelected;
|
||||
BOOL m_bIsSymlink; // is symbolic link!
|
||||
TCHAR m_szFile[MAX_PATH];
|
||||
BOOL m_bIsOverlayEnabled;
|
||||
BOOL IsOverlayEnabled(){return m_bIsOverlayEnabled;}
|
||||
BOOL m_bDirSelected;
|
||||
BOOL m_bIsSymlink; // is symbolic link!
|
||||
TCHAR m_szFile[MAX_PATH];
|
||||
BOOL m_bIsOverlayEnabled;
|
||||
BOOL IsOverlayEnabled(){return m_bIsOverlayEnabled;}
|
||||
|
||||
CStringArray m_astrFileNames;
|
||||
|
||||
CShellExt(); // protected constructor used by dynamic creation
|
||||
LPMALLOC m_pAlloc;
|
||||
CShellExt(); // protected constructor used by dynamic creation
|
||||
LPMALLOC m_pAlloc;
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
@ -52,37 +52,37 @@ public:
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CShellExt)
|
||||
public:
|
||||
virtual void OnFinalRelease();
|
||||
//}}AFX_VIRTUAL
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CShellExt)
|
||||
public:
|
||||
virtual void OnFinalRelease();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual ~CShellExt();
|
||||
virtual ~CShellExt();
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CShellExt)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CShellExt)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Generated OLE dispatch map functions
|
||||
//{{AFX_DISPATCH(CShellExt)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_DISPATCH
|
||||
DECLARE_DISPATCH_MAP()
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Generated OLE dispatch map functions
|
||||
//{{AFX_DISPATCH(CShellExt)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_DISPATCH
|
||||
DECLARE_DISPATCH_MAP()
|
||||
|
||||
DECLARE_OLECREATE(CShellExt)
|
||||
DECLARE_OLECREATE(CShellExt)
|
||||
|
||||
// IFileViewer interface
|
||||
BEGIN_INTERFACE_PART(MenuExt, IContextMenu)
|
||||
STDMETHOD(QueryContextMenu)( HMENU hmenu,UINT indexMenu,UINT idCmdFirst,
|
||||
UINT idCmdLast,UINT uFlags);
|
||||
STDMETHOD(QueryContextMenu)( HMENU hmenu,UINT indexMenu,UINT idCmdFirst,
|
||||
UINT idCmdLast,UINT uFlags);
|
||||
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
|
||||
STDMETHOD(GetCommandString)(UINT_PTR idCmd,UINT uType,UINT* pwReserved,LPSTR pszName,
|
||||
UINT cchMax);
|
||||
UINT cchMax);
|
||||
END_INTERFACE_PART(MenuExt)
|
||||
|
||||
// IShellExtInit interface
|
||||
@ -96,21 +96,21 @@ protected:
|
||||
STDMETHOD(IsMemberOf)(LPCWSTR pwszPath,DWORD dwAttrib);
|
||||
END_INTERFACE_PART(IconExt)
|
||||
|
||||
BEGIN_INTERFACE_PART(ToolTipExt, IQueryInfo)
|
||||
STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR *ppwszTip);
|
||||
STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags);
|
||||
BEGIN_INTERFACE_PART(ToolTipExt, IQueryInfo)
|
||||
STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR *ppwszTip);
|
||||
STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags);
|
||||
END_INTERFACE_PART(ToolTipExt)
|
||||
|
||||
BEGIN_INTERFACE_PART(PersistFileExt, IPersistFile)
|
||||
STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode);
|
||||
STDMETHOD(GetClassID)(LPCLSID);
|
||||
STDMETHOD(IsDirty)(VOID);
|
||||
STDMETHOD(Save)(LPCOLESTR, BOOL);
|
||||
STDMETHOD(SaveCompleted)(LPCOLESTR);
|
||||
STDMETHOD(GetCurFile)(LPOLESTR FAR*);
|
||||
BEGIN_INTERFACE_PART(PersistFileExt, IPersistFile)
|
||||
STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode);
|
||||
STDMETHOD(GetClassID)(LPCLSID);
|
||||
STDMETHOD(IsDirty)(VOID);
|
||||
STDMETHOD(Save)(LPCOLESTR, BOOL);
|
||||
STDMETHOD(SaveCompleted)(LPCOLESTR);
|
||||
STDMETHOD(GetCurFile)(LPOLESTR FAR*);
|
||||
END_INTERFACE_PART(PersistFileExt)
|
||||
|
||||
DECLARE_INTERFACE_MAP()
|
||||
DECLARE_INTERFACE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user