xref: /aoo42x/main/sal/inc/systools/win32/shell9x.h (revision 9eab2a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #pragma once
25 
26 #ifndef _SHELL9X_H_
27 #define _SHELL9X_H_
28 
29 #ifndef _WINDOWS_
30 #include <windows.h>
31 #endif
32 
33 #ifndef _SHLOBJ_H_
34 #include <shlobj.h>
35 #endif
36 
37 #include <shellapi.h>
38 
39 #ifdef __cplusplus
40 extern "C"{
41 #endif
42 
43 //------------------------------------------------------------------------
44 // undefine the macros defined in the shlobj.h file in order to avoid
45 // warnings because of multiple defines
46 //------------------------------------------------------------------------
47 
48 #ifdef CommandLineToArgvW
49 #undef CommandLineToArgvW
50 #endif
51 
52 #ifdef SHBrowseForFolderW
53 #undef SHBrowseForFolderW
54 #endif
55 
56 #ifdef SHGetPathFromIDListW
57 #undef SHGetPathFromIDListW
58 #endif
59 
60 #ifdef ShellExecuteExW
61 #undef ShellExecuteExW
62 #endif
63 
64 //------------------------------------------------------------------------
65 // set the compiler directives for the function pointer we declare below
66 // if we build sal or sal will be used as static library we define extern
67 // else sal exports the function pointers from a dll and we use __declspec
68 //------------------------------------------------------------------------
69 
70 #define SHELL9X_API extern
71 
72 //------------------------------------------------------------------------
73 // declare function pointers to the appropriate shell functions
74 //------------------------------------------------------------------------
75 
76 SHELL9X_API LPWSTR *     ( WINAPI * lpfnCommandLineToArgvW ) ( LPCWSTR lpCmdLine, int *pNumArgs );
77 SHELL9X_API LPITEMIDLIST ( WINAPI * lpfnSHBrowseForFolderW ) ( LPBROWSEINFOW lpbi );
78 SHELL9X_API BOOL         ( WINAPI * lpfnSHGetPathFromIDListW ) ( LPCITEMIDLIST pidl, LPWSTR pszPath );
79 
80 SHELL9X_API BOOL ( WINAPI * lpfnShellExecuteExW ) ( LPSHELLEXECUTEINFOW lpExecInfo );
81 
82 //------------------------------------------------------------------------
83 // redefine the above undefined macros so that the preprocessor replaces
84 // all occurrences of this macros with our function pointer
85 //------------------------------------------------------------------------
86 
87 #define CommandLineToArgvW   lpfnCommandLineToArgvW
88 #define SHBrowseForFolderW   lpfnSHBrowseForFolderW
89 #define SHGetPathFromIDListW lpfnSHGetPathFromIDListW
90 
91 #define ShellExecuteExW lpfnShellExecuteExW
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
98