home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / mmc / samplemmchelper.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  1.9 KB  |  48 lines

  1. #include "SampleMMCHelper.h"
  2.  
  3. // The following functions are located in MMC.lib. Since functions located in .lib files are 
  4. // inaccessable to C#, we need to provide wrappers for them
  5. SAMPLEMMCHELPER_API HRESULT callMMCPropertyChangeNotify(long INotifyHandle,  LPARAM param)
  6. {
  7.     return MMCPropertyChangeNotify(INotifyHandle, param);
  8. }// callMMCPropertyChangeNotify
  9.  
  10. SAMPLEMMCHELPER_API HRESULT callMMCFreeNotifyHandle(long lNotifyHandle)
  11. {
  12.     return MMCFreeNotifyHandle(lNotifyHandle);
  13. }// callMMCFreeNotifyHandle
  14.  
  15. //-------------------------------------------------------------------------
  16. // RegisterPropertyPage
  17. //
  18. // The runtime currently does not support the marshalling of delegates in structures. 
  19. // Therefore, we need to provide a wrapper that will register our property pages for us
  20. //-------------------------------------------------------------------------
  21. SAMPLEMMCHELPER_API int RegisterPropertyPage(void *dlgProc, void *propProc, PROPSHEETPAGE *incoming)
  22. {
  23.  
  24.     PROPSHEETPAGE    ppsg;
  25.  
  26.     ppsg.dwSize            = sizeof(ppsg); 
  27.     ppsg.dwFlags        = incoming->dwFlags; 
  28.     ppsg.hInstance        = incoming->hInstance; 
  29.     ppsg.pszTemplate    = incoming->pszTemplate; 
  30.     ppsg.pResource        = incoming->pResource; 
  31.     ppsg.hIcon            = incoming->hIcon; 
  32.     ppsg.pszIcon        = incoming->pszIcon; 
  33.     ppsg.pszTitle        = incoming->pszTitle; 
  34.     ppsg.lParam            = incoming->lParam; 
  35.     ppsg.pcRefParent    = incoming->pcRefParent; 
  36.     ppsg.pszHeaderTitle = incoming->pszHeaderTitle;
  37.     ppsg.pszHeaderSubTitle = incoming->pszHeaderSubTitle;
  38.     
  39.     // Assign the function pointers in the structure
  40.     ppsg.pfnDlgProc = (int (__stdcall *)(HWND, unsigned int, unsigned int, long))dlgProc;
  41.     ppsg.pfnCallback = (unsigned int (CALLBACK *)(HWND, unsigned int, PROPSHEETPAGE*))propProc; 
  42.     
  43.  
  44.     // Now let's register this property page
  45.     return (int)CreatePropertySheetPage(&ppsg);
  46. }// RegisterPropertyPage
  47.  
  48.