Controlling Skype via its Skype4COM.dll COM API
Asked Answered
R

3

6

I'm working with the Skype4COM.dll COM API using C# and it works very well for all of the communication functionality we need. We are trying to put an easier to use interface on top of Skype that is baked into our application.

My trouble lies in controlling or disabling which Skype windows to use and not use. The only Skype window I believe I'll need is the Skype video phone/conference window. I would like to hide and control every other window that Skype can present. I would even like to disable the incoming call dialog window that pops up on incoming calls, since we'll be presenting our own answer prompt. I'm happy with the API except window management.

With the API, I can see how to enable Windows, but I can't seem to figure out how to hide them, short of hacking a windows message to the Skype app. Am I missing something?

Thanks for your assistance, Kenny

Robinia answered 9/3, 2009 at 18:43 Comment(0)
R
6

Poking around a bit we found that you can send 'Skype Commands' via

skypeobj.SendCommand ( Command cmd );

That works pretty well for most of what we need. Here is a reference on the Skype developer site:

Some code:

    void _SendSkypeCommand ( string cmdToSend )
    {
        Command cmdSkype = new Command ();
        cmdSkype.Blocking = true;
        cmdSkype.Timeout = 2000;
        cmdSkype.Command = cmdToSend;
        Trace.WriteLineIf ( _TracingDetailed, string.Format ( "skype command sent '{0}'", cmdToSend ) );
        _skype.SendCommand ( cmdSkype );
    }

    void _hideSkypeWindows ()
    {
        _SendSkypeCommand ( "SET SILENT_MODE ON" );
        _SendSkypeCommand ( "SET WINDOWSTATE HIDDEN" );
    }
Robinia answered 10/3, 2009 at 13:54 Comment(1)
I have similar problem. Solution is pretty nice, but...maybe it is possible to control calls, messages, etc without logged client? Or 'better hidden' (without icon in tray)?Baroja
U
1

Unfortunately, the interface doesn't actually give you control over the actual windows, only methods to display and modify them (through wrappers).

As you said, you will have to get the handle of the window somehow and then send a message to hide it.

Unheardof answered 9/3, 2009 at 18:49 Comment(0)
F
0

I have same problem, and the

_SendSkypeCommand ( "SET SILENT_MODE ON" );

has been broken, as it is said on this post: http://devforum.skype.com/t5/Desktop-API/How-to-keep-hidden-Skype-UI-using-Skype4COM/td-p/12338

My solution is make skype UI invisible by moving it's window out of display area.

Now code:

 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
    public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
    [DllImport("user32.dll", SetLastError = true)]
    internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);        
    IntPtr hwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "tSkMainForm", null);//find skype window                  
    MoveWindow(hwnd, 2300, 2300, 300, 400, true);
Figural answered 30/5, 2013 at 3:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.