This is a working example using the Skype4COM API methods to translate Skype chats in 57 different languages in real-time and also speaks your Skype chat messages and contact status changes in 10 different languages. As you can see, the Skype API is very powerful and advanced.
Click here for more information.
SEHE - Skype4COM Event Handler Example
Click any one of the pictures to install SEHE using Microsoft ClickOnce Technology
SEHE can be uninstalled at any time using Add/Remove Programs from Your Control panel.
Here are some of the things this example shows or can do:
- Debugging tool alongside your application
- Easily modify text output for testing events or situations
- Captures ALL events as of Skype4COM 184.108.40.206
- Works With both 32 and 64 bit versions of Windows
- Dealing with Skype4COM ambiguity issues
- How to include Skype4COM in your project
- How to use the version of your choice of Skype4COM
- How to use multiple versions of Skype4COM at same time
- How to use Skype4COM without registering it
- How to open a web page to Download Skype if not Installed
- List of known issues found with 220.127.116.11 API/Skype4COM
- Displays many Skype properties at Skype User logon
- Shows use of waited attachment logic
- Shows use of non-waited attachment logic
- Shows how to start Skype from an application
- Shows how to deal with program authorization
- Shows how to deal with Program authorizations for multiple Skype users
- Shows use of Silent Mode
- Shows how to go away at Skype user logoff
- Shows how to go away at Skype program exit
- Shows how to Survive/Recover from multiple Skype logoffs/logons
- Shows how to Survive/Recover from Skype program stops/starts
- Shows how to deal with Skype user change and program authorization
- Shows how to deal with having your application denied by the Skype user
- Shows proper recovery and error logic with Skype4COM
- Auto-Debug and invoke the debugger dynamically and automatically
- How to send API commands
- How to use Blocking/Non-Blocking API commands
- How to use the API Expected Text option
- How to use API command Id option
- Shows how to use Windows System Timer logic
- Shows how to deploy applications using Microsoft ClickOnce technology
- Shows application deployment and Installer methods
- Shows how to have your program listed in Add/Remove programs
- Shows how to open default browser window for help from your application
- Shows how to use the FREE Microsoft Visual C# 2008 Express
- Shows how to avoid using the registry using .NET User properties instead
- Shows use of .NET 3.5 and C# 2008 both the latest versions from Microsoft
- Shows use of NotifyIcon and Taskbar Logic Driven By Project User Settings
- Shows How to Auto-Update your application using ClickOnce Technology
- Shows How to use a PayPal donation link
- Shows How to use a link back to your web site.
- Learn interfacing to Skype4COM FAST!
Now you say "But what do all these check boxes and links do?"
"Exit on User Logoff" and "Exit On Skype Stop" check boxes when checked will cause this application to exit when the Skype user logs off or the Skype Client is stopped.
"Start Skype if Needed" when checked will cause this application when started to start the Skype client if it is not already running. If the "Start Skype if Needed" check box is started after this application has started and the Skype client is not started, it will be started as well.
"Enable Silent Mode" if checked when this application is started, and the Skype client is already running a set silent mode request will be sent right away. If the Skype client is not running when this check box is checked, a set silent mode will be queued and take place once this application successfully attaches to the Skype client. Setting Silent Mode causes the Skype client to NOT open any windows. Silent mode will remain set until the Skype icon on the toolbar has been clicked.
"Use Auto Debug" if checked will offer you a choice to Abort, Continue or invoke the debugger automatically debugging this code. This is an excellent method to drop into debug and view variables to see what went wrong automatically. This logic can also remain in place and simply be set to false when the same code is released to the public so that it can be used for testing of future versions. When "Use Auto Debug" is not checked, there will only be a message placed in the text box that an error has occurred. NOTE: To Use Auto Debug dynamically to drop into Debug and display the code where the program encountered a problem, you would need the project files and would need to be running in debug mode as well.
"Start Minimized" when checked and this application starts the Skype client by using the "Start Skype if Needed" check box, will start the Skype client minimized. The Skype client will only start minimized if auto-logon is being done, otherwise the Skype client window needs to display so that a Skype user name and password can be entered.
"Start No Splash" when checked and this application starts the Skype client by using the "Start Skype if Needed" check box, will start the Skype client without the Skype Splash box that normally appears when Skype is started.
"Hide API Window" when checked does not display API commands, API error messages, or API reply messages. There are things that go on in the background with Skype4COM which use API messages. If you are only using Skype4COM methods and not sending RAW API commands, you may not have a need to see these messages, so these messages are contained in their own window so that you can decide if you need to view them. All of the API check boxes and command and expected text boxes are hidden or appear based on this check box.
"Logging On" when checked will log messages to both the Skype4COM message window and the API message window. When not checked, message logging does NOT take place. This is so you can scroll back and look at older messages if needed. This is the only check box that is not saved at program exit. If it was, you would start this application with logging disabled, and might not realize it.
"Always Start as FirstTime = True" when checked will reset the FirstTime switch and this program will act as if this is the first time this Windows User has run this application. There is some first time application logic that is only done when this application senses it is the first time that this Windows user has run this application, such as prompting right away that they need to approve the use of this application using the Skype Client. Normally, once one successful attach request has completed for this Windows user ("This Windows User might have MANY Skype names") the FirstTime switch is set to false, and a 30 second timer is set to warn the user vs warning the user right away that they may need to approve this application. This check box can be checked, then by deleting any Skype user authorization for this program for the Skype user you are testing with and then stopping this application and re-starting it will has reset FirstTime as true again so you can test how initial program authorization by the Skype client is handled, many times and many ways. Also, once FirstTime is set to True, which you can see is the case in the logged messages at this program initialization, you can uncheck this check box if needed to see the FirstTime switch set to false again. You can make sure that you delete ANY authorization for this program for this Skype use is deleted and removed by going to the Skype client and doing: Tools -> Options -> Advanced -> Manage Other Programs Access To Skype and then remove any authorization for this program and click Save. You can now do testing as if this is the first time this program attempted to use the Skype Client for this Windows User.
"Always Use Non-Waited Attach Request" when checked will never set a Skype attach request to wait for a response. In most cases, this is the best method to use to attach to the Skype client, however your application may want to use a waited attachment request that is based on the timeout value of Skype4COM which is normally 30 seconds. If this check box is not checked, it shows how to wait for a response from the Skype client on a attachment request ("Once the API is available") and shows how to extend that time "in this case to 60 seconds" and try again, if the initial attach request times out. By removing any authorization record for this program from the Skype client for a Skype user, and then starting the Skype client, without logging on, and having this check box unchecked, and then starting this application, this will show and invoke this timeout logic, if you do not approve this program from the Skype client. It is a way to see the difference between a waited and non-waited attachment request. You can even see the difference in using a waited attachment request vs a non-waited attachment request and how the waited attachment request hangs both the GUI and the program while waiting for the waited attachment to complete, because this program is single threaded.
"Click For SaveOnTelephoneBills.com" points to a new web site I am in the process of keeping much more Skype examples On.
"Click To Donate" allows you to donate any value you feel is justified for this example project with source code, it also shows how you can use PayPal as well to accept donations for your software.
"Use Blocking" when checked sends API commands using Blocking.
"Use Command Id" when checked sends commands with a unique number of 10,000 or greater so that you can track commands generated by this program vs the Skype client or Skype4COM.
"Save Text" when checked leaves text after command is sent otherwise text is cleared. Commands are sent when the ENTER key is pressed in the Command or Expected Text text box and a command is present in the Command Text Box. When checked, the last text entered in both the Command and Expected text boxes will be saved and used the next time the program is started by the same Windows User.
"Retry Command Timeouts" when checked will attempt one more time to send a command. No logic was added to check if this program was attached or if the Skype client was logged in, or started so that you can see what will happen in these situations.
"Command Text" ANY... API command can be entered here and will not be sent until the ENTER key is pressed while the cursor is in the Command or Expected text box and the Command Text box contains text.
"Expected Text" will be attached to the command and be received with the Reply. This helps to carry any data in your program that you may need to match with when a Reply is received. The API command will not be sent until the ENTER key is pressed while the cursor is in the Command or Expected text box and the Command Text box contains text.
Check Box values are saved prior to program exit ("Minus the "Logging On" Check Box") by using the .NET user settings, they do not use the registry, however they are based on a per Windows user id, not on a per Skype name id. So there is additional program logic used besides the FirstTime switch, when an attachment response of "Pending Authorization" takes more than 30 seconds before a successful attachment response is received, the Skype user is prompted to check the Skype client to see if this application needs to be approved. This warning, message box currently will then be displayed every 60 seconds, using a Windows system timer until the application is approved or stopped.
"Click For Help With This Program" will open a browser window ("Your Default Browser") to the forum, where a thread that contains the entire project can be downloaded and you can post messages about questions or any help you may need with using this application.
"Click For DevZone Help" will open the DevZone Home page in your default browser when clicked.
"Click For Skype4COM Help" will open the DevZone Skype4COM Help Home page in your default browser when clicked.
"Click For API Help" will open the DevZone API Help Home page in your default browser when clicked.
Any of these user settings can be set to true or false, so that they become the default check box settings by changing the Project -> Properties -> Settings associated with the check box in question and then clicking the Synchronize button.
This application can help you emulate, gather, view and test almost all features of the API/Skype4COM. It can be modified very quickly and easily to provide any detail you may require and it can validate if your application is in fact processing Skype events properly.
Even IF you do not have any desire to use the C# language or .NET, this is a "Must Have" tool that can save you many hours of trouble-shooting and development time for your 3rd party Skype application.
It can show you techniques that will help make your 3rd party application work for ALL Skype for Windows clients and versions and will help make your application "Rock Solid" for your end users.
Enjoy, I hope this helped show how to interface to the Skype client as well as how easy C# is to code in and that you can create applications for FREE using the Microsoft Visual C# Express Edition.
This example also shows how to use "Microsoft ClickOnce" technology which in combination with WinZIP Self-Extractor which has a free 30 day demo can be used to create installer files that automatically take care of the install as well and uninstalls using the Add/Remove programs.
This is a great example even if you do NOT use .NET or Visual C# because it shows coding techniques to deal with Skype Attachment logic, as well as Authorization logic.
.NET 3.5 is automatically installed as well at Install time, if needed, using Microsoft ClickOnce methodology when/if needed automatically at end user install time on a per user basis.
It also deals with how to get around some of the ambiguity problems, and has notes on what API/Skype4COM functions that currently have problems or issues as well.
It can be very helpful for debugging as well.
If you want to see the ClickOnce Published files that were used to create the above .exe, and don't want the source code or the entire project, simply click the link below to install using Microsoft ClickOnce Technology:
To Install SEHE Using Microsoft ClickOnce Technology, click this.
The Goal of this example is to show using Skype4COM Lib from project design, to use of Skype4COM lib features and finally end user installation.
All things used to build and distribute this project were used at no cost.
Microsoft Visual C# 2008 Express edition is FREE.
SEHE can be removed via the Add/Remove programs located in your control panel and does NOT require a Skype4COM .dll or Extras Manager to be pre-installed or registered on the system in question.
This program will use Skype4COM .dll 18.104.22.168 even if another version of the Skype4COM .dll is registered and already installed on the system it is installed on.
This program will leave any Skype4COM .dll registered as it was on the system in question, while it is present and after is removed.
To build the project, without errors, you may need to create a test key if you receive an error at build time about no key. To do this, click on Project -> SEHE Properties -> Signing -> Create Test Key ("Enter Password of your choice") and re-build the project. If your current registered version of Skype4COM is less than 22.214.171.124, you can click the unregister.bat file and then the register.bat file ("Both included in the SEHE Folder") to register the copy of Skype4COM 126.96.36.199 included in the .zip project files.
The MultipleS4CExample.zip should ONLY be used after you have installed the SEHE - Skype4COM Event Handler Example. This is because when you run the SEHE.exe file from this folder it will NOT check to see if .NET 3.5 is already installed on your system. A check with the normal install of the SEHE - Skype Event Handler Example does do this, and if and when needed .NET 3.5 will be installed on your system and running SEHE.exe will not cause errors at runtime because .NET 3.5 is not installed. This shows how to switch and use multiple Skype4COM lib versions quickly and just for the SEHE.exe program, while leaving the registered version of Skype4COM registered at the time of the Skype client install alone, and as it was for ALL other 3rd party Skype Application and Extras on the system in question and only using a different version of Skype4COM lib for SEHE.exe. To use this example, download it from the attachments and then right click on MultipleS4CExample.zip and choose Extract All. Please read the ReadMe.text file included in MultipleS4CExample.zip. This example includes versions 188.8.131.52, 184.108.40.206, 220.127.116.11 and 18.104.22.168 versions of Skype4COM lib. It is perfectly normal for example, when using the SEHE.exe ("Which was built using Skype4COM lib 22.214.171.124") file from this folder with an older Skype4COM version less than 126.96.36.199 to list an error when any method is not supported by the older version of Skype4COM Lib, SEHE.exe will not abend when this happens, it will continue after reporting the error.
This version 188.8.131.52 senses that the Skype client is NOT installed, opens a browser window to the Skype download page, waits for the Skype client to be downloaded and installed, and attaches to the Skype client, once a Skype User has logged on. If you have version 1.0.31.x < 12, it will auto-update next time it is started, using Instant-Update, Microsoft ClickOnce Technology.
Points of Interest
To Find Out How Don Kennedy Got the Nick OverLord, click here.
SEHE Uses Microsoft ClickOnce Technology for Automatic Updates so it can be updated at anytime, never a need to check for new versions of SEHE.
See SEHE project files for how the MAGIC is done. Make your programs and applications Auto-Update as needed as well.
Skype has one of the BEST API interfaces available to programmers yet few developers know of this.
Don't have Skype yet? Don't worry SEHE can sense that and will prompt you to install Skype if and when needed.
Because SEHE has so many uses and contains over 5,000 lines of source code, I would rather answer questions on a one to one basis, play with it first.
The best bet would be install SEHE using the ClickOnce link above, and see exactly what it can do, then use the links at the top of the SEHE window to become familiar with the area(s) of the Skype API, you would like to use, since there are many.
Please feel free to ask any question about the Skype API or Microsoft ClickOnce Technology, I am very seasoned with both.
- 184.108.40.206 - Added
Taskbar code from another article I wrote here at The Code Project, click here for that article
Enjoy TheUberOverLord AKA Don Kennedy