Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am getting this error
{System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {D6BA1539-8473-497C-92C3-8ECF63DAC0F3} failed due to the following error: 80040154.
at ASP.webform1_aspx.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\WebcamPicture\WebForm1.aspx:line 21}
while executing the following code


System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();
        //Jpeg compression quality
        short nQuality = 45;
        //Shout a picture from my webcam
        
        CAMSERVERLib.Camera cam = new CAMSERVERLib.CameraClass();
        
        byte[] picture = (byte[])cam.GrabFrame(nQuality);
        //Add the hour to the jpeg picture
        MemoryStream ms = new MemoryStream(picture);
        Bitmap bmp = new Bitmap(ms);
        Graphics g = Graphics.FromImage(bmp);
        string strDate = DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString();
        StringFormat drawFormat = new StringFormat();
        drawFormat.Alignment = StringAlignment.Center;
        g.DrawString(strDate,
                        new Font(FontFamily.GenericSansSerif, 12),
                        new SolidBrush(Color.Black),
                        new RectangleF(1, 1, 320, 240),
                        drawFormat
                    );
        g.DrawString(strDate,
                        new Font(FontFamily.GenericSansSerif, 12),
                        new SolidBrush(Color.White),
                        new RectangleF(0, 0, 320, 240),
                        drawFormat
                    );
        //Get codecs
        ImageCodecInfo[] icf = ImageCodecInfo.GetImageEncoders();
        EncoderParameters encps = new EncoderParameters(1);
        EncoderParameter encp = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)nQuality);
        //Set quality
        encps.Param[0] = encp;
        bmp.Save(Response.OutputStream, icf[1], encps);
        g.Dispose();
        bmp.Dispose();

I have sucessfully register the dll iusing regasm. but why iam getting this error please tell me.

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 19-Feb-11 0:06am
v2

As this is a COM error registering a dll with regasm will have no effect you need to register the dll with regsvr32.

To find out what dll have a look in the registry under HKCR\CLSID and look for the GUID {D6BA1539-8473-497C-92C3-8ECF63DAC0F3}

Also have a read of this[^] if you're running IIS7
 
Share this answer
 
Comments
Espen Harlinn 20-Feb-11 8:21am    
Good idea :)
Whenever you receive an error with a number, google can help:
http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=error:+80040154[^] just use the error number as your search term.
In this case, it send you straight here[^] which at least looks relevant.
 
Share this answer
 
Comments
Espen Harlinn 20-Feb-11 8:21am    
My 5 :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900