本文整理汇总了Golang中github.com/lxn/win.FAILED函数的典型用法代码示例。如果您正苦于以下问题:Golang FAILED函数的具体用法?Golang FAILED怎么用?Golang FAILED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FAILED函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setTheme
func (wb *WindowBase) setTheme(appName string) error {
if hr := win.SetWindowTheme(wb.hWnd, syscall.StringToUTF16Ptr(appName), nil); win.FAILED(hr) {
return errorFromHRESULT("SetWindowTheme", hr)
}
return nil
}
开发者ID:henrylee2cn,项目名称:walk,代码行数:7,代码来源:window.go
示例2: SetURLWithPost
func (wv *WebView) SetURLWithPost(url string, postData netUrl.Values) error {
return wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
urlBstr := win.StringToVariantBSTR(url)
flags := win.IntToVariantI4(0)
targetFrameName := win.StringToVariantBSTR("_self")
postStr := ""
for k, v := range postData {
if len(v) == 1 {
postStr += k + "=" + netUrl.QueryEscape(v[0]) + "&"
} else {
for i, _v := range v {
postStr += k + "[" + strconv.Itoa(i) + "]=" + netUrl.QueryEscape(_v) + "&"
}
}
}
postStr = postStr[:len(postStr)-1]
postBstr := unsafe.Pointer(win.StringToVariantBSTR(postStr))
if hr := webBrowser2.Navigate2(urlBstr, flags, targetFrameName, postBstr, nil); win.FAILED(hr) {
return errorFromHRESULT("IWebBrowser2.Navigate2", hr)
}
return nil
})
}
开发者ID:joy999,项目名称:walk,代码行数:29,代码来源:webview.go
示例3: SetCompleted
func (pi *ProgressIndicator) SetCompleted(completed uint32) error {
if hr := pi.taskbarList3.SetProgressValue(pi.hwnd, completed, pi.total); win.FAILED(hr) {
return errorFromHRESULT("ITaskbarList3.SetProgressValue", hr)
}
pi.completed = completed
return nil
}
开发者ID:2105666566,项目名称:walk,代码行数:7,代码来源:progressindicator.go
示例4: SetState
func (pi *ProgressIndicator) SetState(state PIState) error {
if hr := pi.taskbarList3.SetProgressState(pi.hwnd, (int)(state)); win.FAILED(hr) {
return errorFromHRESULT("ITaskbarList3.setprogressState", hr)
}
pi.state = state
return nil
}
开发者ID:2105666566,项目名称:walk,代码行数:7,代码来源:progressindicator.go
示例5: Refresh
func (wv *WebView) Refresh() error {
return wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
if hr := webBrowser2.Refresh(); win.FAILED(hr) {
return errorFromHRESULT("IWebBrowser2.Refresh", hr)
}
return nil
})
}
开发者ID:joy999,项目名称:walk,代码行数:9,代码来源:webview.go
示例6: withWebBrowser2
func (wv *WebView) withWebBrowser2(f func(webBrowser2 *win.IWebBrowser2) error) error {
var webBrowser2Ptr unsafe.Pointer
if hr := wv.browserObject.QueryInterface(&win.IID_IWebBrowser2, &webBrowser2Ptr); win.FAILED(hr) {
return errorFromHRESULT("IOleObject.QueryInterface", hr)
}
webBrowser2 := (*win.IWebBrowser2)(webBrowser2Ptr)
defer webBrowser2.Release()
return f(webBrowser2)
}
开发者ID:joy999,项目名称:walk,代码行数:10,代码来源:webview.go
示例7: GetDocument
func (wv *WebView) GetDocument(iDispatch unsafe.Pointer) error {
return wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
if hr := webBrowser2.Get_Document(iDispatch); win.FAILED(hr) {
return errorFromHRESULT("IWebBrowser2.GetDocument", hr)
}
return nil
})
}
开发者ID:joy999,项目名称:walk,代码行数:10,代码来源:webview.go
示例8: GetBodyHTML
func (wv *WebView) GetBodyHTML() (bodyHTML string, err error) {
bodyHTML = ""
err = nil
wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
var doc win.IHTMLDocument2
if hr := webBrowser2.Get_Document(unsafe.Pointer(&(doc.LpVtbl))); win.FAILED(hr) || doc.LpVtbl == nil {
err = errorFromHRESULT("IWebBrowser2.GetDocument", hr)
return err
}
var elt win.IHTMLElement
if hr := doc.GetBody(&elt); win.FAILED(hr) || elt.LpVtbl == nil {
err = errorFromHRESULT("IHTMLElement.GetBody", hr)
return err
}
var cs *uint16
if hr := elt.Get_innerHTML(&cs); win.FAILED(hr) {
err = errorFromHRESULT("IHTMLElement.Get_innerHTML", hr)
return err
}
if cs != nil {
us := make([]uint16, 0, 256)
for p := uintptr(unsafe.Pointer(cs)); ; p += 2 {
u := *(*uint16)(unsafe.Pointer(p))
if u == 0 {
bodyHTML = syscall.UTF16ToString(us)
break
}
us = append(us, u)
}
}
return nil
})
return
}
开发者ID:joy999,项目名称:walk,代码行数:42,代码来源:webview.go
示例9: SetURL
func (wv *WebView) SetURL(url string) error {
return wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
urlBstr := win.StringToVariantBSTR(url)
flags := win.IntToVariantI4(0)
targetFrameName := win.StringToVariantBSTR("_self")
if hr := webBrowser2.Navigate2(urlBstr, flags, targetFrameName, nil, nil); win.FAILED(hr) {
return errorFromHRESULT("IWebBrowser2.Navigate2", hr)
}
return nil
})
}
开发者ID:joy999,项目名称:walk,代码行数:13,代码来源:webview.go
示例10: URL
func (wv *WebView) URL() (url string, err error) {
err = wv.withWebBrowser2(func(webBrowser2 *win.IWebBrowser2) error {
var urlBstr *uint16 /*BSTR*/
if hr := webBrowser2.Get_LocationURL(&urlBstr); win.FAILED(hr) {
return errorFromHRESULT("IWebBrowser2.Get_LocationURL", hr)
}
defer win.SysFreeString(urlBstr)
url = win.BSTRToString(urlBstr)
return nil
})
return
}
开发者ID:joy999,项目名称:walk,代码行数:15,代码来源:webview.go
示例11: webView_IOleInPlaceSite_OnPosRectChange
func webView_IOleInPlaceSite_OnPosRectChange(inPlaceSite *webViewIOleInPlaceSite, lprcPosRect *win.RECT) uintptr {
browserObject := inPlaceSite.inPlaceFrame.webView.browserObject
var inPlaceObjectPtr unsafe.Pointer
if hr := browserObject.QueryInterface(&win.IID_IOleInPlaceObject, &inPlaceObjectPtr); win.FAILED(hr) {
return uintptr(hr)
}
inPlaceObject := (*win.IOleInPlaceObject)(inPlaceObjectPtr)
defer inPlaceObject.Release()
return uintptr(inPlaceObject.SetObjectRects(lprcPosRect, lprcPosRect))
}
开发者ID:Fruchtgummi,项目名称:walk,代码行数:11,代码来源:webview_ioleinplacesite.go
示例12: NewWebView
func NewWebView(parent Container) (*WebView, error) {
if hr := win.OleInitialize(); hr != win.S_OK && hr != win.S_FALSE {
return nil, newError(fmt.Sprint("OleInitialize Error: ", hr))
}
wv := &WebView{
clientSite: webViewIOleClientSite{
IOleClientSite: win.IOleClientSite{
LpVtbl: webViewIOleClientSiteVtbl,
},
inPlaceSite: webViewIOleInPlaceSite{
IOleInPlaceSite: win.IOleInPlaceSite{
LpVtbl: webViewIOleInPlaceSiteVtbl,
},
inPlaceFrame: webViewIOleInPlaceFrame{
IOleInPlaceFrame: win.IOleInPlaceFrame{
LpVtbl: webViewIOleInPlaceFrameVtbl,
},
},
},
docHostUIHandler: webViewIDocHostUIHandler{
IDocHostUIHandler: win.IDocHostUIHandler{
LpVtbl: webViewIDocHostUIHandlerVtbl,
},
},
webBrowserEvents2: webViewDWebBrowserEvents2{
DWebBrowserEvents2: win.DWebBrowserEvents2{
LpVtbl: webViewDWebBrowserEvents2Vtbl,
},
},
},
}
if err := InitWidget(
wv,
parent,
webViewWindowClass,
win.WS_CLIPCHILDREN|win.WS_VISIBLE,
0); err != nil {
return nil, err
}
wv.clientSite.inPlaceSite.inPlaceFrame.webView = wv
succeeded := false
defer func() {
if !succeeded {
wv.Dispose()
}
}()
var classFactoryPtr unsafe.Pointer
if hr := win.CoGetClassObject(&win.CLSID_WebBrowser, win.CLSCTX_INPROC_HANDLER|win.CLSCTX_INPROC_SERVER, nil, &win.IID_IClassFactory, &classFactoryPtr); win.FAILED(hr) {
return nil, errorFromHRESULT("CoGetClassObject", hr)
}
classFactory := (*win.IClassFactory)(classFactoryPtr)
defer classFactory.Release()
var browserObjectPtr unsafe.Pointer
if hr := classFactory.CreateInstance(nil, &win.IID_IOleObject, &browserObjectPtr); win.FAILED(hr) {
return nil, errorFromHRESULT("IClassFactory.CreateInstance", hr)
}
browserObject := (*win.IOleObject)(browserObjectPtr)
wv.browserObject = browserObject
if hr := browserObject.SetClientSite((*win.IOleClientSite)(unsafe.Pointer(&wv.clientSite))); win.FAILED(hr) {
return nil, errorFromHRESULT("IOleObject.SetClientSite", hr)
}
if hr := browserObject.SetHostNames(syscall.StringToUTF16Ptr("Walk.WebView"), nil); win.FAILED(hr) {
return nil, errorFromHRESULT("IOleObject.SetHostNames", hr)
}
if hr := win.OleSetContainedObject((*win.IUnknown)(unsafe.Pointer(browserObject)), true); win.FAILED(hr) {
return nil, errorFromHRESULT("OleSetContainedObject", hr)
}
var rect win.RECT
win.GetClientRect(wv.hWnd, &rect)
if hr := browserObject.DoVerb(win.OLEIVERB_SHOW, nil, (*win.IOleClientSite)(unsafe.Pointer(&wv.clientSite)), -1, wv.hWnd, &rect); win.FAILED(hr) {
return nil, errorFromHRESULT("IOleObject.DoVerb", hr)
}
var cpcPtr unsafe.Pointer
if hr := browserObject.QueryInterface(&win.IID_IConnectionPointContainer, &cpcPtr); win.FAILED(hr) {
return nil, errorFromHRESULT("IOleObject.QueryInterface(IID_IConnectionPointContainer)", hr)
}
cpc := (*win.IConnectionPointContainer)(cpcPtr)
defer cpc.Release()
var cp *win.IConnectionPoint
if hr := cpc.FindConnectionPoint(&win.DIID_DWebBrowserEvents2, &cp); win.FAILED(hr) {
return nil, errorFromHRESULT("IConnectionPointContainer.FindConnectionPoint(DIID_DWebBrowserEvents2)", hr)
}
defer cp.Release()
var cookie uint32
//.........这里部分代码省略.........
开发者ID:joy999,项目名称:walk,代码行数:101,代码来源:webview.go
示例13: newTaskbarList3
//newTaskbarList3 precondition: Windows version is at least 6.1 (yes, Win 7 is version 6.1).
func newTaskbarList3(hwnd win.HWND) (*ProgressIndicator, error) {
var classFactoryPtr unsafe.Pointer
if hr := win.CoGetClassObject(&win.CLSID_TaskbarList, win.CLSCTX_ALL, nil, &win.IID_IClassFactory, &classFactoryPtr); win.FAILED(hr) {
return nil, errorFromHRESULT("CoGetClassObject", hr)
}
var taskbarList3ObjectPtr unsafe.Pointer
classFactory := (*win.IClassFactory)(classFactoryPtr)
defer classFactory.Release()
if hr := classFactory.CreateInstance(nil, &win.IID_ITaskbarList3, &taskbarList3ObjectPtr); win.FAILED(hr) {
return nil, errorFromHRESULT("IClassFactory.CreateInstance", hr)
}
return &ProgressIndicator{taskbarList3: (*win.ITaskbarList3)(taskbarList3ObjectPtr), hwnd: hwnd}, nil
}
开发者ID:2105666566,项目名称:walk,代码行数:17,代码来源:progressindicator.go
注:本文中的github.com/lxn/win.FAILED函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论