1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*40df464eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*40df464eSAndrew Rist * distributed with this work for additional information
6*40df464eSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*40df464eSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist * with the License. You may obtain a copy of the License at
10*40df464eSAndrew Rist *
11*40df464eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*40df464eSAndrew Rist *
13*40df464eSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist * software distributed under the License is distributed on an
15*40df464eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist * KIND, either express or implied. See the License for the
17*40df464eSAndrew Rist * specific language governing permissions and limitations
18*40df464eSAndrew Rist * under the License.
19*40df464eSAndrew Rist *
20*40df464eSAndrew Rist *************************************************************/
21*40df464eSAndrew Rist
22*40df464eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir
25cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
26cdf0e10cSrcweir #include "precompiled_svl.hxx"
27cdf0e10cSrcweir #define _SVTOOLS_SVDDE_DDEWRAP_CXX_
28cdf0e10cSrcweir
29cdf0e10cSrcweir #if defined _MSC_VER
30cdf0e10cSrcweir #pragma warning(push, 1)
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <windows.h>
33cdf0e10cSrcweir #if defined _MSC_VER
34cdf0e10cSrcweir #pragma warning(pop)
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include "ddewrap.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir //------------------------------------------------------------------------
39cdf0e10cSrcweir
DdeCreateStringHandleW_9x(DWORD idInst,LPCWSTR pszString,int)40cdf0e10cSrcweir HSZ WINAPI DdeCreateStringHandleW_9x( DWORD idInst, LPCWSTR pszString, int )
41cdf0e10cSrcweir {
42cdf0e10cSrcweir HSZ hszResult;
43cdf0e10cSrcweir LPSTR pszANSIString;
44cdf0e10cSrcweir int nSize;
45cdf0e10cSrcweir
46cdf0e10cSrcweir nSize = pszString ? WideCharToMultiByte( CP_ACP, 0, pszString, -1, NULL, 0, NULL, NULL ) : 0;
47cdf0e10cSrcweir pszANSIString = nSize ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, nSize * sizeof(CHAR) ) : NULL;
48cdf0e10cSrcweir
49cdf0e10cSrcweir if ( pszANSIString )
50cdf0e10cSrcweir WideCharToMultiByte( CP_ACP, 0, pszString, -1, pszANSIString, nSize, NULL, NULL );
51cdf0e10cSrcweir
52cdf0e10cSrcweir hszResult = DdeCreateStringHandleA( idInst, pszANSIString, CP_WINANSI );
53cdf0e10cSrcweir
54cdf0e10cSrcweir if ( pszANSIString )
55cdf0e10cSrcweir HeapFree( GetProcessHeap(), 0, pszANSIString );
56cdf0e10cSrcweir
57cdf0e10cSrcweir return hszResult;
58cdf0e10cSrcweir }
59cdf0e10cSrcweir
60cdf0e10cSrcweir //------------------------------------------------------------------------
61cdf0e10cSrcweir
DdeQueryStringW_9x(DWORD idInst,HSZ hsz,LPWSTR pszString,DWORD cchMax,int)62cdf0e10cSrcweir DWORD WINAPI DdeQueryStringW_9x( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int )
63cdf0e10cSrcweir {
64cdf0e10cSrcweir DWORD dwResult;
65cdf0e10cSrcweir LPSTR pszANSIString;
66cdf0e10cSrcweir
67cdf0e10cSrcweir pszANSIString = cchMax ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, cchMax * sizeof(CHAR) ) : NULL;
68cdf0e10cSrcweir
69cdf0e10cSrcweir dwResult = DdeQueryStringA( idInst, hsz, pszANSIString, cchMax, CP_WINANSI );
70cdf0e10cSrcweir
71cdf0e10cSrcweir if ( dwResult && pszANSIString )
72cdf0e10cSrcweir MultiByteToWideChar( CP_ACP, 0, pszANSIString, -1, pszString, cchMax );
73cdf0e10cSrcweir
74cdf0e10cSrcweir if ( pszANSIString )
75cdf0e10cSrcweir HeapFree( GetProcessHeap(), 0, pszANSIString );
76cdf0e10cSrcweir
77cdf0e10cSrcweir return dwResult;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
80cdf0e10cSrcweir //------------------------------------------------------------------------
81cdf0e10cSrcweir
DdeInitializeW_9x(LPDWORD pidInst,PFNCALLBACK pfnCallback,DWORD afCmd,DWORD ulRes)82cdf0e10cSrcweir UINT WINAPI DdeInitializeW_9x( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir return DdeInitializeA( pidInst, pfnCallback, afCmd, ulRes );
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir //------------------------------------------------------------------------
88cdf0e10cSrcweir
89cdf0e10cSrcweir #define DEFINE_WAPI_FUNC(func) \
90cdf0e10cSrcweir func##_PROC lpfn##func = (LONG)GetVersion() >= 0 ? func : func##_9x;
91cdf0e10cSrcweir
92cdf0e10cSrcweir
93cdf0e10cSrcweir DEFINE_WAPI_FUNC( DdeCreateStringHandleW );
94cdf0e10cSrcweir DEFINE_WAPI_FUNC( DdeQueryStringW );
95cdf0e10cSrcweir DEFINE_WAPI_FUNC( DdeInitializeW );
96cdf0e10cSrcweir
97