Reputation: 131
Can anybody translate the following code to C++? Is this possible at all or are there vital information missing?
Dim Laser As Object Sub EnableLaser ‘ Create a laser object if it hasn’t been done yet If Laser Is Nothing Then Set Laser = CreateObject("NWLaserXControl.NWLaserX") End If If Laser.Initialize Then Laser.RepRate = 10 ‘ set the rep rate to 10Hz Laser.LaserEnabled = True ‘ turn on laser power supply, get it ready End If End Sub
Upvotes: 1
Views: 743
Reputation: 4783
// if (CoInitialize(0) == S_OK)
{
CComPtr<INWLaserX> pMyPtr = NULL;
CLSID clsid = IID_NULL;
CLSIDFromProgID("NWLaserXControl.NWLaserX");
if (pMyPtr.CoCreateInstance(clsid) == S_OK)
{
pMyPtr->put_RepRate(10);
pMyPtr->put_LaserEnabled(TRUE);
}
// CoUnInitialize();
}
Upvotes: 1