![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hello NG
On a property page that i have added to the outlook options form, i have a button. And when the user clicks that button i want the FolderBrowserDialog to open. My code: using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { fbd.Description = "Select folder"; fbd.SelectedPath = DefaultFolder; if (fbd.ShowDialog() == DialogResult.OK) strReturn = fbd.SelectedPath; } It do not shows on the screen, if i pause the code it stops at the If(fbd.ShowDialog() == DialogResult.OK) line. I think that Outlook can't open a modal dialog from the property pages. Is there another way to do that. Kind regards Johnny Jensen |
#2
|
|||
|
|||
![]()
Sure you can open a modal dialog on top of a property page, I do it all the
time. You just need to pass along the window handle of the window you want the dialog to be on top of as the owner of your dialog. Get the hWnd of your property page and pass that as the hWnd of the owner of the dialog. You can also set the TopMost property of your dialog. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "J E Jensen" wrote in message ... Hello NG On a property page that i have added to the outlook options form, i have a button. And when the user clicks that button i want the FolderBrowserDialog to open. My code: using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { fbd.Description = "Select folder"; fbd.SelectedPath = DefaultFolder; if (fbd.ShowDialog() == DialogResult.OK) strReturn = fbd.SelectedPath; } It do not shows on the screen, if i pause the code it stops at the If(fbd.ShowDialog() == DialogResult.OK) line. I think that Outlook can't open a modal dialog from the property pages. Is there another way to do that. Kind regards Johnny Jensen |
#3
|
|||
|
|||
![]()
Hello Ken
Thanks for helping. The dialog i want to display i the System.Windows.Forms.FolderBrowserDialog this dialog allow me to pass a IWin32Window as the owner, so I stubbled over a snipet to help me. The wrapper: public class WindowWrapper : System.Windows.Forms.IWin32Window { public WindowWrapper(IntPtr handle) { _Handle = handle; } private IntPtr _Handle; public IntPtr Handle { get { return _Handle; } } } I'll get the Outlook's handle by: System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName("OUT LOOK"); if (proc.Length 0) { IntPtr hwnd = proc[0].MainWindowHandle; } The create a new instance of the WindowWrapper with the hwnd in the construstor. Then i use the FolderBrowserDialog.ShowDialog(new WindowWrapper(hwnd)) but the dialog never shows. Kind regards Johnny Jensen "Ken Slovak - [MVP - Outlook]" wrote in message ... Sure you can open a modal dialog on top of a property page, I do it all the time. You just need to pass along the window handle of the window you want the dialog to be on top of as the owner of your dialog. Get the hWnd of your property page and pass that as the hWnd of the owner of the dialog. You can also set the TopMost property of your dialog. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "J E Jensen" wrote in message ... Hello NG On a property page that i have added to the outlook options form, i have a button. And when the user clicks that button i want the FolderBrowserDialog to open. My code: using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { fbd.Description = "Select folder"; fbd.SelectedPath = DefaultFolder; if (fbd.ShowDialog() == DialogResult.OK) strReturn = fbd.SelectedPath; } It do not shows on the screen, if i pause the code it stops at the If(fbd.ShowDialog() == DialogResult.OK) line. I think that Outlook can't open a modal dialog from the property pages. Is there another way to do that. Kind regards Johnny Jensen |
#4
|
|||
|
|||
![]()
My guess is that will place your dialog behind the property page but in
front of the main Outlook window, in other words invisible. I'd use the hWnd for the property page form or usercontrol you are using rather than the hWnd of the main Outlook window. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "J E Jensen" wrote in message ... Hello Ken Thanks for helping. The dialog i want to display i the System.Windows.Forms.FolderBrowserDialog this dialog allow me to pass a IWin32Window as the owner, so I stubbled over a snipet to help me. The wrapper: public class WindowWrapper : System.Windows.Forms.IWin32Window { public WindowWrapper(IntPtr handle) { _Handle = handle; } private IntPtr _Handle; public IntPtr Handle { get { return _Handle; } } } I'll get the Outlook's handle by: System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName("OUT LOOK"); if (proc.Length 0) { IntPtr hwnd = proc[0].MainWindowHandle; } The create a new instance of the WindowWrapper with the hwnd in the construstor. Then i use the FolderBrowserDialog.ShowDialog(new WindowWrapper(hwnd)) but the dialog never shows. Kind regards Johnny Jensen |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disable Security Dialogs | Venky | Outlook - Using Forms | 1 | June 28th 07 06:45 PM |
Showing modal dialogs from a TabPage on Outlook Property Page | Tadwick | Outlook and VBA | 0 | May 24th 07 05:15 PM |
Enabling prompt dialogs | Sue Mosher [MVP-Outlook] | Outlook and VBA | 2 | March 31st 07 06:31 PM |
Unresponsive Outlook security dialogs | Jon | Outlook and VBA | 3 | March 17th 07 06:44 PM |
Too many Find Public Folders dialogs open | JJSPROUT | Outlook - Using Contacts | 1 | March 22nd 06 07:35 AM |