Unlike this mess, when you minimize an audio call you nice need like call monitor that really can do everything you need.
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
First we use the above code to let us run the ShowWindowAsync method that we can pass our window handle to and tell it to minimize that window. This let's us talk directly to the OS.
Next we need to take advantage of the Automation ability in the LyncClient object by doing something like this.
Automation a = LyncClient.GetAutomation();
Now we find the conversation we want to minimize or build an easy foreach look on the LyncClient.ConversationManager.Conversations objects to burn through them all.
Conversation c;
Once we have our conversation we use the automation to get the window, then the window handle.
ConversationWindow cw = a.GetConversationWindow(c);
IntPtr myh = cw.Handle;
Then finally we call our user32.dll we declared at the top to tell Windows to minimize that conversation window.
ShowWindowAsync(myh, 2);
That will conclude this weeks blog post. If you have any questions hit me up on twitter.
Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC Developer BridgeOC
Twitter - @droutledge @ndbridge
Twitter - @droutledge @ndbridge
Thank you a lot for this post :)
ReplyDelete