質問編集履歴
2
ReadStringの定義を書き間違えていました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,11 +20,12 @@
|
|
20
20
|
return _result;
|
21
21
|
}
|
22
22
|
|
23
|
-
|
23
|
+
inline _bstr_t IMessage::ReadString ( long count ) {
|
24
24
|
BSTR _result = 0;
|
25
25
|
HRESULT _hr = raw_ReadString(count, &_result);
|
26
26
|
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
|
27
27
|
return _bstr_t(_result, false);
|
28
|
+
}
|
28
29
|
```
|
29
30
|
|
30
31
|
```
|
1
プログラムソースの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,4 +25,36 @@
|
|
25
25
|
HRESULT _hr = raw_ReadString(count, &_result);
|
26
26
|
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
|
27
27
|
return _bstr_t(_result, false);
|
28
|
+
```
|
29
|
+
|
30
|
+
```
|
31
|
+
int _tmain(int argc, _TCHAR* argv[])
|
32
|
+
{
|
33
|
+
IMessagePtr spMsg;
|
34
|
+
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
35
|
+
HRESULT hr;
|
36
|
+
IResourceManager3Ptr spRM;
|
37
|
+
hr = spRM.CreateInstance(CLSID_ResourceManager);
|
38
|
+
|
39
|
+
spMsg = spRM->Open(L"TCPIP::192.168.1.1::inst0::INSTR", NO_LOCK, 0, L"");
|
40
|
+
|
41
|
+
SAFEARRAY* pSA = NULL;
|
42
|
+
|
43
|
+
|
44
|
+
int r;
|
45
|
+
|
46
|
+
r = spMsg->WriteString(L"OUTP 1 \n");
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
r = spMsg->WriteString(L"VOLT 15.0 \n");
|
51
|
+
//spMsg->ReadString(256);
|
52
|
+
|
53
|
+
|
54
|
+
spMsg->Close(); //閉じる
|
55
|
+
return 0;
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
|
28
60
|
```
|