|
I use MFC, and I need to read files from cd-disk and automatically know the letter (D: or E: or F: ...) of cd-rom.
Can anybody help me?
Thanks in advance.
|
|
|
|
|
Use GetLogicalDrives() and then use GetDriveType() to get the media type of each drive letter (in your case its DRIVE_CDROM).
This way you can find all the CD-ROM drives present.
If you vote me down, my score will only get lower
|
|
|
|
|
Thank you, Roger. I've just solved my problem in other way. But I'm sure, you had helped me.
Aleksey.
|
|
|
|
|
I'm trying to create a program that will populate a listbox (or combobox) from a text file. If additional data can be stored in the text file (for assigning numeric attributes to the items in the menu), that would be great, but for now, I'll be happy with populating the box.
First of all. I dont know which one is the better choice for this.
I am successfully populating the listbox with a text file. I used this solution: http://www.codeproject.com/combobox/listboxsafe.asp[^]... but the darned thing is displaying more than one selection per line. Not good.(BTW: Text file is arranged with one item per line.)
I have 1 week to wrap this program up for my school project, and I am really stuck. (Searched the tutorials, but I guess Im stupid.)
What I need is to be pointed in the right direction. I need to know what functions to employ on what kind of box.
Thank you in advance for any pointers!
Im going to sleep. Ive been working on this all night.
Travis
|
|
|
|
|
A combobox is a control that combines an edit control with a list box. This allows the user to type in an entry or choose one from the list. When the selection is made, the list disappears (but doesn't have to). A list box is a control that enables the user to choose one (or more) option(s) from a list of possibilities. The list has a scroll bar if there are more options than the list has room to show. They are both populated in much the same way. One occupies a bit more screen real estate than the other.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for your reply!
I see. So it sounds like a listbox is what I need to use. Is there a short and fast method for populating the listbox? Like: m_myVariable.function() ?
Ive been exposed to a programming routine that uses if statements to change the value of a variable based on the users selection from a combo box. It looks like this:
<br />
if(m_option.GetCurSel() == 0)<br />
{<br />
dblTotal += 1.0;<br />
}<br />
if(m_option.GetCurSel() == 1)<br />
{<br />
dblTotal += 2.0;<br />
}<br />
if(m_option.GetCurSel() == 2)<br />
{<br />
dblTotal += 3.0;<br />
}<br />
if(m_option.GetCurSel() == 3)<br />
{<br />
dblTotal += 4.0;<br />
}<br />
...is the method the same for the listbox?
Travis
|
|
|
|
|
macrophobia wrote:
Is there a short and fast method for populating the listbox? Like: m_myVariable.function() ?
If you are using MFC, see the AddString() and InsertString() methods of the CListBox class. Otherwise, send the control a LB_ADDSTRING or LB_INSERTSTRING message.
GetCurSel() can be used with both comboboxes and listboxes. For your specific example, I would shorten it to:
dblTotal += (m_option.GetCurSel() + 1);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Im sorry if Im slower than most
I dont understand how the AddString() or InsertString() functions allow me to pull data from a text file. The Dynamic Help pages only give examples of directly populating the listbox.
Are these funtions used to populate with data from a text file?
Travis
|
|
|
|
|
It's not a matter of being slow, it's a matter of asking the right question. You wanted to know how to populate a combobox or listbox. To read from a file, look at the CFile and CStdioFile classes.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i want play a sentences one after other without using getstatus function of direct sound
if anybody has info. plz reply soon
|
|
|
|
|
I have lots of bitmap images collected in a folder. I want to import these images into Resource with their file names. When I import all images,Visual Studio give IDs to them like IDB_BITMAP1,etc. Then I have to change their IDs to names.
How can I make this easier?
Is using file names for the images the best(fastes) way to deal with images?
|
|
|
|
|
use the resourse editor....just load in ur bitmaps and they will directly be assigned a resourse name.....
well the images (resourses) are handles by the resourse id.....so i think itz faster the other way round
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
I don't think there's an "intelligent" way within VS to have the ID reflect the name of the bitmaps; you could do a very simple program that generate IDs based on the file name, and make a text that you could paste into the resource file.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hello !
I would like to know if it is possible to use the interruptions (with the MFC's, win32 application or console application) ? Specially the serial interruptions. If yes, how can they be used ?
Thanks
|
|
|
|
|
No, it not possible with MFC or API. Only you can create your developed driver by Microsoft or any other (OSR) Device Driver Kit (DDK).
|
|
|
|
|
Hi everyone,
I am trying to write a wav file from the audio data buffers (using WAVEHDR). My intention is to write one block of this 'filled' audio data (from an input device) into a wave file.
I have researched on this and know several things about the wave file header, riffs, etc, and I also have searched through codeproject.com and found some sample codes of writing wave file, but they did not provide sufficient explanations (but they are working! *GREAT*).
Thus, if anyone can help me with an introduction of how to write a wave file using the above method I have described earlier, please post-it here. I certainly appreciate it. Or, if you have any url that links to a website with this kind of tutorial, please post-it here also!
Thank you so much.
NOTE: Anyway, I am using MS VS VC++ .NET 2003
anaknakal
|
|
|
|
|
Hi all! I want to create a list view dialog. It has performance with a left column has some icons and the right is the space displays content of icons in the left. Any one can help me ??? anyone can give me a sample similar like that ????
Best regard
You can try until you die!
|
|
|
|
|
Using AppWizard, create a dialog-based project, and add a list control to the dialog template. Is that what you had in mind?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hai,
Can i disable the One Page/Two Page button in the print preview window?
pls help with a sample code.
thank u...
|
|
|
|
|
This buttonshould automatically be disaed when you have 1 or less pages of output to print.
Typically you set the number of pages to print in OnPreparePrinting()
pInfo->SetMaxPage(1);
should disable the button, as you only have 1 page of output.
If you vote me down, my score will only get lower
|
|
|
|
|
...but, my print is having more than 1 page and i dont want the users to have this 1/2 page button facility.
i used a code like this (i put in in OnPrint() ), but crashed.
if( pInfo != NULL)
{
if (pInfo->m_bPreview)
{
CButton* p = (CButton*)GetWindow(GW_CHILD);//AFX_ID_PREVIEW_NUMPAGE
p->EnableWindow(FALSE);
}
}
is there any solution?
or is it a bad practice to try to modify fremework's buttons?
thanking u,
|
|
|
|
|
I have a menu and I want to check/uncheck a particular option. I got it working once but it now it either crashes the app or doesn't work at all. I haven't changed the menu structure or anything.
The menu has 4 main items, "File", "View", "Action", "Help" in that order from left to right. Under "Action", I have "Analyze" and "Transmit" in that order from top to bottom. Finally, in a submenu under "Transmit", I have "Open Port", "Transmit Data", a seperator, then "Options" from top to bottom. The "Open Port" menu item is the one I want checked and unchecked when the port is open or not. The menu ID of that item is "ID_TRANSMIT_OPENPORT".
In my code in InitInstance, I have this:
m_pMainWnd = pFrame;<br />
CMenu *cm_mainMenu = pFrame->GetMenu();<br />
m_transmitMenu = cm_mainMenu->GetSubMenu(2);
m_transmitMenu is a pointer to a CMenu type in the app class
and when I want to check the menu, I have the command:
m_transmitMenu->CheckMenuItem(ID_TRANSMIT_OPENPORT, MF_BYCOMMAND | MF_CHECKED);
I tried switching it to by position instead of command, but I get no change. I tried to debug it and in InitInstance, the value of m_transmitMenu looks valid. However, by the time it should check the item, m_transmitMenu has a valid memory address, but inside it, the menu handle, m_hMenu, points to 0xfeeefeee which isn't valid. Anyone know what I can try to fix this, I'm just spinning my wheels. Thanks in advance, Nate.
I have a thread issue to work out too, which I may illicit the help of you guys and gals later if I run out of things to try.
|
|
|
|
|
|
Actually, I am going to make an MFC application in which an user can draw a DFD(Data Flow Diagram).Practically it will be analogous to a normal "paint" program.But the difference is that ,it will consist of a circle tool ,to draw a process,which must be clickable so that if the process is multilevel,it can show up the inner DFD of the concerned process when clicked,in a child dialog.
Would please let me know the steps in VC++!!
My another problem is how can I implement a tool(same as TEXT button tool in MS PAINT) which can be used to put down a text at runtime in the user's pointed location within user's drawable area?
|
|
|
|
|
I believe MFC does it by using CRegions you might want to just create an object that contains a CRegion as well as the information on your various objects, then you can either write a simple psuedo handler in OnLButtonDown, or a more complex system within the object itself.
|
|
|
|