當前位置: 首頁>>代碼示例>>Golang>>正文


Golang wrappers.FAILED函數代碼示例

本文整理匯總了Golang中github.com/winlabs/gowin32/wrappers.FAILED函數的典型用法代碼示例。如果您正苦於以下問題:Golang FAILED函數的具體用法?Golang FAILED怎麽用?Golang FAILED使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FAILED函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TranslateADName

func TranslateADName(name string, fromType ADNameType, toType ADNameType) (string, error) {
	var object uintptr
	hr := wrappers.CoCreateInstance(
		&wrappers.CLSID_NameTranslate,
		nil,
		wrappers.CLSCTX_INPROC_SERVER,
		&wrappers.IID_IADsNameTranslate,
		&object)
	if wrappers.FAILED(hr) {
		return "", NewWindowsError("CoCreateInstance", COMError(hr))
	}
	trans := (*wrappers.IADsNameTranslate)(unsafe.Pointer(object))
	defer trans.Release()
	if hr := trans.Init(wrappers.ADS_NAME_INITTYPE_GC, nil); wrappers.FAILED(hr) {
		return "", NewWindowsError("IADsNameTranslate::Init", COMError(hr))
	}
	nameRaw := wrappers.SysAllocString(syscall.StringToUTF16Ptr(name))
	defer wrappers.SysFreeString(nameRaw)
	if hr := trans.Set(int32(fromType), nameRaw); wrappers.FAILED(hr) {
		return "", NewWindowsError("IADsNameTranslate::Set", COMError(hr))
	}
	var outRaw *uint16
	if hr := trans.Get(int32(toType), &outRaw); wrappers.FAILED(hr) {
		return "", NewWindowsError("IADsNameTranslate::Get", COMError(hr))
	}
	return BstrToString(outRaw), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:27,代碼來源:adtranslate.go

示例2: NewEnumerator

func (self *FirewallRuleCollection) NewEnumerator() (*FirewallRuleEnumerator, error) {
	if self.object == nil {
		return nil, NewWindowsError("INetFwRules::get__NewEnum", COMErrorPointer)
	}
	var punkEnumerator *wrappers.IUnknown
	if hr := self.object.Get__NewEnum(&punkEnumerator); wrappers.FAILED(hr) {
		return nil, NewWindowsError("INetFwRules::get__NewEnum", COMError(hr))
	}
	defer punkEnumerator.Release()
	var enumerator uintptr
	if hr := punkEnumerator.QueryInterface(&wrappers.IID_IEnumVARIANT, &enumerator); wrappers.FAILED(hr) {
		return nil, NewWindowsError("IUnknown::QueryInterface", COMError(hr))
	}
	return &FirewallRuleEnumerator{object: (*wrappers.IEnumVARIANT)(unsafe.Pointer(enumerator))}, nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:15,代碼來源:firewall.go

示例3: GetSpecialFolderPath

func GetSpecialFolderPath(folder SpecialFolder) (string, error) {
	buf := [wrappers.MAX_PATH]uint16{}
	if hr := wrappers.SHGetFolderPath(0, uint32(folder), 0, 0, &buf[0]); wrappers.FAILED(hr) {
		return "", NewWindowsError("SHGetFolderPath", COMError(hr))
	}
	return syscall.UTF16ToString((&buf)[:]), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:7,代碼來源:shell.go

示例4: GetKnownFolderPath

func GetKnownFolderPath(folder KnownFolder) (string, error) {
	var path *uint16
	if hr := wrappers.SHGetKnownFolderPath((*wrappers.GUID)(&folder), 0, 0, &path); wrappers.FAILED(hr) {
		return "", NewWindowsError("SHGetKnownFolderPath", COMError(hr))
	}
	defer wrappers.CoTaskMemFree((*byte)(unsafe.Pointer(path)))
	return LpstrToString(path), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:8,代碼來源:shell.go

示例5: SetProtocol

func (self *FirewallRule) SetProtocol(protocol FirewallProtocol) error {
	if self.object == nil {
		return NewWindowsError("INetFwRule::put_Protocol", COMErrorPointer)
	}
	if hr := self.object.Put_Protocol(int32(protocol)); wrappers.FAILED(hr) {
		return NewWindowsError("INetFwRule::put_Protocol", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例6: Skip

func (self *FirewallRuleEnumerator) Skip(count uint) error {
	if self.object == nil {
		return NewWindowsError("IEnumVARIANT::Skip", COMErrorPointer)
	}
	if hr := self.object.Skip(uint32(count)); wrappers.FAILED(hr) {
		return NewWindowsError("IEnumVARIANT::Skip", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例7: SetAction

func (self *FirewallRule) SetAction(action FirewallAction) error {
	if self.object == nil {
		return NewWindowsError("INetFwRule::put_Action", COMErrorPointer)
	}
	if hr := self.object.Put_Action(int32(action)); wrappers.FAILED(hr) {
		return NewWindowsError("INetFwRule::put_Action", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例8: SetEdgeTraversal

func (self *FirewallRule) SetEdgeTraversal(enabled bool) error {
	if self.object == nil {
		return NewWindowsError("INetFwRule::put_EdgeTraversal", COMErrorPointer)
	}
	if hr := self.object.Put_EdgeTraversal(enabled); wrappers.FAILED(hr) {
		return NewWindowsError("INetFwRule::put_EdgeTraversal", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例9: Reset

func (self *FirewallRuleEnumerator) Reset() error {
	if self.object == nil {
		return NewWindowsError("IEnumVARIANT::Reset", COMErrorPointer)
	}
	if hr := self.object.Reset(); wrappers.FAILED(hr) {
		return NewWindowsError("IEnumVARIANT::Reset", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例10: Add

func (self *FirewallRuleCollection) Add(rule *FirewallRule) error {
	if self.object == nil {
		return NewWindowsError("INetFwRules::Add", COMErrorPointer)
	}
	if hr := self.object.Add(rule.object); wrappers.FAILED(hr) {
		return NewWindowsError("INetFwRules::Add", COMError(hr))
	}
	return nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:9,代碼來源:firewall.go

示例11: GetEdgeTraversal

func (self *FirewallRule) GetEdgeTraversal() (bool, error) {
	if self.object == nil {
		return false, NewWindowsError("INetFwRule::get_EdgeTraversal", COMErrorPointer)
	}
	var enabled bool
	if hr := self.object.Get_EdgeTraversal(&enabled); wrappers.FAILED(hr) {
		return false, NewWindowsError("INetFwRule::put_EdgeTraversal", COMError(hr))
	}
	return enabled, nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:10,代碼來源:firewall.go

示例12: GetGrouping

func (self *FirewallRule) GetGrouping() (string, error) {
	if self.object == nil {
		return "", NewWindowsError("INetFwRule::get_Grouping", COMErrorPointer)
	}
	var contextRaw *uint16
	if hr := self.object.Get_Grouping(&contextRaw); wrappers.FAILED(hr) {
		return "", NewWindowsError("INetFwRule::get_Grouping", COMError(hr))
	}
	return BstrToString(contextRaw), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:10,代碼來源:firewall.go

示例13: GetAction

func (self *FirewallRule) GetAction() (FirewallAction, error) {
	if self.object == nil {
		return 0, NewWindowsError("INetFwRule::get_Action", COMErrorPointer)
	}
	var actionRaw int32
	if hr := self.object.Get_Action(&actionRaw); wrappers.FAILED(hr) {
		return 0, NewWindowsError("INetFwRule::get_Action", COMError(hr))
	}
	return FirewallAction(actionRaw), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:10,代碼來源:firewall.go

示例14: GetDescription

func (self *FirewallRule) GetDescription() (string, error) {
	if self.object == nil {
		return "", NewWindowsError("INetFwRule::get_Description", COMErrorPointer)
	}
	var descRaw *uint16
	if hr := self.object.Get_Description(&descRaw); wrappers.FAILED(hr) {
		return "", NewWindowsError("INetFwRule::get_Description", COMError(hr))
	}
	return BstrToString(descRaw), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:10,代碼來源:firewall.go

示例15: GetRemoteAddresses

func (self *FirewallRule) GetRemoteAddresses() (string, error) {
	if self.object == nil {
		return "", NewWindowsError("INetFwRule::get_RemoteAddresses", COMErrorPointer)
	}
	var remoteAddrsRaw *uint16
	if hr := self.object.Get_RemoteAddresses(&remoteAddrsRaw); wrappers.FAILED(hr) {
		return "", NewWindowsError("INetFwRule::get_RemoteAddresses", COMError(hr))
	}
	return BstrToString(remoteAddrsRaw), nil
}
開發者ID:winlabs,項目名稱:gowin32,代碼行數:10,代碼來源:firewall.go


注:本文中的github.com/winlabs/gowin32/wrappers.FAILED函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。