Custom Sensor

 

Hello,

 

I make a custom sensor function and DLL. But registration this DLL is wrong. -> UserSensorProject.dll was load, but not find input point DllRegisterServer. This file cannot be registered.

Can you help me, somebody?

I use VB .NET 2005.

Vaclav

 

Posted by: Vaclav Blahnik
Post date: 2/18/2009 5:20:42 AM

2 REPLIES

RE: Custom Sensor

 

HI,

 

had the same problem.

 

Usually

1. Missing dll, you can find out which ones with "Depend" tool.

 

2. You can debug and simulate regsvr32 with

to understand what's wrong.

 

 

 

Posted by: Massimo Magris
Post date: 2/19/2009 3:13:51 AM

RE: Custom Sensor

 

#include "stdafx.h"

#include "windows.h"

#include "tchar.h"

 

typedef HRESULT (*DllReg)(void);

int _tmain(int argc, _TCHAR* argv[])

{

        DWORD err = 0;

        LPCWSTR dll = argv[1];

 

        HMODULE module = LoadLibrary(dll);

        if ( module == NULL ) {

                err = GetLastError();

        } else {

                DllReg dllReg = (DllReg)GetProcAddress(module,"DllRegisterServer");

                if ( dllReg == NULL ) {

                        err = GetLastError();

                } else {

                        dllReg();

                }

        }

        if ( err ) {

                LPWSTR msg;

                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,0,err,0,(LPWSTR)&msg,0,NULL);

                wprintf(msg);

                LocalFree(msg);

        }

        return err;

}

 

Posted by: Massimo Magris
Post date: 2/19/2009 4:21:24 AM