Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

shellext.cpp File Reference

#include "ICMUI.H"
#include <shlobj.h>
#include <string.h>
#include <initguid.h>
#include "ShellExt.H"
#include "Resource.H"

Go to the source code of this file.

Functions

STDAPI DllCanUnloadNow ()
STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, void **ppvOut)
int APIENTRY DllMain (HMODULE hmThis, DWORD dwReason, LPVOID lpvReserved)
void RetrievePrinterName (LPIDA lpida, CString &csTarget)
PSTR GetFilenameFromPath (PSTR pPathName)


Function Documentation

STDAPI DllCanUnloadNow  ) 
 

Definition at line 166 of file shellext.cpp.

References CGlobals::CanUnload().

00166 { 00167 return CGlobals::CanUnload(); 00168 }

STDAPI DllGetClassObject REFCLSID  rclsid,
REFIID  riid,
void **  ppvOut
 

Definition at line 170 of file shellext.cpp.

00170 { 00171 return CIcmUiFactory::KeyToTheFactory(rclsid, riid, ppvOut); 00172 }

int APIENTRY DllMain HMODULE  hmThis,
DWORD  dwReason,
LPVOID  lpvReserved
 

Definition at line 174 of file shellext.cpp.

References APIENTRY, INVALID_HANDLE_VALUE, and NULL.

00175 { 00176 #if defined(DEBUG) || defined(_DEBUG) 00177 static HANDLE hfWarnings; // Log file 00178 #endif 00179 switch (dwReason) { 00180 00181 case DLL_PROCESS_ATTACH: 00182 00183 // Save the handle 00184 CGlobals::SetHandle(hmThis); 00185 #if defined(DEBUG) || defined(_DEBUG) 00186 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_WNDW); 00187 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); 00188 hfWarnings = CreateFileA("C:\\ICMUIWarn.Txt", GENERIC_WRITE, 0, 00189 NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 00190 00191 if (hfWarnings!= INVALID_HANDLE_VALUE) { 00192 SetFilePointer(hfWarnings, 0, NULL, FILE_END); 00193 _CrtSetReportFile(_CRT_WARN, hfWarnings); 00194 } 00195 _RPTF1(_CRT_WARN, "ICMUI DLL being loaded- handle %X\n", hmThis); 00196 break; 00197 00198 case DLL_PROCESS_DETACH: 00199 _RPTF0(_CRT_WARN, "ICMUI DLL being unloaded\n"); 00200 00201 if (hfWarnings != INVALID_HANDLE_VALUE) 00202 CloseHandle(hfWarnings); 00203 #endif 00204 } 00205 00206 return 1; 00207 }

PSTR GetFilenameFromPath PSTR  pPathName  ) 
 

Definition at line 1074 of file shellext.cpp.

References DWORD, and NULL.

01077 { 01078 DWORD dwLen; // length of pathname 01079 01080 dwLen = lstrlenA(pPathName); 01081 01082 // 01083 // Go to the end of the pathname, and start going backwards till 01084 // you reach the beginning or a backslash 01085 // 01086 01087 pPathName += dwLen; 01088 01089 while (dwLen-- && --pPathName) 01090 { 01091 if (*pPathName == '\\') 01092 { 01093 pPathName++; 01094 break; 01095 } 01096 } 01097 01098 // 01099 // if *pPathName is zero, then we had a string that ends in a backslash 01100 // 01101 01102 return *pPathName ? pPathName : NULL; 01103 }

void RetrievePrinterName LPIDA  lpida,
CString csTarget
[static]
 

Definition at line 949 of file shellext.cpp.

References NULL.

Referenced by CICMUserInterface::AddPrinterTab().

00949 { 00950 00951 // Extract the container (Printers Folder) and target (Printer) 00952 // IDs from the array. 00953 00954 LPCITEMIDLIST pciilContainer = 00955 (LPCITEMIDLIST)((LPBYTE) lpida + lpida -> aoffset[0]); 00956 00957 LPCITEMIDLIST pciilTarget = 00958 (LPCITEMIDLIST)((LPBYTE) lpida + lpida -> aoffset[1]); 00959 00960 if (!pciilContainer || !pciilTarget) 00961 return; 00962 00963 // Get a pointer to the printers folder. 00964 00965 LPSHELLFOLDER psfDesktop, psfPrinterFolder; 00966 00967 if (FAILED(SHGetDesktopFolder(&psfDesktop))) 00968 return; 00969 00970 if (FAILED(psfDesktop -> BindToObject(pciilContainer, NULL, 00971 IID_IShellFolder, (void **) &psfPrinterFolder))) { 00972 psfDesktop -> Release(); 00973 return; 00974 } 00975 00976 // Retrieve the printer's display name 00977 00978 STRRET strret; 00979 00980 if (FAILED(psfPrinterFolder -> 00981 GetDisplayNameOf(pciilTarget, SHGDN_FORPARSING, &strret))) { 00982 psfPrinterFolder -> Release(); 00983 psfDesktop -> Release(); 00984 return; 00985 } 00986 00987 // Copy the display name- the CString class now handles any encoding 00988 // issues 00989 00990 switch (strret.uType) { 00991 00992 case STRRET_WSTR: 00993 00994 // This is a Unicode string which was IMalloc'd 00995 00996 csTarget = strret.pOleStr; 00997 00998 IMalloc *pim; 00999 01000 if (SUCCEEDED(CoGetMalloc(1, &pim))) { 01001 pim -> Free(strret.pOleStr); 01002 pim -> Release(); 01003 } 01004 01005 break; 01006 01007 case STRRET_CSTR: 01008 01009 // This is an ANSI string in the buffer 01010 01011 csTarget = strret.cStr; 01012 break; 01013 01014 case STRRET_OFFSET: 01015 01016 // This is an ANSI string at the given offset into the SHITEMID 01017 // which pciilTarget points to. 01018 01019 csTarget = (LPCSTR) pciilTarget + strret.uOffset; 01020 01021 } 01022 psfPrinterFolder -> Release(); 01023 psfDesktop -> Release(); 01024 }


Generated on Sat May 15 19:45:39 2004 for test by doxygen 1.3.7