-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDDEString.hpp
88 lines (73 loc) · 1.95 KB
/
DDEString.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: DDESTRING.HPP
** COMPONENT: Network & Comms Library
** DESCRIPTION: The CDDEString class declaration.
**
*******************************************************************************
*/
// Check for previous inclusion
#ifndef DDESTRING_HPP
#define DDESTRING_HPP
#if _MSC_VER > 1000
#pragma once
#endif
#include "DDEFwd.hpp"
////////////////////////////////////////////////////////////////////////////////
// The build agnostic definition to use for selecting the code page when using
// the DDE String functions.
#ifdef ANSI_BUILD
#define CP_WIN_TCHAR CP_WINANSI
#else
#define CP_WIN_TCHAR CP_WINUNICODE
#endif
/******************************************************************************
**
** This is a helper class for dealing with DDE string handles.
**
*******************************************************************************
*/
class CDDEString
{
public:
//
// Constructors/Destructor.
//
CDDEString(CDDEInst* pInst, const tchar* pszString, bool bOwn = true);
CDDEString(CDDEInst* pInst, HSZ hsz, bool bOwn = false);
~CDDEString();
//
// Operators.
//
operator HSZ() const;
operator const tchar*() const;
protected:
// Max length of string (as per DDE documentation).
enum { MAX_LENGTH = 255 };
//
// Members.
//
CDDEInst* m_pInst; // The instance handle.
HSZ m_hsz; // The string handle.
bool m_bOwn; // Ownership flag.
tchar m_sz[MAX_LENGTH+1]; // Original string.
// Disallow copies.
CDDEString(const CDDEString&);
void operator=(const CDDEString&);
};
/******************************************************************************
**
** Implementation of inline functions.
**
*******************************************************************************
*/
inline CDDEString::operator HSZ() const
{
return m_hsz;
}
inline CDDEString::operator const tchar*() const
{
return m_sz;
}
#endif // DDESTRING_HPP