How do I create an object using golang? I use go-ole and it report an class not registered error although I have already registered this dll by regsvr32 dm.dll.
Can anyone show me the correct code.
ole.CoInitialize(0)
unknown, err := oleutil.CreateObject("dm.dmsoft")
if err != nil {
log.Fatal(err)
}
dm := unknown.MustQueryInterface(ole.IID_IDispatch)
When you get class not registered it means that the COM dll or exe has not been registered so when you try to instantiate the COM object the OS doesn't know where to find the .DLL/Exe.
In the case of DLL register with regsvr32 (C:\>regsvr32 {full path}dm.dll
), executables usually register with a command line argument /RegServer