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
92
93
94
95
96
97
98
99
100
101
102
|
// $Id$
#include "stdafx.h"
#include "NamingViewer.h"
#include "BindDialog.h"
#include "ViewIORDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBindDialog dialog
CBindDialog::CBindDialog(bool Context, CORBA::ORB_ptr pORB, CWnd* pParent /*=NULL*/)
: CDialog(CBindDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CBindDialog)
m_IOR = _T("");
m_ID = _T("");
m_Kind = _T("");
//}}AFX_DATA_INIT
m_pORB = pORB;
m_Context = Context;
}
void CBindDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBindDialog)
DDX_Text(pDX, IDC_IOR, m_IOR);
DDX_Text(pDX, IDC_ID, m_ID);
DDX_Text(pDX, IDC_KIND, m_Kind);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBindDialog, CDialog)
//{{AFX_MSG_MAP(CBindDialog)
ON_BN_CLICKED(IDC_VIEWIOR, OnViewior)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBindDialog message handlers
void CBindDialog::OnViewior()
{
// TODO: Add your control notification handler code here
try
{
UpdateData();
m_Object = m_pORB->string_to_object(ACE_TEXT_ALWAYS_CHAR (m_IOR));
}
catch(CORBA::Exception& ex)
{
MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception"));
return;
}
ViewIORDialog Dialog(m_pORB, m_Object);
Dialog.DoModal();
}
BOOL CBindDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(m_Context)
{
SetWindowText(ACE_TEXT ("Bind Context"));
}
else
{
SetWindowText(ACE_TEXT ("Bind Object"));
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBindDialog::OnOK()
{
// TODO: Add extra validation here
UpdateData();
m_Name.length(1);
m_Name[0].id = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (m_ID));
m_Name[0].kind = CORBA::string_dup(ACE_TEXT_ALWAYS_CHAR (m_Kind));
try
{
m_Object = m_pORB->string_to_object(ACE_TEXT_ALWAYS_CHAR (m_IOR));
}
catch(CORBA::Exception& ex)
{
MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("Invalid IOR"));
return;
}
CDialog::OnOK();
}
|