views:

392

answers:

2

hi i have got a ScreenCameraSDK and it comes with a 11kb dll file, it has a documentation too which lists the functions which can be used. It says

ScreenCamera SDK ActiveX Reference Documentation
ActiveX Reference

The ActiveX ID on the system is: ScreenCameraSDK.RemoteControl
Every method on the interface returns FAIL or SUCCESS. (0 or 1).
Create an instance of the ActiveX on your application, and then call InitializeScreenCameraRemoteControl. If the return value is SUCCESS then ScreenCamera is properly installed and you can then call any other method on the ActiveX's interface. If not ScreenCamera could not be found and you should contact support.**

Now my question is, i have the dll and no other files. How can i use the functions inside it in a VC++ Project with Visual Studio 2008. Thanks

I TRIED THE FOLLOWING CODE BUT GOT COMPILATION ERROR OF UNDEFINED IDENTIFIER

  #include <stdio.h>

      // This is the path for your DLL.
      // Make sure that you specify the exact path.

      #import "e:\ScreenCameraSDK.dll"  no_namespace

      void main()
      {
       BSTR bstrDesc;

      try
      {
      CoInitialize(NULL);
      short st = 2;
       short st1;
      // Declare the Interface Pointer for your Visual Basic object. Here,
      // _Class1Ptr is the Smart pointer wrapper class representing the
      // default interface of the Visual Basic object.

      _Class1Ptr ptr;
      // Create an instance of your Visual Basic object, here
      // __uuidof(Class1) gets the CLSID of your Visual Basic object.

       ptr.CreateInstance(__uuidof(Class1));
       st1 = ptr->MyVBFunction(&st);
      }
      catch(_com_error &e)
      {
       bstrDesc = e.Description();

      }
      CoUninitialize();
      }

it says _Class1Ptr is unknown!

A: 

Use this manual to add ActiveX control in your project. If you want to create wrapper class you could read to this article.

Kirill V. Lyadvinsky
A: 

First of all you have to do this is #import the dll, and the compiler will automatically generate all required definitions from it. Then create objects from the library by using either smart pointers, or CreateInstance().

#import "C:\files\test.dll"    no_namespace rename("EOF", "EOFile")

...
int main() {
   if (FAILED(::CoInitialize(NULL)))
      return 0;
    ........
   ::CoUninitialize();
   return 0;
}
adatapost
can you give a more accurate example? where is the handle to the imported dll in this?
Anirudh Goel