|
Just for clarification, you are reading from a drive rather than an actual file. Given that, I would guess that 48 bytes is not a sector-aligned value, which I think is a requirement of the buffer. Try 512 and see what happens.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yea it works when I do it with sector aligned values, I didn't know that you needed to do this to directly access the drive. I guess I will just have to read into buffers then copy to my structures. Thanks.
-- Rocky Dean Pulley
|
|
|
|
|
i think yr application is not anble to find the EOF character
the size of file might be greater . The buffer is allocated memory at run time only, when buffer is assigned some value and if the memory size increases it throws run time exception. This is not is case of static allocation As the memory is predefined.
Rahul Agarwal
|
|
|
|
|
Hi All,
I m building as application in VC++.It requires to read file names with a specific extension from a directory.
Can anyone tell me about any such function or method to perform this.I have tried other sources also but not found some usful stuff.
thanks
|
|
|
|
|
Look in MSDN for WIN32_FIND_DATA, FindFirstFile, FindNextFile, FindClose.
-- Rocky Dean Pulley
|
|
|
|
|
thanks for ur help now I able to do this using WIN32_FIND_DATA, FindFirstFile, FindNextFile, FindClose
|
|
|
|
|
|
Use the FindFirstFile() /FindNextFile() pair, or the CFileFind class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
My text on-screen and printed looks fine, but if I save a metafile picture and import it into Microsoft Word, then Word will scale the picture. So my 10 point fonts become 5 point (say). When printed from MSWord, the picture has text with poor horizontal spacing between individual characters. This seems to be particularly noticeable with bold fonts.
Sometimes I'm using CDC:DrawText and sometimes CDC:ExtTextOut. Both cases have this problem.
What issues am I unaware of? What steps (if any) can I take to avoid this?
many thanks
Steve
|
|
|
|
|
I do beleive this is in fact an issue with Word. It re-interprets the metafile the first time its loaded in and gets it wrong.
I have found in the past if you then try and edit the metafile in word and actually change nothing, it will then get the fonts correct.
If you vote me down, my score will only get lower
|
|
|
|
|
hotdog!... you're right!
now that's made me pause for thought.
The downside (apart from needing this edit-picture operation) is that the picture gets converted into a zillion independently-selectable elements, so you can no longer apply an overall scale to the picture after editing, though maybe I could group all elements, and then scale (I really need to learn how to use Word's picture editing features<g>).
Curiously, an older version of our software (using different mapping + text output) and using WMFs rather than EMFs doesn't have this problem.
Still, many thanks for the pointer - at least I now have a tolerable workaround to the issue.
|
|
|
|
|
I'm having some difficulties with creating a dialog from resource.
When using the default proc, the app breaks on stack overflow
ret=DialogBox(hInstance,MAKEINTRESOURCE(IDD_PREFERENCES),hWnd,(DLGPROC)DefDlgProc);
When using a custom proc, the function returns -1, and last error returns "The specified resource type cannot be found in the image file."
ret=DialogBox(hInstance,MAKEINTRESOURCE(IDD_PREFERENCES),hWnd,(DLGPROC)TestProc);
hInstance and hWnd are both valid. And I do have a dialog with id=IDD_PREFERENCES in my resource. Dunno what's going on...
Somebody?
using: [VISUAL STUDIO .NET] [WINXP PRO SP2]
|
|
|
|
|
A couple ideas:
1. Is the hInstance the hInstance of the DLL or your EXE that contains the resource?
2. Does the language of the resource match that of your current thread? Sometimes it will try to load a resource only in the language that your thread is running in, and that can fail.
|
|
|
|
|
Hello,
I am facing a problem. I want to use a CDialog(with lots of controls on it) at 2 palces. At one place with the style WS_POPUP and at another place with the style WS_CHILD. Now one solution is to make a copy of the orignal dialog(the one with WS_POPUP) and change the style of copied CDialog to WS_CHILD. But i dont want to do this...want to use the same dialog....
I want to know if its possible to change the dialog template(and change the style in to WS_CHILD before making the second dialog).
Thanks..
|
|
|
|
|
Have you used ClassWizard to define a class for the Dialog? If so, you may be able to use PreCreateWindow to modify the creation flags, depending on how you plan to use the Dialog.
Bob Ciora
|
|
|
|
|
It doesnt work. Any thing else that i should try ?
|
|
|
|
|
I have 3 list controls layered on top of each other, all over a bitmapped background (dialog app). When a user clicks a button/tab/menu item, one shows, the other two hide, which produces flicker.
These list controls use a derived double buffered class, but the flicker is apparently occuring in the call to the hide/show window call. I've tried using AnimateWindow, but since I paint the list controls background, and use a custom header control, it overrides those changes.
Any ideas on how to implement this better to get rid of the flicker?
Thanx,
Rick
|
|
|
|
|
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
|
|
|
|