Click here to Skip to main content
15,892,298 members
Home / Discussions / COM
   

COM

 
QuestionCOM Transaction Support Pin
SakthiSurya28-Sep-07 0:34
SakthiSurya28-Sep-07 0:34 
Questionthreading And Distributed transaction Pin
Fadi Abu-Mathkour25-Sep-07 7:58
Fadi Abu-Mathkour25-Sep-07 7:58 
AnswerRe: threading And Distributed transaction Pin
User 21559726-Sep-07 0:36
User 21559726-Sep-07 0:36 
QuestionIXMLDOMAttribute::put_value Pin
IWannaTalk24-Sep-07 3:36
IWannaTalk24-Sep-07 3:36 
AnswerRe: IXMLDOMAttribute::put_value Pin
Nathan Holt at EMOM24-Sep-07 10:56
Nathan Holt at EMOM24-Sep-07 10:56 
GeneralRe: IXMLDOMAttribute::put_value [modified] Pin
IWannaTalk24-Sep-07 11:54
IWannaTalk24-Sep-07 11:54 
GeneralRe: IXMLDOMAttribute::put_value Pin
IWannaTalk25-Sep-07 23:35
IWannaTalk25-Sep-07 23:35 
GeneralRe: IXMLDOMAttribute::put_value Pin
Nathan Holt at EMOM26-Sep-07 12:40
Nathan Holt at EMOM26-Sep-07 12:40 
vippavlo wrote:
Do you know exactly that SAFEARRAY will be stored correct in attribute???
Because i have a problem when i put value into attribute: "Type mismatch". What it mean??? May be i create SAFEARRAY uncorrect???? If you have some example for putting CComSafeArray into CComVariant, please give me, i'll be much obliged to you.


I believe I mentioned in my last reply that you probably can't store an array in an XML attribute. Type mismatch is the error I'd expect if it wasn't allowed. You can probably define your own method to convert the array to and from a string, since string is the real type of the attribute anyway. While I'd just drop SAFEARRAYs for what you are doing, I've found an example of creating a SAFEARRAY in the MSDN documentation:

SAFEARRAYBOUND sab;
sab.cElements = 2;
sab.lLbound = 0;
hresult hr;

SAFEARRAY * pSa;
pSa = SafeArrayCreateEx(VT_RECORD, 1, &sab, pRecInfo);
if (pSa == NULL)
   return E_OUTOFMEMORY;

PVOID pvData;
hr = SafeArrayAccessData(pSa, &pvData);
if (FAILED(hr)) {
   SafeArrayDestroy(pSa);
   return hr;
}

TEST * pTest;
pTest = (TEST *)pvData;
pTest[0] = a;
pTest[1] = b;
hr = SafeArrayUnaccessData(pSa);
if (FAILED(hr)) {
   SafeArrayDestroy(pSa);
   return hr;
}

VariantInit(&variant);
V_VT(&variant) = VT_ARRAY|VT_RECORD;
V_ARRAY(&variant) = pSa;


This code uses basic COM functions instead of MFC, but CComVariant is designed to work with any function that takes a VARIANT. If you are using ATL, there is a CComSafeArray class that can simplify it some more.

Nathan
GeneralRe: IXMLDOMAttribute::put_value Pin
IWannaTalk27-Sep-07 4:12
IWannaTalk27-Sep-07 4:12 
Questionsimple helloworld program for caling java from c++ ! help ! Pin
amitamit19820-Sep-07 22:53
amitamit19820-Sep-07 22:53 
QuestionRun-Time Check Failure #0 Pin
donguy7620-Sep-07 16:38
donguy7620-Sep-07 16:38 
AnswerRe: Run-Time Check Failure #0 Pin
Nathan Holt at EMOM21-Sep-07 9:02
Nathan Holt at EMOM21-Sep-07 9:02 
QuestionUsing Com dll in ASP.NET gives Security error Pin
Chetan Patel19-Sep-07 18:48
Chetan Patel19-Sep-07 18:48 
QuestionAdding buttons to Explorer toolbar (Groove 'Folder sync' style) Pin
__DanC__19-Sep-07 4:31
__DanC__19-Sep-07 4:31 
QuestionWhy we need COM Pin
Nandu_77b18-Sep-07 3:17
Nandu_77b18-Sep-07 3:17 
AnswerRe: Why we need COM Pin
Nathan Holt at EMOM18-Sep-07 7:43
Nathan Holt at EMOM18-Sep-07 7:43 
GeneralRe: Why we need COM Pin
Nandu_77b19-Sep-07 5:31
Nandu_77b19-Sep-07 5:31 
GeneralRe: Why we need COM Pin
Baltoro4-Oct-07 12:44
Baltoro4-Oct-07 12:44 
QuestionAvoid hang of the component manager with com+ console messages [modified] Pin
Vider18-Sep-07 1:51
Vider18-Sep-07 1:51 
Questioncom and threading models,and a question about dlls? Pin
rozbeh18-Sep-07 0:18
rozbeh18-Sep-07 0:18 
AnswerRe: com and threading models,and a question about dlls? Pin
Nathan Holt at EMOM18-Sep-07 7:52
Nathan Holt at EMOM18-Sep-07 7:52 
QuestionCOM List over Network Pin
Fatbuddha 117-Sep-07 21:22
Fatbuddha 117-Sep-07 21:22 
Questionusing void ** in Interface Pin
tictactoer17-Sep-07 3:26
tictactoer17-Sep-07 3:26 
AnswerRe: using void ** in Interface Pin
Nathan Holt at EMOM17-Sep-07 9:59
Nathan Holt at EMOM17-Sep-07 9:59 
GeneralRe: using void ** in Interface Pin
tictactoer19-Sep-07 0:00
tictactoer19-Sep-07 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.