Thread: How to handle COM Exception

  1. #1
    Registered User
    Join Date
    Apr 2007

    Question How to handle COM Exception

    hi guys ,

    simple code to convert from text to speech .. it's supposed to work fine .
    any way it generates a COM exception isn't handled .

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using SpeechLib;
    namespace SimpTesTX
        public partial class Form1 : Form
            public Form1()
            private void Form1_Load(object sender, EventArgs e)
                string s = "Hello World ";
                SpVoice sp = new SpVoice();
                sp.Speak(s, SpeechVoiceSpeakFlags.SVSFDefault);
    thanx is advance .

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    You handle COM exceptions like any other exception: by catching it.

    To solve your problem, you would want to know what the exact error is. Catching the exception and printing out its message will help you there.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  2. Handle C++ exception and structured exception together
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2008, 09:21 PM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM