コード例 #1
0
ファイル: DokanNFCShellExt.cs プロジェクト: sainaen/dokan-nfc
        /// <summary>
        /// Add property page for this object
        /// </summary>
        /// <param name="lpfnAddPage"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        int IShellPropSheetExt.AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, IntPtr lParam)
        {
            try
            {
                // ADD PAGES HERE
                SheetControl samplePage;
                PROPSHEETPAGE psp;
                IntPtr hPage;

                // create new inherited property page(s) and pass dobj to it
                samplePage = new DokanNFCSheet();
                psp = samplePage.GetPSP(250, 230);

                hPage = ShellAPIWrapper.CreatePropertySheetPage(ref psp);
                bool result = pfnAddPage(hPage, lParam);
                if (!result)
                {
                    ShellAPIWrapper.DestroyPropertySheetPage(hPage);
                }

                // We'll add reference manualy only if there is no exceptions
                samplePage.KeepAlive();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
            return 0;
        }
コード例 #2
0
        /// <summary>
        /// Add property page for this object
        /// </summary>
        /// <param name="lpfnAddPage"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        int IShellPropSheetExt.AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, IntPtr lParam)
        {
            try
            {
                // ADD PAGES HERE
                SheetControl  samplePage;
                PROPSHEETPAGE psp;
                IntPtr        hPage;

                // create new inherited property page(s) and pass dobj to it
                samplePage = new DokanNFCSheet();
                psp        = samplePage.GetPSP(250, 230);

                hPage = ShellAPIWrapper.CreatePropertySheetPage(ref psp);
                bool result = pfnAddPage(hPage, lParam);
                if (!result)
                {
                    ShellAPIWrapper.DestroyPropertySheetPage(hPage);
                }

                // We'll add reference manualy only if there is no exceptions
                samplePage.KeepAlive();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
            return(0);
        }