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

CICMUserInterface Class Reference

#include <shellext.h>

List of all members.

Public Member Functions

 CICMUserInterface (UITYPE utThis)
 ~CICMUserInterface ()
STDMETHODIMP QueryInterface (REFIID, LPVOID FAR *)
 STDMETHODIMP_ (ULONG) AddRef()
 STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
STDMETHODIMP InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
STDMETHODIMP GetCommandString (UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved, LPSTR pszName, UINT cchMax)
STDMETHODIMP Initialize (LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID)
STDMETHODIMP GetIconLocation (UINT uFlags, LPTSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
STDMETHODIMP Extract (LPCTSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
STDMETHODIMP GetClassID (LPCLSID lpClassID)
STDMETHODIMP IsDirty ()
STDMETHODIMP Load (LPCOLESTR lpszFileName, DWORD grfMode)
STDMETHODIMP Save (LPCOLESTR lpszFileName, BOOL fRemember)
STDMETHODIMP SaveCompleted (LPCOLESTR lpszFileName)
STDMETHODIMP GetCurFile (LPOLESTR FAR *lplpszFileName)
STDMETHODIMP AddPages (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
STDMETHODIMP ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)

Private Member Functions

HRESULT AddPrinterTab (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
HRESULT AddAssociateTab (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
HRESULT AddProfileTab (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
HRESULT AddScannerTab (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
HRESULT AddMonitorTab (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)

Private Attributes

ULONG m_ulcReferences
LPDATAOBJECT m_lpdoTarget
CString m_csFile
TCHAR m_acWork [80]
UITYPE m_utThis
BOOL m_bInstalledContext
BOOL m_bMultiSelection


Constructor & Destructor Documentation

CICMUserInterface::CICMUserInterface UITYPE  utThis  ) 
 

Definition at line 307 of file shellext.cpp.

References CGlobals::Attach(), CICMUserInterface(), m_lpdoTarget, m_ulcReferences, m_utThis, and NULL.

Referenced by CICMUserInterface().

00307 { 00308 m_lpdoTarget = NULL; 00309 m_ulcReferences = 0; 00310 m_utThis = utThis; 00311 CGlobals::Attach(); 00312 _RPTF2(_CRT_WARN, "CICMUserInterface(%d) constructed @ %lX\n", utThis, this); 00313 }

CICMUserInterface::~CICMUserInterface  )  [inline]
 

Definition at line 131 of file shellext.h.

References CGlobals::Detach(), and m_lpdoTarget.

00131 { 00132 00133 if (m_lpdoTarget) 00134 m_lpdoTarget -> Release(); 00135 CGlobals::Detach(); 00136 }


Member Function Documentation

HRESULT CICMUserInterface::AddAssociateTab LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
[private]
 

Definition at line 772 of file shellext.cpp.

References AddAssociateTab(), FAR, Handle, m_lpdoTarget, NULL, and UINT.

Referenced by AddAssociateTab(), and AddPages().

00773 { 00774 00775 _RPTF0(_CRT_WARN, "CICMUserInterface::AddAssociateTab\n"); 00776 00777 // Load the profile(s) in the list. 00778 00779 FORMATETC fmte = {CF_HDROP, (DVTARGETDEVICE FAR *)NULL, 00780 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00781 STGMEDIUM stgm; 00782 HRESULT hres = m_lpdoTarget ? 00783 m_lpdoTarget -> GetData(&fmte, &stgm) : 0; 00784 00785 if (!SUCCEEDED(hres)) 00786 return NOERROR; // Why bother reporting a failure, here? 00787 00788 UINT ucFiles = stgm.hGlobal ? 00789 DragQueryFile((HDROP) stgm.hGlobal, 0xFFFFFFFFL , 0, 0) : 0; 00790 00791 if (ucFiles != 1) 00792 return NOERROR; 00793 00794 TCHAR acFile[_MAX_PATH]; 00795 00796 DragQueryFile((HDROP) stgm.hGlobal, 0, acFile, 00797 sizeof acFile/ sizeof acFile[0]); 00798 00799 // Create the property sheet- it will get deleted if it is not in 00800 // use when the shell tries to unload the extension 00801 00802 CProfileAssociationPage *pcpap = 00803 new CProfileAssociationPage(CGlobals::Instance(), acFile); 00804 00805 if (!(*lpfnAddPage)(pcpap -> Handle(), lParam)) 00806 DestroyPropertySheetPage(pcpap -> Handle()); 00807 00808 return NOERROR; 00809 }

HRESULT CICMUserInterface::AddMonitorTab LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
[private]
 

Definition at line 816 of file shellext.cpp.

References AddMonitorTab(), CMonitorList::Count(), CMonitorList::DeviceName(), EnumDisplayDevices(), CMonitorList::Enumerate(), FAR, Handle, m_lpdoTarget, and NULL.

Referenced by AddMonitorTab(), and AddPages().

00817 { 00818 00819 // Create the property sheet- it will get deleted if it is not in 00820 // use when the shell tries to unload the extension 00821 00822 CString csMonitorDevice; 00823 CString csMonitorFriendlyName; 00824 00825 if (m_lpdoTarget) { 00826 00827 FORMATETC fmte = { (CLIPFORMAT)RegisterClipboardFormat(_TEXT("Display Device")), 00828 (DVTARGETDEVICE FAR *) NULL, 00829 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00830 STGMEDIUM stgm; 00831 00832 // Get device name from IDataObject. 00833 00834 HRESULT hres = m_lpdoTarget -> GetData(&fmte, &stgm); 00835 00836 if (!SUCCEEDED(hres) || !stgm.hGlobal) { 00837 return NOERROR; // Why bother reporting a failure, here? 00838 } 00839 00840 // The storage contains Display device path (\\.\DisplayX) in UNICODE. 00841 00842 LPCWSTR lpDeviceName = (LPCWSTR) GlobalLock(stgm.hGlobal); 00843 CString csMonitorDevicePath = lpDeviceName; 00844 GlobalUnlock(stgm.hGlobal); 00845 00846 // Query the device id, friendly name and other on the display device. 00847 00848 DISPLAY_DEVICE ddPriv; 00849 00850 ddPriv.cb = sizeof(ddPriv); 00851 00852 if (!EnumDisplayDevices((LPCTSTR)csMonitorDevicePath, 0, &ddPriv, 0)) 00853 { 00854 return NOERROR; // Why bother reporting a failure, here? 00855 } 00856 00857 #if HIDEYUKN_DBG 00858 MessageBox(NULL,csMonitorDevicePath,TEXT(""),MB_OK); 00859 MessageBox(NULL,(LPCTSTR)ddPriv.DeviceID,TEXT(""),MB_OK); 00860 MessageBox(NULL,(LPCTSTR)ddPriv.DeviceString,TEXT(""),MB_OK); 00861 #endif 00862 00863 // Use deviceId (PnP Id) as device name, and set friendly name 00864 00865 csMonitorDevice = (LPTSTR)(ddPriv.DeviceID); 00866 csMonitorFriendlyName = (LPTSTR)(ddPriv.DeviceString); 00867 } 00868 else 00869 { 00870 // if we don't have IDataObject, enumerate monitor, 00871 // then use 1st entry. 00872 00873 CMonitorList cml; 00874 cml.Enumerate(); 00875 _ASSERTE(cml.Count()); // At least, we should have one Monitor. 00876 csMonitorDevice = csMonitorFriendlyName = cml.DeviceName(0); 00877 } 00878 00879 CMonitorProfileManagement *pcmpm = 00880 new CMonitorProfileManagement(csMonitorDevice, 00881 csMonitorFriendlyName, 00882 CGlobals::Instance()); 00883 00884 00885 if (!(*lpfnAddPage)(pcmpm -> Handle(), lParam)) 00886 DestroyPropertySheetPage(pcmpm -> Handle()); 00887 00888 return NOERROR; 00889 }

STDMETHODIMP CICMUserInterface::AddPages LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
 

Definition at line 693 of file shellext.cpp.

References AddAssociateTab(), AddMonitorTab(), AddPages(), AddPrinterTab(), AddProfileTab(), AddScannerTab(), IsMonitor, IsPrinter, IsProfile, IsScanner, and m_utThis.

Referenced by AddPages().

00694 { 00695 _RPTF0(_CRT_WARN, "CICMUserInterface::AddPages\n"); 00696 00697 HRESULT hResult = NOERROR; 00698 00699 switch (m_utThis) { 00700 case IsProfile: { 00701 hResult = AddProfileTab(lpfnAddPage, lParam); 00702 if (hResult == NOERROR) { 00703 hResult = AddAssociateTab(lpfnAddPage, lParam); 00704 } 00705 break; 00706 } 00707 00708 case IsMonitor: { 00709 hResult = AddMonitorTab(lpfnAddPage, lParam); 00710 break; 00711 } 00712 00713 case IsPrinter: { 00714 hResult = AddPrinterTab(lpfnAddPage, lParam); 00715 break; 00716 } 00717 00718 case IsScanner: { 00719 hResult = AddScannerTab(lpfnAddPage, lParam); 00720 break; 00721 } 00722 } 00723 00724 return hResult; 00725 }

HRESULT CICMUserInterface::AddPrinterTab LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
[private]
 

Definition at line 1028 of file shellext.cpp.

References AddPrinterTab(), FAR, Handle, m_lpdoTarget, NULL, and RetrievePrinterName().

Referenced by AddPages(), and AddPrinterTab().

01029 { 01030 01031 // The list is formatted as a Shell IDList Array 01032 01033 FORMATETC fmte = { (CLIPFORMAT)RegisterClipboardFormat(_TEXT("Shell IDList Array")), 01034 (DVTARGETDEVICE FAR *) NULL, 01035 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 01036 STGMEDIUM stgm; 01037 HRESULT hres = m_lpdoTarget ? 01038 m_lpdoTarget -> GetData(&fmte, &stgm) : 0; 01039 01040 if (!SUCCEEDED(hres) || !stgm.hGlobal) 01041 return NOERROR; // Why bother reporting a failure, here? 01042 01043 CString csPrinter; 01044 01045 RetrievePrinterName((LPIDA) stgm.hGlobal, csPrinter); 01046 01047 #if HIDEYUKN_DBG 01048 MessageBox(NULL,csPrinter,TEXT(""),MB_OK); 01049 #endif 01050 01051 // If this is not a color printer, forget it... 01052 01053 01054 if (!CGlobals::ThisIsAColorPrinter(csPrinter)) 01055 return NOERROR; 01056 01057 // Create the property sheet- it will get deleted if it is not in use when 01058 // the shell tries to unload the extension 01059 01060 01061 CPrinterProfileManagement *pcppm = 01062 new CPrinterProfileManagement(csPrinter, CGlobals::Instance()); 01063 01064 if (!pcppm) 01065 return E_OUTOFMEMORY; 01066 01067 if (!(*lpfnAddPage)(pcppm -> Handle(), lParam)) 01068 DestroyPropertySheetPage(pcppm -> Handle()); 01069 01070 return NOERROR; 01071 }

HRESULT CICMUserInterface::AddProfileTab LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
[private]
 

Definition at line 731 of file shellext.cpp.

References AddProfileTab(), FAR, Handle, m_lpdoTarget, NULL, and UINT.

Referenced by AddPages(), and AddProfileTab().

00732 { 00733 _RPTF0(_CRT_WARN, "CICMUserInterface::AddProfileTab\n"); 00734 00735 // Load the profile(s) in the list. 00736 00737 FORMATETC fmte = {CF_HDROP, (DVTARGETDEVICE FAR *)NULL, 00738 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00739 STGMEDIUM stgm; 00740 HRESULT hres = m_lpdoTarget ? 00741 m_lpdoTarget -> GetData(&fmte, &stgm) : 0; 00742 00743 00744 if (!SUCCEEDED(hres)) 00745 return NOERROR; // Why bother reporting a failure, here? 00746 00747 UINT ucFiles = stgm.hGlobal ? 00748 DragQueryFile((HDROP) stgm.hGlobal, 0xFFFFFFFFL , 0, 0) : 0; 00749 00750 if (ucFiles != 1) 00751 return NOERROR; 00752 00753 TCHAR acFile[_MAX_PATH]; 00754 00755 DragQueryFile((HDROP) stgm.hGlobal, 0, acFile, 00756 sizeof acFile/ sizeof acFile[0]); 00757 00758 // Create the property sheet- it will get deleted if it is not in 00759 // use when the shell tries to unload the extension 00760 00761 CProfileInformationPage *pcpip = 00762 new CProfileInformationPage(CGlobals::Instance(), acFile); 00763 00764 if (!(*lpfnAddPage)(pcpip -> Handle(), lParam)) 00765 DestroyPropertySheetPage(pcpip -> Handle()); 00766 00767 return NOERROR; 00768 }

HRESULT CICMUserInterface::AddScannerTab LPFNADDPROPSHEETPAGE  lpfnAddPage,
LPARAM  lParam
[private]
 

Definition at line 893 of file shellext.cpp.

References AddScannerTab(), CScannerList::Count(), CScannerList::DeviceName(), CScannerList::Enumerate(), FAR, Handle, m_lpdoTarget, and NULL.

Referenced by AddPages(), and AddScannerTab().

00894 { 00895 00896 // Create the property sheet- it will get deleted if it is not in 00897 // use when the shell tries to unload the extension 00898 00899 CString csScannerDevice; 00900 00901 if (m_lpdoTarget) { 00902 FORMATETC fmte = { (CLIPFORMAT)RegisterClipboardFormat(_TEXT("STIDeviceName")), 00903 (DVTARGETDEVICE FAR *) NULL, 00904 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00905 STGMEDIUM stgm; 00906 00907 // Get device name from IDataObject. 00908 00909 HRESULT hres = m_lpdoTarget -> GetData(&fmte, &stgm); 00910 00911 if (!SUCCEEDED(hres) || !stgm.hGlobal) { 00912 return NOERROR; // Why bother reporting a failure, here? 00913 } 00914 00915 // The storage contains Scanner in UNICODE string. 00916 00917 LPCWSTR lpDeviceName = (LPCWSTR) GlobalLock(stgm.hGlobal); 00918 csScannerDevice = lpDeviceName; 00919 GlobalUnlock(stgm.hGlobal); 00920 00921 #if HIDEYUKN_DBG 00922 MessageBox(NULL,csScannerDevice,TEXT(""),MB_OK); 00923 #endif 00924 00925 } else { 00926 00927 // if we don't have IDataObject, enumerate monitor, 00928 // then use 1st entry. 00929 00930 CScannerList csl; 00931 csl.Enumerate(); 00932 _ASSERTE(csl.Count()); 00933 csScannerDevice = csl.DeviceName(0); 00934 } 00935 00936 CScannerProfileManagement *pcspm = 00937 new CScannerProfileManagement(csScannerDevice, CGlobals::Instance()); 00938 00939 if (!(*lpfnAddPage)(pcspm -> Handle(), lParam)) 00940 DestroyPropertySheetPage(pcspm -> Handle()); 00941 00942 return NOERROR; 00943 }

STDMETHODIMP CICMUserInterface::Extract LPCTSTR  pszFile,
UINT  nIconIndex,
HICON *  phiconLarge,
HICON *  phiconSmall,
UINT  nIconSize
 

Definition at line 400 of file shellext.cpp.

References DefaultIcon, Extract(), m_csFile, and UninstalledIcon.

Referenced by Extract().

00402 { 00403 00404 *phiconSmall = *phiconLarge = LoadIcon(CGlobals::Instance(), 00405 MAKEINTRESOURCE(CGlobals::IsInstalled(m_csFile) ? DefaultIcon : UninstalledIcon)); 00406 00407 return NOERROR; 00408 }

STDMETHODIMP CICMUserInterface::GetClassID LPCLSID  lpClassID  )  [inline]
 

Definition at line 177 of file shellext.h.

References GetClassID().

Referenced by GetClassID().

00177 { return E_FAIL; }

STDMETHODIMP CICMUserInterface::GetCommandString UINT_PTR  idCmd,
UINT  uFlags,
UINT FAR *  reserved,
LPSTR  pszName,
UINT  cchMax
 

Definition at line 661 of file shellext.cpp.

References AssociateContextMenuString, GetCommandString(), InstallMultiProfileContextMenuString, InstallProfileContextMenuString, CString::Load(), m_bInstalledContext, m_bMultiSelection, UninstallMultiProfileContextMenuString, and UninstallProfileContextMenuString.

Referenced by GetCommandString().

00663 { 00664 CString csReturnString; 00665 00666 switch (idCmd) { 00667 case 0: { // Install/Uninstall was selected. 00668 if(m_bMultiSelection) { 00669 csReturnString.Load(m_bInstalledContext ? UninstallMultiProfileContextMenuString : InstallMultiProfileContextMenuString); 00670 } else { 00671 csReturnString.Load(m_bInstalledContext ? UninstallProfileContextMenuString : InstallProfileContextMenuString); 00672 } 00673 lstrcpyn((LPTSTR)pszName, csReturnString, cchMax); 00674 break; 00675 } 00676 00677 case 1: { // Associate... was seleted. 00678 if (!m_bMultiSelection) { 00679 csReturnString.Load(AssociateContextMenuString); 00680 lstrcpyn((LPTSTR)pszName, csReturnString, cchMax); 00681 } 00682 break; 00683 } 00684 } 00685 00686 return NOERROR; 00687 }

STDMETHODIMP CICMUserInterface::GetCurFile LPOLESTR FAR *  lplpszFileName  )  [inline]
 

Definition at line 189 of file shellext.h.

References GetCurFile().

Referenced by GetCurFile().

00189 { 00190 return E_FAIL; 00191 }

STDMETHODIMP CICMUserInterface::GetIconLocation UINT  uFlags,
LPTSTR  szIconFile,
UINT  cchMax,
int *  piIndex,
UINT *  pwFlags
 

Definition at line 388 of file shellext.cpp.

References GetIconLocation(), and UINT.

Referenced by GetIconLocation().

00392 { 00393 00394 *puFlags = (GIL_NOTFILENAME|GIL_DONTCACHE); // Make shell call our Extract function 00395 // And don't cache in the callee. 00396 00397 return S_FALSE; 00398 }

STDMETHODIMP CICMUserInterface::Initialize LPCITEMIDLIST  pIDFolder,
LPDATAOBJECT  pDataObj,
HKEY  hKeyID
 

Definition at line 363 of file shellext.cpp.

References Initialize(), m_lpdoTarget, and NULL.

Referenced by Initialize().

00365 { 00366 00367 _RPTF0(_CRT_WARN, "CICMUserInterface::Initialize\n"); 00368 00369 // The target data object is an HDROP, or list of files from the shell. 00370 00371 if (m_lpdoTarget) { 00372 m_lpdoTarget -> Release(); 00373 m_lpdoTarget = NULL; 00374 } 00375 00376 if (pdoTarget) { 00377 m_lpdoTarget = pdoTarget; 00378 m_lpdoTarget -> AddRef(); 00379 } 00380 00381 return NOERROR; 00382 }

STDMETHODIMP CICMUserInterface::InvokeCommand LPCMINVOKECOMMANDINFO  lpcmi  ) 
 

Definition at line 532 of file shellext.cpp.

References FALSE, FAR, CProfile::GetName(), CPropertyPage::Handle(), CProfile::Install(), CGlobals::Instance(), InvokeCommand(), CProfile::IsInstalled(), m_bInstalledContext, m_lpdoTarget, NULL, SetCursor, UINT, and CProfile::Uninstall().

Referenced by InvokeCommand().

00532 { 00533 00534 // If HIWORD(lpcmi->lpVerb) then we have been called programmatically and 00535 // lpVerb us a command that should be invoked. Otherwise, the shell has 00536 // called us, abd LOWORD(lpcmi->lpVerb) is the menu ID the user has selected. 00537 // Actually, it's (menu ID - icmdFirst) from QueryContextMenu(). 00538 00539 if (!HIWORD((ULONG)(ULONG_PTR)lpcmi->lpVerb)) { 00540 00541 FORMATETC fmte = {CF_HDROP, (DVTARGETDEVICE FAR *)NULL, 00542 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00543 STGMEDIUM stgm; 00544 HRESULT hres = m_lpdoTarget ? 00545 m_lpdoTarget -> GetData(&fmte, &stgm) : 0; 00546 00547 if (!SUCCEEDED(hres)) 00548 return NOERROR; // Why bother reporting a failure, here? 00549 00550 UINT ucFiles = stgm.hGlobal ? 00551 DragQueryFile((HDROP) stgm.hGlobal, 0xFFFFFFFFL , 0, 0) : 0; 00552 00553 if (!ucFiles) 00554 return NOERROR; // Shouldn't happen, but it's not important 00555 00556 UINT idCmd = LOWORD(lpcmi->lpVerb); 00557 00558 // Walk through every selected item to install/uninstall. 00559 00560 for (UINT u = 0; u < ucFiles; u++) { 00561 00562 TCHAR acFile[_MAX_PATH]; 00563 00564 DragQueryFile((HDROP) stgm.hGlobal, u, acFile, 00565 sizeof acFile/ sizeof acFile[0]); 00566 00567 switch (idCmd) { 00568 00569 case 0: { // Install/Uninstall was selected. 00570 00571 // during the installation or un-installation, 00572 // change the cursor icon to IDC_APPSTARTING. 00573 00574 HCURSOR hCursorOld = SetCursor(LoadCursor(NULL,IDC_APPSTARTING)); 00575 00576 CProfile csProfile(acFile); 00577 00578 if (m_bInstalledContext) { 00579 00580 // All selected profile is already installed, then 00581 // Uninstall every profile(s) are selected if installed. 00582 00583 if (csProfile.IsInstalled()) { 00584 csProfile.Uninstall(FALSE); // never delete file from disk. 00585 } 00586 } 00587 else { 00588 00589 // Some of selected profile is not installed, then 00590 // Install every profile(s) are selected if not installed, yet. 00591 00592 if (!csProfile.IsInstalled()) { 00593 csProfile.Install(); 00594 } 00595 } 00596 00597 SetCursor(hCursorOld); 00598 00599 break; 00600 } 00601 00602 case 1: { // "Associate..." was selected. 00603 00604 CString csProfileName; 00605 00606 // Get profile "friendly" name. 00607 { 00608 CProfile csProfile(acFile); 00609 csProfileName = csProfile.GetName(); 00610 } // de-constructer for csProfile should be here. 00611 00612 // Create PropertySheet with "Profile Information" and 00613 // "Associate Device" pages 00614 00615 PROPSHEETHEADER psh; 00616 HPROPSHEETPAGE hpsp[2]; 00617 00618 CProfileInformationPage *pcpip = 00619 new CProfileInformationPage(CGlobals::Instance(), acFile); 00620 CProfileAssociationPage *pcpap = 00621 new CProfileAssociationPage(CGlobals::Instance(), acFile); 00622 if( (pcpip!=NULL)&&(pcpap!=NULL) ) { 00623 hpsp[0] = pcpip->Handle(); 00624 hpsp[1] = pcpap->Handle(); 00625 00626 ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); 00627 00628 // fill the property sheet structure. 00629 00630 psh.dwSize = sizeof(PROPSHEETHEADER); 00631 psh.hInstance = CGlobals::Instance(); 00632 psh.hwndParent = NULL; 00633 psh.nStartPage = 1; // Active "Associate Device" page. 00634 psh.nPages = 2; 00635 psh.phpage = hpsp; 00636 psh.pszCaption = csProfileName; 00637 00638 PropertySheet(&psh); 00639 00640 delete pcpip; delete pcpap; 00641 break; 00642 } else { 00643 if(pcpip) delete pcpip; 00644 if(pcpap) delete pcpap; 00645 return E_OUTOFMEMORY; 00646 } 00647 } 00648 } // switch (idCmd) 00649 } // for (UINT u = 0; u < ucFiles; u++) 00650 } // if (!HIWORD(lpcmi->lpVerb)) 00651 00652 return NOERROR; 00653 }

STDMETHODIMP CICMUserInterface::IsDirty  )  [inline]
 

Definition at line 179 of file shellext.h.

00179 { return S_FALSE; }

STDMETHODIMP CICMUserInterface::Load LPCOLESTR  lpszFileName,
DWORD  grfMode
 

Definition at line 412 of file shellext.cpp.

References CString::IsEmpty(), Load(), and m_csFile.

Referenced by Load().

00413 { 00414 // This interface is used to initialize the icon handler- it will 00415 // receive the profile name, which we will save for later use. 00416 // The CString assigment operator handles any encoding converions needed 00417 // encoding conversions for us. 00418 00419 m_csFile = lpwstrFileName; 00420 00421 return m_csFile.IsEmpty() ? E_OUTOFMEMORY : NO_ERROR; 00422 }

STDMETHODIMP CICMUserInterface::QueryContextMenu HMENU  hMenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags
 

Definition at line 426 of file shellext.cpp.

References AssociateMenuString, FALSE, FAR, InstallProfileMenuString, CString::Load(), m_bInstalledContext, m_bMultiSelection, m_lpdoTarget, NULL, QueryContextMenu(), TRUE, UINT, and UninstallProfileMenuString.

Referenced by QueryContextMenu().

00428 { 00429 00430 // Only CMF_NORMAL and CMF_EXPLORE case will be handled. 00431 // 00432 // CMF_CANRENAME - This flag is set if the calling application supports 00433 // renaming of items. A context menu extension or drag-and-drop 00434 // handler should ignore this flag. A namespace extension should 00435 // add a rename item to the menu if applicable. 00436 // CMF_DEFAULTONLY - This flag is set when the user is activating the default action, 00437 // typically by double-clicking. This flag provides a hint for the 00438 // context menu extension to add nothing if it does not modify the 00439 // default item in the menu. A context menu extension or drag-and-drop 00440 // handler should not add any menu items if this value is specified. 00441 // A namespace extension should add only the default item (if any). 00442 // CMF_EXPLORE - This flag is set when Windows Explorer's tree window is present. 00443 // Context menu handlers should ignore this value. 00444 // CMF_INCLUDESTATIC - This flag is set when a static menu is being constructed. 00445 // Only the browser should use this flag. All other context menu 00446 // extensions should ignore this flag. 00447 // CMF_NODEFAULT - This flag is set if no item in the menu should be the default item. 00448 // A context menu extension or drag-and-drop handler should ignore this 00449 // flag. A namespace extension should not set any of the menu items to 00450 // the default. 00451 // CMF_NORMAL - Indicates normal operation. A context menu extension, namespace extension, 00452 // or drag-and-drop handler can add all menu items. 00453 // CMF_NOVERBS - This flag is set for items displayed in the "Send To:" menu. 00454 // Context menu handlers should ignore this value. 00455 // CMF_VERBSONLY - This flag is set if the context menu is for a shortcut object. 00456 // Context menu handlers should ignore this value. 00457 00458 if (((uFlags & 0x000F) == CMF_NORMAL) || (uFlags & CMF_EXPLORE)) 00459 { 00460 // 00461 // Load the profile(s) in the list. 00462 // 00463 FORMATETC fmte = {CF_HDROP, (DVTARGETDEVICE FAR *)NULL, 00464 DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 00465 STGMEDIUM stgm; 00466 HRESULT hres = m_lpdoTarget ? 00467 m_lpdoTarget -> GetData(&fmte, &stgm) : 0; 00468 00469 if (!SUCCEEDED(hres)) 00470 return NOERROR; // Why bother reporting a failure, here? 00471 00472 UINT ucFiles = stgm.hGlobal ? 00473 DragQueryFile((HDROP) stgm.hGlobal, 0xFFFFFFFFL , 0, 0) : 0; 00474 00475 if (!ucFiles) 00476 return NOERROR; // Shouldn't happen, but it's not important 00477 else if (ucFiles == 1) 00478 m_bMultiSelection = FALSE; 00479 else 00480 m_bMultiSelection = TRUE; 00481 00482 // Assume in installed context, but we will scan the selected item 00483 // is really installed everything. 00484 00485 m_bInstalledContext = TRUE; 00486 00487 TCHAR acFile[_MAX_PATH]; 00488 00489 for (UINT u = 0; u < ucFiles; u++) { 00490 00491 DragQueryFile((HDROP) stgm.hGlobal, u, acFile, 00492 sizeof acFile/ sizeof acFile[0]); 00493 00494 CString csFile = acFile; 00495 00496 m_bInstalledContext = (m_bInstalledContext && CGlobals::IsInstalled(csFile)); 00497 } 00498 00499 UINT idCmd = idCmdFirst; 00500 00501 CString csInstallMenu, csAssociateMenu; 00502 00503 // If every profile(s) are already installed on this system, 00504 // display "Uninstall Profile", otherwise display "Install Profile" 00505 00506 csInstallMenu.Load(m_bInstalledContext ? UninstallProfileMenuString : InstallProfileMenuString); 00507 ::InsertMenu(hMenu,indexMenu,MF_STRING|MF_BYPOSITION,idCmd,csInstallMenu); 00508 00509 // Set "Install Profile" or "Uninstall Profile" as default. 00510 00511 SetMenuDefaultItem(hMenu,indexMenu,TRUE); 00512 00513 // Increment Menu pos. and item id. 00514 00515 indexMenu++; idCmd++; 00516 00517 // Add "Associate..." menu item 00518 00519 csAssociateMenu.Load(AssociateMenuString); 00520 ::InsertMenu(hMenu,indexMenu++,MF_STRING|MF_BYPOSITION,idCmd++,csAssociateMenu); 00521 00522 // But if we have multi selection, disable "Associate..." 00523 00524 if (m_bMultiSelection) 00525 ::EnableMenuItem(hMenu,(idCmd-1),MF_GRAYED); 00526 return (idCmd - idCmdFirst); // return number of menu inserted. 00527 } 00528 00529 return NOERROR; 00530 }

STDMETHODIMP CICMUserInterface::QueryInterface REFIID  ,
LPVOID FAR * 
 

STDMETHODIMP CICMUserInterface::ReplacePage UINT  uPageID,
LPFNADDPROPSHEETPAGE  lpfnReplaceWith,
LPARAM  lParam
[inline]
 

Definition at line 196 of file shellext.h.

References ReplacePage().

Referenced by ReplacePage().

00198 { return E_FAIL; }

STDMETHODIMP CICMUserInterface::Save LPCOLESTR  lpszFileName,
BOOL  fRemember
[inline]
 

Definition at line 183 of file shellext.h.

References Save().

Referenced by Save().

00183 { 00184 return E_FAIL; 00185 }

STDMETHODIMP CICMUserInterface::SaveCompleted LPCOLESTR  lpszFileName  )  [inline]
 

Definition at line 187 of file shellext.h.

References SaveCompleted().

Referenced by SaveCompleted().

00187 { return E_FAIL; }

CICMUserInterface::STDMETHODIMP_ ULONG   )  [inline]
 

Definition at line 141 of file shellext.h.

References L, m_ulcReferences, and STDMETHODIMP_().

00141 { 00142 if (--m_ulcReferences) 00143 return m_ulcReferences; 00144 00145 delete this; 00146 return 0L; 00147 }

CICMUserInterface::STDMETHODIMP_ ULONG   )  [inline]
 

Definition at line 140 of file shellext.h.

References m_ulcReferences, and STDMETHODIMP_().

Referenced by STDMETHODIMP_().

00140 { return ++m_ulcReferences; }


Member Data Documentation

TCHAR CICMUserInterface::m_acWork[80] [private]
 

Definition at line 108 of file shellext.h.

BOOL CICMUserInterface::m_bInstalledContext [private]
 

Definition at line 110 of file shellext.h.

Referenced by GetCommandString(), InvokeCommand(), and QueryContextMenu().

BOOL CICMUserInterface::m_bMultiSelection [private]
 

Definition at line 110 of file shellext.h.

Referenced by GetCommandString(), and QueryContextMenu().

CString CICMUserInterface::m_csFile [private]
 

Definition at line 106 of file shellext.h.

Referenced by Extract(), and Load().

LPDATAOBJECT CICMUserInterface::m_lpdoTarget [private]
 

Definition at line 105 of file shellext.h.

Referenced by AddAssociateTab(), AddMonitorTab(), AddPrinterTab(), AddProfileTab(), AddScannerTab(), CICMUserInterface(), Initialize(), InvokeCommand(), QueryContextMenu(), and ~CICMUserInterface().

ULONG CICMUserInterface::m_ulcReferences [private]
 

Definition at line 104 of file shellext.h.

Referenced by CICMUserInterface(), and STDMETHODIMP_().

UITYPE CICMUserInterface::m_utThis [private]
 

Definition at line 109 of file shellext.h.

Referenced by AddPages(), and CICMUserInterface().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:27 2004 for test by doxygen 1.3.7