Click here to Skip to main content
13,055,047 members (63,169 online)
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)
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 9:55am
Updated 15-Nov-11 12:59pm
SAKryukov 15-Nov-11 17:04pm
Tab your UI library: WPF, Forms, what? The answer depends on it.
Nishant Sivakumar 15-Nov-11 18:17pm
SA, he says he is using Winforms.
SAKryukov 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 15 Nov 2011
Copyright © CodeProject, 1999-2017
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