質問編集履歴
2
ReadStringの定義を書き間違えていました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
-
_t IMessage::ReadString ( long count ) {
|
45
|
+
inline _bstr_t IMessage::ReadString ( long count ) {
|
46
46
|
|
47
47
|
BSTR _result = 0;
|
48
48
|
|
@@ -51,6 +51,8 @@
|
|
51
51
|
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
|
52
52
|
|
53
53
|
return _bstr_t(_result, false);
|
54
|
+
|
55
|
+
}
|
54
56
|
|
55
57
|
```
|
56
58
|
|
1
プログラムソースの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -53,3 +53,67 @@
|
|
53
53
|
return _bstr_t(_result, false);
|
54
54
|
|
55
55
|
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
int _tmain(int argc, _TCHAR* argv[])
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
IMessagePtr spMsg;
|
66
|
+
|
67
|
+
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
68
|
+
|
69
|
+
HRESULT hr;
|
70
|
+
|
71
|
+
IResourceManager3Ptr spRM;
|
72
|
+
|
73
|
+
hr = spRM.CreateInstance(CLSID_ResourceManager);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
spMsg = spRM->Open(L"TCPIP::192.168.1.1::inst0::INSTR", NO_LOCK, 0, L"");
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
SAFEARRAY* pSA = NULL;
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
int r;
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
r = spMsg->WriteString(L"OUTP 1 \n");
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
r = spMsg->WriteString(L"VOLT 15.0 \n");
|
100
|
+
|
101
|
+
//spMsg->ReadString(256);
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
spMsg->Close(); //閉じる
|
108
|
+
|
109
|
+
return 0;
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
```
|