During the creation of my Combo Box I entered the data into it for selection of the User. How do I find out what the User selected?
Please provide some code please.(VS 6.0 and VS 2008 C++)
A C++ programming language novice, but striving to learn
When the user changes the selected item, the parent will receive a CBN_SELCHANGE
notification (in a WM_COMMAND message). In response to that notification,
or at some other time you need the selected item from the combo box, you
could do something like this:
LRESULT SelectedIndex = SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0);
if (CB_ERR != SelectedIndex)
LRESULT StringLength = SendMessage(hwndComboBox, CB_GETLBTEXTLEN, SelectedIndex, 0);
TCHAR *pSelectedString = new TCHAR[StringLength + 1];
SendMessage(hwndComboBox, CB_GETLBTEXT, SelectedIndex, (LPARAM)pSelectedString);
//...//... do something with the string ...//...
All Windows controls have associated messages used to manipulate them. Unless you
have them all memoized, I recommend keeping a link to this: Windows Controls[^]
or know where to find it in your local documentation.
Well i dun ve visual studio 08. But i can provide you a help in visual studio 6.0.
Now as you have already entered data to the combo box.Add new variable for the Combo Box in class wizard. it can be of type VALUE or CONTROL. Let it be VALUE and type CString. This variable will hold the data present in the Combo Box.Let the variable is ComboBox_Variable.
Now to check what user has selected, you can put a simple event in your program which will help in finding what user has selected from the box.
so you can add a button which will show a simple messagebox depending on the combo box data. Like a button named "Message".
Add an event handler for it and you can use the following code.
CString example;<br />
example = ComboBox_Variable;<br />
MessageBox("Data-1 selected by user");<br />
MessageBox("Data-2 selected by user");<br />
You can use switch statement too!
I hope Combo Box will be clear to you now!
I have DVD-Compliant Mpeg-2 Files that I am interested in "turning" into .Vob files.
I know that these are basically the same and that the difference is in the "headers" of these two file types.
All of the Third-Party SDK's i have found demux and remux the mpeg before converting it to .vob.
I know that there are open-source libraries that create vob files and unofficial specifications for .vob files but for something so simple how can there not be a library or sdk that can save me the troubles?
Bottom line - I am looking for Code\module\dll\sdk that converts Dvd-Compliant Mpeg-2 files to .vob files.
_text is a char*. The const member promises not to change any of the member variables. Your first assignment changes _text to point to a different string. The second assignment (in the loop) does not change _text, but the content of the string that _text points to (btw, I assume that _text has been assigned to a valid string at some point in code not shown, otherwise the second assignment will corrupt your memory).
const pointers can point to mutable objects. You may change content of the object, but not the content of the pointer.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
"Of course, the next day it automatically updates, and your quick'n'dirty patches cause the new binaries to segfault all over your linoleum. If only you'd had the source..." Shog, 10/18/2006
"One day I realized that sadness is just another word for not enough coffee" Wally, 10/18/2006
I have run this logic on turboc++ 3.0 and it is working fine on it but
its not running on msvs2008 c++.
the code does this::
the fun strrep takes 3 char arrays the i.e main,sub,rep.
the sub array is to be found out i the main array and if found its index is taken on found pos,(this is achieved by the searchsub function separately)
then the sub array is replaced in the main array by the rep array,and the rep array can be of different size from the sub array.
i am not able to assign the value like this *temp=*main,where main and
temp are char pointers.
there is a runtime access violation error on msvs..that i am not
able to work out how to resolve..
kind attention and feedback would be invaluable for me...
thanks...the code is as below..
<code>// C++Test.cpp : Defines the entry point for the console application.
Firstly i dont want to use any of the inbuilt functions.
secondly why cant i increase the memory space for the main char pointer if the rep>sub,as i think that pointers do give a programmer this ability.. or should i allocate a new memory space using new operator and then carry out the operations on main pointer??
and why this can be done without errors on turbo c++ 3.0 and not in msvs2008 c++??
If I try to add some thing in my sample project the error displays like this:-> c:\documents and settings\administrator\desktop\mitumori\mitu\jpeg.h(21) : error C2370: 'kJFIF' : redefinition; different storage class
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Hi, if I start up a new dialog using DialogBox, how do I get access to its message pump (GetMessage, PeekMessage, or whatever it uses)? This is without MFC.
The problem is that I have a dialog that I load up that has a lot of other controls on it, and I need to access the messages for those controls specifically (like catching a WM_MOUSEMOVE on a listbox, etc).
I found the default wrapping behavior by Graphics::DrawString to be incompatible with the wrapping behavior of some legacy apps and it was impossible to achieve some other required functionality without resorting to handling the wrapping manually.
With that said, I am having a rough time with the fact that GDI+ insists on measuring the '\n' character during output. This makes paragraph output, centered aligned, come out a bit off. I can remove the StringFormatFlagsMeasureTrailingSpaces flag but then any trailing spaces do not get measured. This is a word processor so text selection measurements must match the text output for text selection feedback.
Is there a way, without drawing each line individually, to somehow get GDI+ to ignore the '\n' character in measurements and when calculating center alignment but to still wrap on them? Is there another "newline" character that gets measured with a zero width?
This article here: http://www.codeproject.com/KB/miscctrl/AppControl.aspx shows how you can host external window on your application if you have handle to the window. It uses this piece of code to host the window:
// Put it into this form
// Remove border and whatnot
SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE);
What I want to do is to be able to release the hosted window after some time. In order to do that I use GetParent() function to get handle of previous parent and then restore it again but I'm stuck with SetWindowLong part. Any ideas?
am writting a C++ application and I need to access my resource file really i use function
LoadLibrary() and it returns ahandle to the dll successfully but when I use the function
FindResource() and give it the resource id that I want to use it returns NULL, although when i use GetLastError() it tells that function endded successfully !!!.
Here I wanna tell something this code is successfull code when I use it on concole application, but when I write it on the citrix endpoint analysis SDK and generate the exe file when I run the exe simply it gives that FindResource() returns NULL,
Please can any one help???
1 - can i pass the exe name to LoadLibrary() ??
2 - FindResource problem ??
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-23 11:56