This repository has been archived by the owner on Nov 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recipient.cs
executable file
·91 lines (81 loc) · 2.89 KB
/
recipient.cs
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
89
90
91
/*---------------------------------------------------------------------
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation. See these other
materials for detailed information regarding Microsoft code samples.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
----------------------------------------------------------------------- *
* File: Recipient.cs
*
* Purpose: managed representation of the IRecipient object
*
*
* Notes:
*
*/
namespace PocketOutlook
{
using System;
using System.Runtime.InteropServices;
public class Recipient
{
private Application m_application;
private IntPtr m_pIRecipient;
internal Recipient(Application application, IntPtr pIRecipient)
{
m_application = application;
m_pIRecipient = pIRecipient;
}
public String Address
{
get
{
String zAddress = null;
IntPtr bz = new IntPtr(0);
int hResult = do_get_Address(m_pIRecipient,
ref bz);
try
{
PocketOutlook.CheckHRESULT(hResult);
}
finally
{
PocketOutlook.SysFreeString(bz);
}
return zAddress;
}
set
{
PocketOutlook.CheckHRESULT(do_put_Address(m_pIRecipient, value));
}
}
public String Name
{
get
{
String zName = null;
IntPtr bz = new IntPtr(0);
int hResult = do_get_Name(m_pIRecipient,
ref bz);
try
{
PocketOutlook.CheckHRESULT(hResult);
}
finally
{
PocketOutlook.SysFreeString(bz);
}
return zName;
}
}
[DllImport("PocketOutlook.dll", EntryPoint="IRecipient_get_Address")]
private static extern int do_get_Address(IntPtr pIRecipient, ref IntPtr rbzAddress);
[DllImport("PocketOutlook.dll", EntryPoint="IRecipient_get_Name")]
private static extern int do_get_Name(IntPtr pIRecipient, ref IntPtr rbzName);
[DllImport("PocketOutlook.dll", EntryPoint="IRecipient_put_Address")]
private static extern int do_put_Address(IntPtr pIRecipient, String zAddress);
} // class Recipient
}