// GetActiveObject retrieves active object for program ID and interface ID based // on interface type. // // Only supports IUnknown. // // Program ID can be either program ID or application string. func GetActiveObject(programID string) (unknown *ole.IUnknown, err error) { classID, err := ole.ClassIDFrom(programID) if err != nil { return } unknown, err = ole.GetActiveObject(classID, ole.IID_IUnknown) if err != nil { return } return }
// CreateObject creates object from programID based on interface type. // // Only supports IUnknown. // // Program ID can be either program ID or application string. func CreateObject(programID string) (unknown *ole.IUnknown, err error) { classID, err := ole.ClassIDFrom(programID) if err != nil { return } unknown, err = ole.CreateInstance(classID, ole.IID_IUnknown) if err != nil { return } return }
// ClassIDFrom retrieves class ID whether given is program ID or application string. func ClassIDFrom(programID string) (classID *ole.GUID, err error) { return ole.ClassIDFrom(programID) }