Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++/CLI
New to this programming stuff. Personal project going on and I am not sure if I am getting the results I am looking for.
I am using visual studio pro, windows forms.
I want to know is it possible to send messages to the listbox display as a result dialog.
            hr = m_directoutput.GetDeviceType(hDevice, &typeguid);
            if (FAILED(hr))
                // flag this error
How do I send this error message to the listbox, Better yet, what do you call this action in a manner to which I can get more information in doing this using google?
I have searched all over and still no answer.
Thanks in advance
Posted 15-Nov-11 10:55am
Edited 15-Nov-11 13:59pm
SAKryukov at 15-Nov-11 17:04pm
Tab your UI library: WPF, Forms, what? The answer depends on it.
Nishant Sivakumar at 15-Nov-11 18:17pm
SA, he says he is using Winforms.
SAKryukov at 15-Nov-11 20:43pm
Aha, thanks.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Since you are using Winforms, the easiest approach is to have a form with a single ListBox (docked to fill the form), and send it strings that are added to the ListBox. And no, this is not an unusual approach at all. Logging listboxes have been popular since the Win16 days.
You have tagged your question with C++/CLI, so I would suggest that you use _com_error[^] to convert the hresult to a formatted error message string.
SAKryukov at 15-Nov-11 20:45pm
Sure, a 5. Another problem is thread safety of it which needs Control.Invoke or Control.BeginInvoke.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342

Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 15 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100