| 1 | package olescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/ |
| 2 | |
| 3 | // Connection contains IUnknown for fluent interface interaction. |
| 4 | // |
| 5 | // Deprecated. Use oleutil package instead. |
| 6 | type Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection# struct { |
| 7 | Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Object. *IUnknownscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IUnknown# // Access COM |
| 8 | } |
| 9 | |
| 10 | // Initialize COM. |
| 11 | func (*Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Initializescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Initialize().() (err error) { |
| 12 | return coInitializescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/coInitialize().() |
| 13 | } |
| 14 | |
| 15 | // Uninitialize COM. |
| 16 | func (*Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Uninitializescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Uninitialize().() { |
| 17 | CoUninitializescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/CoUninitialize().() |
| 18 | } |
| 19 | |
| 20 | // Create IUnknown object based first on ProgId and then from String. |
| 21 | func (c *Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Createscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Create().(progId string) (err error) { |
| 22 | var clsid *GUIDscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/GUID# |
| 23 | clsid, err = CLSIDFromProgIDscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/CLSIDFromProgID().(progId) |
| 24 | if err != nil { |
| 25 | clsid, err = CLSIDFromStringscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/CLSIDFromString().(progId) |
| 26 | if err != nil { |
| 27 | return |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | unknown, err := CreateInstancescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/CreateInstance().(clsid, IID_IUnknownscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IID_IUnknown.) |
| 32 | if err != nil { |
| 33 | return |
| 34 | } |
| 35 | c.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Object. = unknown |
| 36 | |
| 37 | return |
| 38 | } |
| 39 | |
| 40 | // Release IUnknown object. |
| 41 | func (c *Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Releasescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Release().() { |
| 42 | c.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Object..Releasescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IUnknown#Release().() |
| 43 | } |
| 44 | |
| 45 | // Load COM object from list of programIDs or strings. |
| 46 | func (c *Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Loadscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Load().(names ...string) (errors []error) { |
| 47 | tempErrors := make([]error, len(names)) |
| 48 | numErrors := 0 |
| 49 | for _, name := range names { |
| 50 | err := c.Createscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Create().(name) |
| 51 | if err != nil { |
| 52 | tempErrors = append(tempErrors, err) |
| 53 | numErrors += 1 |
| 54 | continue |
| 55 | } |
| 56 | break |
| 57 | } |
| 58 | |
| 59 | copy(errors, tempErrors[0:numErrors]) |
| 60 | return |
| 61 | } |
| 62 | |
| 63 | // Dispatch returns Dispatch object. |
| 64 | func (c *Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Dispatch().() (object *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#, err error) { |
| 65 | dispatch, err := c.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Object..QueryInterfacescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IUnknown#QueryInterface().(IID_IDispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IID_IDispatch.) |
| 66 | if err != nil { |
| 67 | return |
| 68 | } |
| 69 | object = &Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#{dispatch} |
| 70 | return |
| 71 | } |
| 72 | |
| 73 | // Dispatch stores IDispatch object. |
| 74 | type Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch# struct { |
| 75 | Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object. *IDispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IDispatch# // Dispatch object. |
| 76 | } |
| 77 | |
| 78 | // Call method on IDispatch with parameters. |
| 79 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) Callscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Call().(method string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#, err error) { |
| 80 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(method) |
| 81 | if err != nil { |
| 82 | return |
| 83 | } |
| 84 | |
| 85 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_METHODscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_METHOD., params) |
| 86 | return |
| 87 | } |
| 88 | |
| 89 | // MustCall method on IDispatch with parameters. |
| 90 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) MustCallscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#MustCall().(method string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#) { |
| 91 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(method) |
| 92 | if err != nil { |
| 93 | panic(err) |
| 94 | } |
| 95 | |
| 96 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_METHODscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_METHOD., params) |
| 97 | if err != nil { |
| 98 | panic(err) |
| 99 | } |
| 100 | |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | // Get property on IDispatch with parameters. |
| 105 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) Getscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Get().(name string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#, err error) { |
| 106 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(name) |
| 107 | if err != nil { |
| 108 | return |
| 109 | } |
| 110 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_PROPERTYGETscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_PROPERTYGET., params) |
| 111 | return |
| 112 | } |
| 113 | |
| 114 | // MustGet property on IDispatch with parameters. |
| 115 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) MustGetscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#MustGet().(name string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#) { |
| 116 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(name) |
| 117 | if err != nil { |
| 118 | panic(err) |
| 119 | } |
| 120 | |
| 121 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_PROPERTYGETscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_PROPERTYGET., params) |
| 122 | if err != nil { |
| 123 | panic(err) |
| 124 | } |
| 125 | return |
| 126 | } |
| 127 | |
| 128 | // Set property on IDispatch with parameters. |
| 129 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) Setscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Set().(name string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#, err error) { |
| 130 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(name) |
| 131 | if err != nil { |
| 132 | return |
| 133 | } |
| 134 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_PROPERTYPUTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_PROPERTYPUT., params) |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | // MustSet property on IDispatch with parameters. |
| 139 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) MustSetscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#MustSet().(name string, params ...interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#) { |
| 140 | id, err := d.GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(name) |
| 141 | if err != nil { |
| 142 | panic(err) |
| 143 | } |
| 144 | |
| 145 | result, err = d.Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id, DISPATCH_PROPERTYPUTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/DISPATCH_PROPERTYPUT., params) |
| 146 | if err != nil { |
| 147 | panic(err) |
| 148 | } |
| 149 | return |
| 150 | } |
| 151 | |
| 152 | // GetId retrieves ID of name on IDispatch. |
| 153 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) GetIdscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetId().(name string) (id int32, err error) { |
| 154 | var dispid []int32 |
| 155 | dispid, err = d.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object..GetIDsOfNamescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IDispatch#GetIDsOfName().([]string{name}) |
| 156 | if err != nil { |
| 157 | return |
| 158 | } |
| 159 | id = dispid[0] |
| 160 | return |
| 161 | } |
| 162 | |
| 163 | // GetIds retrieves all IDs of names on IDispatch. |
| 164 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) GetIdsscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#GetIds().(names ...string) (dispid []int32, err error) { |
| 165 | dispid, err = d.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object..GetIDsOfNamescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IDispatch#GetIDsOfName().(names) |
| 166 | return |
| 167 | } |
| 168 | |
| 169 | // Invoke IDispatch on DisplayID of dispatch type with parameters. |
| 170 | // |
| 171 | // There have been problems where if send cascading params..., it would error |
| 172 | // out because the parameters would be empty. |
| 173 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Invoke().(id int32, dispatch int16, params []interface{}) (result *VARIANTscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/VARIANT#, err error) { |
| 174 | if len(params) < 1 { |
| 175 | result, err = d.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object..Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IDispatch#Invoke().(id, dispatch) |
| 176 | } else { |
| 177 | result, err = d.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object..Invokescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IDispatch#Invoke().(id, dispatch, params...) |
| 178 | } |
| 179 | return |
| 180 | } |
| 181 | |
| 182 | // Release IDispatch object. |
| 183 | func (d *Dispatchscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#) Releasescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Release().() { |
| 184 | d.Objectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Dispatch#Object..Releasescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/IUnknown#Release().() |
| 185 | } |
| 186 | |
| 187 | // Connect initializes COM and attempts to load IUnknown based on given names. |
| 188 | func Connectscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connect().(names ...string) (connection *Connectionscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#) { |
| 189 | connection.Initializescip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Initialize().() |
| 190 | connection.Loadscip-go gomod github.com/gofiber/fiber/v2 . `github.com/gofiber/fiber/v2/internal/go-ole`/Connection#Load().(names...) |
| 191 | return |
| 192 | } |