Outlook window getting the keyboard focus instead of user created Form Window during Outlook Startup

This MAPILogonComplete method involves creating a Form Window to show "What's New" of a certain Addin version (DisplayWhatsNewDialog() in the code):
private void _outlook_MAPILogonComplete() {
_logger.Info("_outlook_MAPILogonComplete");
try
if (_timerForm != null)
_timerForm.Timer.Stop();
_timerForm.Timer.Dispose();
catch (Exception ex2)
_logger.Error(ex2.Message, ex2);
try
if (Globals.BJNSettings.showWhatsNew)
Globals.BJNSettings.showWhatsNew = false;
UIHelper.DisplayWhatsNewDialog(false);
Ol.Inspector insp = null;
if (_inspectors.Count > 0)
for (int i = _inspectors.Count; i >= 1; i--)
insp = _inspectors[i];
WrapInspector(insp);
insp = null;
Ol.Explorer expl = null;
if (_explorers.Count > 0)
for (int i = _explorers.Count; i >= 1; i--)
expl = _explorers[i];
WrapExplorer(expl);
expl = null;
GetAddinsList();
Thread logSystemInfoThread = new Thread(new ThreadStart(LogSystemInformation));
logSystemInfoThread.TrySetApartmentState(ApartmentState.STA);
logSystemInfoThread.IsBackground = true;
logSystemInfoThread.Start();
try
Ol.NameSpace ns = _outlook.GetNamespace("MAPI");
_calFolder = ns.GetDefaultFolder(Ol.OlDefaultFolders.olFolderCalendar) as Ol.Folder;
_calFolder.BeforeItemMove += new Ol.MAPIFolderEvents_12_BeforeItemMoveEventHandler(_calFolder_BeforeItemMove);
_delFolder = ns.GetDefaultFolder(Ol.OlDefaultFolders.olFolderDeletedItems) as Ol.Folder;
Marshal.ReleaseComObject(ns);
ns = null;
catch (Exception ex)
_logger.Error(ex.Message, ex);
UIHelper.WriteDoNotDisableKeyToRegistry();
Globals.AppointmentsToProcess = new List<string>();
_timerForm.ProcessTimer.Interval = 3000;
_timerForm.ProcessTimer.Start();
catch (Exception ex)
_logger.Error(ex.Message, ex);
DisplayWhatsNewDialog() has this signature:
public static void DisplayWhatsNewDialog(bool modal)
try
string defaultWhatsNewFile = Globals.BJN_APP_BASE_DIRECTORY + "WhatsNew.txt";
string localISOLanguageName = Languages.GetTwoLetterISOLanguageName();
string localizedWhatsNewFile = Languages.GetInstalledLocalizedFilePath(localISOLanguageName, "WhatsNew.txt");
if (String.IsNullOrEmpty(localizedWhatsNewFile))
localizedWhatsNewFile = defaultWhatsNewFile;
if (File.Exists(localizedWhatsNewFile))
BJNWhatsNew whatsNew = new BJNWhatsNew(localizedWhatsNewFile);
if (modal)
whatsNew.ShowDialog();
whatsNew.Dispose();
else
whatsNew.TopMost = true;
whatsNew.Show();
whatsNew = null;
catch (Exception ex)
_logger.Error(ex.Message, ex);
The problem is if the Window is made modal, it blocks the Outlook to launch and also goes back of the Outlook loading window (Whats New window will not be having keyboard focus). And if the Window is made non-modal (passing false to DisplayWhatsNewDialog()),
Outlook launches properly and What's New window comes at the top but will not be having keyboard focus; instead the launched Outlook window will be having the keyboard focus. May anyone please suggest a way to make the What's New window to be always having
the keyboard focus? Structure of form window class BJNWhatsNew is given below:
public partial class BJNWhatsNew : Form
private static ILog _logger = LogManager.GetLogger(typeof(BJNWhatsNew));
public BJNWhatsNew(string whatsNewTextFileName)
InitializeComponent();
InitLabels();
InitEventHandlers();
InitWhatsNew(whatsNewTextFileName);
private void InitLabels()
try
this.Text = Properties.Resources.bjn_version_info_caption;
this.buttonClose.Text = Properties.Resources.ok_hotkey;
this.labelBJNAddin.Text = Properties.Resources.bjn_version_ol_addin;
this.labelVersion.Text = String.Format(Properties.Resources.version_format, Assembly.GetExecutingAssembly().GetName().Version.ToString(3));
Assembly assembly = Assembly.GetExecutingAssembly();
FileInfo fileInfo = new FileInfo(assembly.Location);
DateTime buildDate = fileInfo.LastWriteTime;
string formatString = "d MMM, yyyy";
this.labelReleaseDate.Text = String.Format(Properties.Resources.bjn_version_release_date, buildDate.ToString(formatString));
catch (Exception ex)
_logger.Error(ex.Message, ex);
private void InitEventHandlers()
this.buttonClose.Click += new EventHandler(buttonClose_Click);
private void InitWhatsNew(string whatsNewTextFileName)
try
if (File.Exists(whatsNewTextFileName))
StreamReader sr = new StreamReader(whatsNewTextFileName);
string whatsNew = sr.ReadToEnd();
sr.Close();
this.richTextBox1.Text = whatsNew;
this.richTextBox1.SelectionLength = 0;
this.buttonClose.Select();
this.buttonClose.Focus();
catch (Exception ex)
_logger.Error(ex.Message, ex);
void buttonClose_Click(object sender, EventArgs e)
this.Close();

Hello Prasad,
The ShowDialog method will block the current thread. If you want to continue working with Outlook objects you need to use the Show method instead. The key fact is that both methods (Show and ShowDialog) accepts an instance of the IWin32Window interface
which allows to specify the parent window handle. Specifying the parent window handle (Outlook Explorer window) to the Show method you can make your window shown on top of Outlook all the time.
To get the HWND of an Outlook explorer  object (e.g. Application.ActiveExplorer), cast it to IOleWindow and call IOleWindow.GetWindow(). Also you may find the
How to get the IWin32Window for Outlook
article helpful.

Similar Messages

  • Why does the keyboard focus keep switching to the menu bar?

    Does anyone else have the problem of Photoshop CS6 constantly setting the keyboard focus to the menu bar? This makes it difficult to use shortcuts.
    Typical examples: I want to switch to the Move tool, so I press V, but instead, the View menu drops down. Or I press T for the Type tool, but instead, the Filter menu drops down. This happens often and it's very annoying.
    This also happens in Premiere Pro CS6, and happens on both my Windows 7 and Windows 8.1 machines. Doesn't happen in other applications, and is not related to actually using a menu, i.e. if I choose something from a menu, then press V, Photoshop will often work correctly and activate the Move tool. This behavior seems to happen randomly.

    Alt doesn't really "unhide" the menu bar (speaking of Photoshop), but it's always been the introducer of keyboard operations for "keyboard accessbility" - i.e., operation of Windows applications without mouse.
    Alt causes little underlines to show up under the key characters of menu items, and prepares the system for the next character being typed to open a menu - so for example you press something like 'e' and the Edit menu pulls down.  Now you use an arrow key to move to the next item, or maybe a single character that's associated with one of the menu entries.
    Photoshop's goals for using modifier keys kind of conflict with this.  They've apparently tried to reach a balance where using the Alt key to modify some operation cancels the introduction of the next menu item. 
    But I don't think it's possible to be perfect at that, especially for example if the user presses Alt, decides not to do the operation he was thinking about doing (e.g., zooming out), then just releases the key.  Another factor might be the habits people get into for choosing tools.
    As a contrast, one person might not press the Alt key until they're sure they're going to do something with it (e.g., zoom out), and that same person might only choose tools from the Tools panel by clicking on them.  Another person might press the Alt key sometimes, but then stop before doing the operation it modifies.  That same person might be in the habit of choosing tools by their letter (e.g., E for eraser).  It's clear to see how the first person might never get into a condition where the menu introducer key (Alt) leaves them in a state where a menu opens inadvertently, while the latter might see it regularly.
    As far as why Photoshop might get into a mode where the menu introduction occurs when you HAVEN'T pressed the Alt key, I don't know; I certainly haven't seen that reported much if at all here on the forum.
    -Noel

  • How to get the full path instead of just the file name, in �FileChooser� ?

    In the FileChooserDemo example :
    In the statement : log.append("Saving: " + file.getName() + "." + newline);
    �file.getName()� returns the �file name�.
    My question is : How to get the full path instead of just the file name,
    e.g. C:/xdirectory/ydirectory/abc.gif instead of just abc.gif
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    public class FileChooserDemo extends JFrame {
    static private final String newline = "\n";
    public FileChooserDemo() {
    super("FileChooserDemo");
    //Create the log first, because the action listeners
    //need to refer to it.
    final JTextArea log = new JTextArea(5,20);
    log.setMargin(new Insets(5,5,5,5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);
    //Create a file chooser
    final JFileChooser fc = new JFileChooser();
    //Create the open button
    ImageIcon openIcon = new ImageIcon("images/open.gif");
    JButton openButton = new JButton("Open a File...", openIcon);
    openButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    int returnVal = fc.showOpenDialog(FileChooserDemo.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    //this is where a real application would open the file.
    log.append("Opening: " + file.getName() + "." + newline);
    } else {
    log.append("Open command cancelled by user." + newline);
    //Create the save button
    ImageIcon saveIcon = new ImageIcon("images/save.gif");
    JButton saveButton = new JButton("Save a File...", saveIcon);
    saveButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    int returnVal = fc.showSaveDialog(FileChooserDemo.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    //this is where a real application would save the file.
    log.append("Saving: " + file.getName() + "." + newline);
    } else {
    log.append("Save command cancelled by user." + newline);
    //For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(openButton);
    buttonPanel.add(saveButton);
    //Explicitly set the focus sequence.
    openButton.setNextFocusableComponent(saveButton);
    saveButton.setNextFocusableComponent(openButton);
    //Add the buttons and the log to the frame
    Container contentPane = getContentPane();
    contentPane.add(buttonPanel, BorderLayout.NORTH);
    contentPane.add(logScrollPane, BorderLayout.CENTER);
    public static void main(String[] args) {
    JFrame frame = new FileChooserDemo();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);

    simply use file.getPath()
    That should do it!Thank you !
    It takes care of the problem !!

  • When I go to type a message on messages my daughter has managed to get the keyboard in the middle of the screen , how do I return it to the bottom ?

    How do you get the keyboard in messages back to the bottom instead of the middle of the screen...it is really annoying

    If the keyboard is split and covering your text, Pull the two ends of the keyboard together - into the middle of the screen. You can also tap and hold down on the little keyboard icon in the lower right corner of the keyboard and select - Dock and Merge.
    If the keyboard is up on the middle of the screen, but not split, and you want to move it back to the bottom - tap and hold down on the little keyboard and icon and select - Dock
    You can turn the split keyboard off in Settings>General>Keyboard>Split Keyboard>Off.

  • TS1702 I cannot get the keyboard to come up on the ipad mini when in the citrix receiver.  Has anyone ran into this and do you know how to fix it?

    I cannot get the keyboard to come up on the ipad mini when in the citrix receiver.  Has anyone ran into this and do you know how to fix it?

    I am not familiar with Citrix Reciever but is it possible it is open or being used in another open app?
    Try quitting all apps then try again.
    Quit all apps: Double tap the Home button and swipe the app preview page up for each open app

  • On our project site, with Firefox 4 and 5, buttons don't take the keyboard focus if you mouse-click on them. Is this a problem of our site?

    On a page like http://www.ori.uzh.ch/links.html, clicking a link opens a new tab, and after closing that tab, you can move to the next link with the tabulator key. On that site, it still works with Firefox 5. I also worked on our project site (password secured, sorry) with Firefox up to 3.6.18. But now, if I open a link with the mouse, close that tab again and press the tab key, the focus just goes to the first clickable button, as if I had not clicked any button previously. If I open a link by tab key and "enter", the keyboard focus is preserved on that button. But there are many many buttons on our pages, and they reload frequently.
    BTW I adjusted the system preferences, so that the keyboard focus moves between all controls. (see http://www.tipstrs.com/tip/1505/Tab-key-to-select-form-elements-in-Firefox-on-the-Mac). But I don't think the problem is related to that.

    I found out that our buttons are no links, but input tags, type="submit". I'll discuss the problem with our programmer.

  • I'm trying to update itunes and keep getting the message"There is a problem with this windows installer package. A program required for this install to complete could not be run. Contact your support personal or package vendor"  Anyone know now to fix?

    I keep getting the message" There ais a problem with this windows Installer Package. A program required for this install to complete could not be run. Contact your support personnal or package vendor".  I get this whentrying to update itunes. 
    Does anyone have a idea how to fix this/
    Thanks

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • I'm trying to download the latest version of iTunes and get the message "There is a problem with this Windows Installer package. A program required for this install to complete could not be run." I have no clue what to do with this.

    I'm trying to download the latest version of iTunes and get the message "There is a problem with this Windows Installer package. A program required for this install to complete could not be run." I have no clue what to do with this to resolve the issue. Thanks for any help!

    Repair your Apple software update.
    Go to START > ALL PROGRAMS > Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START > CONTROL PANEL/ > Add n Remove Programs, highlight ASU and click CHANGE then REPAIR

  • How to get the absolute path of logicalhost server domain on Windows Sun

    i am reading a file from Xsql Folder, that is located in the logicalhost Sun\AppServer\domains\domain1\applications\j2ee-apps.(IN Sun Application Server)
    I am pretty sure that using the absolute path will solve this issue, so my first question is: How to get the absolute path of logicalhost server domain on Windows?
    i tried with System.getProperty("com.sun.aas.instanceRoot").
    but i am able to retrive Sun\AppServer\domains\domain1 upto this .i am unable to retrive Sun\AppServer\domains\domain1\applications\j2ee-apps.
    please suggest me how u can get absolute path in sun application server

    Take a look here

  • How to get the absolute path of logicalhost server domain on Windows?

    My logicalhost server domain behaves strangely. I am reading a file from collaboration definiton, that is located in the logicalhost/is/domains/domain1/config folder. I thought, that this folder is used as an application root folder so I can read files like ./file from there. And it worked.
    But then I've installed the domain as a Windows service, restarted the PC. When the domain1 gets started, I get exceptions saying that the file can't be found. Then I restart the domain (in domainmgr.bat) and it works again.
    I am pretty sure that using the absolute path will solve this issue, so my first question is: How to get the absolute path of logicalhost server domain on Windows?
    And my second question is: Why does this happen?

    The default folder for a Windows Service is the system32 folder contrary to the instance root folder when starting it as a normal process.
    That's the why, haven't tried the how, but you should be able to get the value by calling System.getProperty("com.sun.aas.instanceRoot").
    Hope this helps
    Paul

  • On my new iPhone, at the Apps store, I tried to make a purchase, the popup screen shows my Apple ID and asks for my password, but no keyboard appears so that I can enter the password.  How do I get the keyboard to appear??

    On my new iPhone, at the Apps store, I tried to make a purchase, the popup screen shows my Apple ID and asks for my password, but no keyboard appears so that I can enter the password.  How do I get the keyboard to appear??

    On your iPad, delete the existing account then sign back in with the new ID and password.

  • How do I get the keyboard on my macbook pro to light up?

    how do i get the keyboard on my macbook pro to light up?

    Welcome to Apple Support Communities
    What MacBook Pro have you got? Only Unibody MacBooks Pro (Late 2008 and newer) have a backlit keyboard. If you have one of these MacBooks Pro, you can set up its illumination in System Preferences > Keyboard. See > http://support.apple.com/kb/ht4882

  • How do you get the keyboard to appear if it doesn't do so automatically?

    When I am using the iPad, the keyboard automatically appears when I put my finger on a text box. However, after the latest iOS upgrade, this stops working occasionally, and I don't know how to get the keyboard back. Then, when I attempt to put text in, all I get is an option to '"paste." Any clues as to what's going on?

    - Connect the iPod to the computer and try to restore the iPod via iTunes
    - If iTunes did not see the iPod see if placing the iPod in recovery mode will all a restore. For recovery mode see:
    iPhone and iPod touch: Unable to update or restore
    - Then,  lett the battery fully drain. Charge for a couple of hours and try again.
    - Last, make an appointment at the Genius Bar of an Apple store.  You likely have a hardware probme.  Maybe a dead battery.

  • Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?

    Programming help - how to get the read-only state of PDF file is windows explorer preview is ON?
    I'm developing an application where a file is need to be saved as pdf. But, if there is already a pdf file with same name in the specified directory, I wish to overwrite it. And in the overwrite case, read-only files should not be overwritten. If the duplicate(old) file is opened in windows (Win7) explorer preview, it is write protected. So, it should not be overwritten. I tried to get the '
    FILE_ATTRIBUTE_READONLY' using MS API 'GetFileAttributes', but it didn't succeed. How Adobe marks the file as read-only for preview? Do I need to check some other attribute of the file?
    Thanks!

    Divya - I have done it in the past following these documents. Please read it and try it it will work.
    Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement) 
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true
    thanks!
    Jason PV

  • I had Photo Shop 2 installed and I can't type on it.  How do I get the keyboard to work?

    I have Photo Shop 2 installed on my MacBook Pro.  I cannot get the keyboard to type on my photoshop.  How do I correct this?

    Contact the developer support?

Maybe you are looking for

  • My ipod does not appear in device list

    iTunes does not recognize my iPod Touch. It does not appear as a "device". What does appear is "Sync George Lance's iPod". There is no problem syncing but can't manage the iPod. I have gone through the un-installing and re-installs of all of the Appl

  • Help with ping in cmd?

    hello there i've made a small program that pings on a dns using cmd and my problem here that :i want to do some action if the result is replay and do some other action if the result is request,how to do that? here is my code: import java.awt.*; impor

  • Problem with a selection-screen.

    HI, I want to make a screen at execution time. Depending of a flag variable, it´s the way that i made the layout of the screen at execution time. Here's a code example. SELECTION-SCREEN BEGIN OF SCREEN 0200 .    if pasos-descripcion = '01 DERIVACION

  • "now playing" displayed in the task bar?

    running itunes in vista is there anyway i can have the "now playing" displayed in the task bar? thanks

  • What to do on uncompleted patchset apply?

    I installed OEM grid control 10.2.0.1 and tried upgrade to 10.2.0.5 by applying the patchset 3731593. After loading all files, the runInstaller was doing all configuration on the components like j2ee and oms. That took very long time and the popup ja