1// Copyright 2010-2012 The W32 Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build windows
6
7package w32
8
9import (
10	"syscall"
11	"unsafe"
12)
13
14var (
15	modcomdlg32 = syscall.NewLazyDLL("comdlg32.dll")
16
17	procGetSaveFileName      = modcomdlg32.NewProc("GetSaveFileNameW")
18	procGetOpenFileName      = modcomdlg32.NewProc("GetOpenFileNameW")
19	procCommDlgExtendedError = modcomdlg32.NewProc("CommDlgExtendedError")
20)
21
22func GetOpenFileName(ofn *OPENFILENAME) bool {
23	ret, _, _ := procGetOpenFileName.Call(
24		uintptr(unsafe.Pointer(ofn)))
25
26	return ret != 0
27}
28
29func GetSaveFileName(ofn *OPENFILENAME) bool {
30	ret, _, _ := procGetSaveFileName.Call(
31		uintptr(unsafe.Pointer(ofn)))
32
33	return ret != 0
34}
35
36func CommDlgExtendedError() uint {
37	ret, _, _ := procCommDlgExtendedError.Call()
38
39	return uint(ret)
40}
41