ActiveX with C#

G

Guest

I created ActiveX as following:


namespace BmpActiveXNET
{
public interface DesktopScreen
{
string getDesktopScreen();
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class BmpActiveX:DesktopScreen
{
public string getDesktopScreen()
{
//Capture the client screen
Bitmap bmp = BmpActiveXNET.CaptureScreen.GetDesktopImage();
//Get the Image Bytes
byte []BitmapBytes = GetBitmapBytes(bmp);
//Return Bytes as String
return GetBytesAsString(BitmapBytes);
}
}
}

and register it using
regasm BmpActiveXNET.dll /tlb:CompNet.dll /codebase

when try to create object from javascript
var o = new ActiveXObject("BmpActiveXNET.BmpActiveX");

error generated (automation server can't create object )
why this happened? whats wrong with what I did?
 
D

Dmytro Lapshyn [MVP]

Hi Raed,

The ProgID of the ActiveX might not correspond to the
"namespace_name.class_name" scheme.
Check out the exported type library for the real ProgID of the registered
ActiveX object.
 
G

Guest

May you provide me with more info for how to do this?

i tried to use it in VB6 like following
Private Sub Form_Load()
Dim a As New BmpActiveX
a.getDesktopScreen
End Sub

but error said
RunTime Error -2147024894(80070002), or one of its dependencies was not found

:
File Or Assembly name BmpActiveXNET
Hi Raed,

The ProgID of the ActiveX might not correspond to the
"namespace_name.class_name" scheme.
Check out the exported type library for the real ProgID of the registered
ActiveX object.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Raed Sawalha said:
I created ActiveX as following:


namespace BmpActiveXNET
{
public interface DesktopScreen
{
string getDesktopScreen();
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class BmpActiveX:DesktopScreen
{
public string getDesktopScreen()
{
//Capture the client screen
Bitmap bmp = BmpActiveXNET.CaptureScreen.GetDesktopImage();
//Get the Image Bytes
byte []BitmapBytes = GetBitmapBytes(bmp);
//Return Bytes as String
return GetBytesAsString(BitmapBytes);
}
}
}

and register it using
regasm BmpActiveXNET.dll /tlb:CompNet.dll /codebase

when try to create object from javascript
var o = new ActiveXObject("BmpActiveXNET.BmpActiveX");

error generated (automation server can't create object )
why this happened? whats wrong with what I did?
 
W

Willy Denoyette [MVP]

Raed Sawalha said:
I created ActiveX as following:


namespace BmpActiveXNET
{
public interface DesktopScreen
{
string getDesktopScreen();
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class BmpActiveX:DesktopScreen
{
public string getDesktopScreen()
{
//Capture the client screen
Bitmap bmp = BmpActiveXNET.CaptureScreen.GetDesktopImage();
//Get the Image Bytes
byte []BitmapBytes = GetBitmapBytes(bmp);
//Return Bytes as String
return GetBytesAsString(BitmapBytes);
}
}
}

and register it using
regasm BmpActiveXNET.dll /tlb:CompNet.dll /codebase

when try to create object from javascript
var o = new ActiveXObject("BmpActiveXNET.BmpActiveX");

error generated (automation server can't create object )
why this happened? whats wrong with what I did?

Where are these :
GetDesktopImage, GetBitmapBytes, GetBytesAsString ...methods stored? Same or
another assembly?

Willy.
 
G

Guest

GetDesktopImage is in other assembly(CaptureScreen.dll) and all others in
same assembly

Willy Denoyette said:
Raed Sawalha said:
I created ActiveX as following:


namespace BmpActiveXNET
{
public interface DesktopScreen
{
string getDesktopScreen();
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class BmpActiveX:DesktopScreen
{
public string getDesktopScreen()
{
//Capture the client screen
Bitmap bmp = BmpActiveXNET.CaptureScreen.GetDesktopImage();
//Get the Image Bytes
byte []BitmapBytes = GetBitmapBytes(bmp);
//Return Bytes as String
return GetBytesAsString(BitmapBytes);
}
}
}

and register it using
regasm BmpActiveXNET.dll /tlb:CompNet.dll /codebase

when try to create object from javascript
var o = new ActiveXObject("BmpActiveXNET.BmpActiveX");

error generated (automation server can't create object )
why this happened? whats wrong with what I did?

Where are these :
GetDesktopImage, GetBitmapBytes, GetBytesAsString ...methods stored? Same or
another assembly?

Willy.
 
W

Willy Denoyette [MVP]

And this assembly is in the same directory as the client script?

Willy.

Raed Sawalha said:
GetDesktopImage is in other assembly(CaptureScreen.dll) and all others in
same assembly

Willy Denoyette said:
Raed Sawalha said:
I created ActiveX as following:


namespace BmpActiveXNET
{
public interface DesktopScreen
{
string getDesktopScreen();
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class BmpActiveX:DesktopScreen
{
public string getDesktopScreen()
{
//Capture the client screen
Bitmap bmp = BmpActiveXNET.CaptureScreen.GetDesktopImage();
//Get the Image Bytes
byte []BitmapBytes = GetBitmapBytes(bmp);
//Return Bytes as String
return GetBytesAsString(BitmapBytes);
}
}
}

and register it using
regasm BmpActiveXNET.dll /tlb:CompNet.dll /codebase

when try to create object from javascript
var o = new ActiveXObject("BmpActiveXNET.BmpActiveX");

error generated (automation server can't create object )
why this happened? whats wrong with what I did?

Where are these :
GetDesktopImage, GetBitmapBytes, GetBytesAsString ...methods stored? Same
or
another assembly?

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top