-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scope and ole implementations revised
- Loading branch information
Showing
6 changed files
with
155 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package oleimpl | ||
|
||
import ( | ||
"github.com/zzl/go-com/ole" | ||
"github.com/zzl/go-win32api/win32" | ||
"syscall" | ||
) | ||
|
||
type BoundMethodDispImpl struct { | ||
ole.IDispatchImpl | ||
ownerDispObj *win32.IDispatch | ||
memberDispId int32 | ||
} | ||
|
||
func (this *BoundMethodDispImpl) GetIDsOfNames(riid *syscall.GUID, rgszNames *win32.PWSTR, | ||
cNames uint32, lcid uint32, rgDispId *int32) win32.HRESULT { | ||
return win32.DISP_E_UNKNOWNNAME | ||
} | ||
|
||
func (this *BoundMethodDispImpl) Invoke(dispIdMember int32, riid *syscall.GUID, | ||
lcid uint32, wFlags uint16, pDispParams *win32.DISPPARAMS, pVarResult *win32.VARIANT, | ||
pExcepInfo *win32.EXCEPINFO, puArgErr *uint32) win32.HRESULT { | ||
if dispIdMember == int32(win32.DISPID_VALUE) { | ||
return this.ownerDispObj.Invoke(this.memberDispId, riid, lcid, | ||
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr) | ||
} | ||
return win32.E_NOTIMPL | ||
} | ||
|
||
func (this *BoundMethodDispImpl) OnComObjFree() { | ||
this.ownerDispObj.Release() | ||
} | ||
|
||
func NewBoundMethodDispatch(pDispOwner *win32.IDispatch, memberDispId int32) *win32.IDispatch { | ||
pDisp := ole.NewIDispatchComObject(&BoundMethodDispImpl{ | ||
ownerDispObj: pDispOwner, | ||
memberDispId: memberDispId, | ||
}).IDispatch() | ||
return pDisp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.