A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook add-in open dialogs



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 12th 10, 09:21 AM posted to microsoft.public.outlook.program_addins
J E Jensen
external usenet poster
 
Posts: 3
Default Outlook add-in open dialogs

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  
Old March 12th 10, 02:37 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook add-in open dialogs

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  
Old March 14th 10, 05:20 PM posted to microsoft.public.outlook.program_addins
J E Jensen
external usenet poster
 
Posts: 3
Default Outlook add-in open dialogs

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  
Old March 15th 10, 01:13 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook add-in open dialogs

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 04:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.