|
CMemFile is not a memory mapped file. It's a block of memory that conforms to the CFile interface, i.e., you can treat it as if it's a file.
True memory-mapped files are a different thing entirely.
|
|
|
|
|
I disagree. A CMemFile object is a memory file that behaves like a disk file except that the file is stored in RAM rather than on disk. A MMF, by definition, provides you with the capability to map a view of all or part of a file on disk to a specific range of addresses within your process's address space. Once that is done, accessing the content of it is as simple as dereferencing a pointer in the designated range of addresses. I fail to see how they are THAT different. In either case, once the file is read from disk and into memory, you operate on the file in its memory-mapped state, using the appropriate functions. The MSDN article Q142377 offers another view.
|
|
|
|
|
How do I send a carriage return and line feed through a serial port?
|
|
|
|
|
Do you know how to open and send data to a serial port using OpenFile() and WriteFile()??
char data[] = "\n\r";
DWORD dwBytesWritten;
WriteFile(hSerialPort,data,strlen(data),&dwBytesWritten,NULL);
John
|
|
|
|
|
John M. Drescher wrote:
char data[] = "\n\r";
Ummm, you might want to try "\r\n" instead
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Dear people:
I would like to be able to display the number of records of a table on the status bar and to jump to a record number based on user input. From what I read about Recordsets, this is impossible to do directly. Am I right? If so, how could I implement the above without having to traverse part of or the entire Recordset?
One idea I had for displaying the number of records was to use an auxiliary file that updates a variable every time an append or delete is done. This, however, would be quite messy if you have many tables and, of course, would not take care of my second issue of jumping to records. Thanks,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
RalfPeter wrote:
I would like to be able to display the number of records of a table on the status bar...
CRecordset::GetRecordCount() should work.
Jumping to a specific record is simply a matter of determining the difference between the current record number and the desired record number. If the difference is negative, you'll need to call CRecordset::MovePrev() X number of times. If the difference is positive, you'll need to call CRecordset::MoveNext() X number of times. After the moves are complete, then update the view.
You'll also want to consider the situation where there are 100 records and you want to jump to the 99th record. In this case, and others like it, it would be far less costly to jump to the last record and then call CRecordset::MovePrev() once rather than call CRecordset::MoveNext() 99 times!
|
|
|
|
|
Thank you for your reply. This was, however, my concern. From what you said, I will have to traverse at least part of the table. I was more like thinking of a table as an array. In an array, as you know, one may literally jump to an element, instead of skipping elements and eventually getting there. Correct me if I'm wrong, but the count in GetRecordCount is set to the highest-numbered record yet pointed to as you traverse the records. The total number of records is only known after moving past the last record. This is what I was trying to avoid. Thanks again,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
I have never used CRecordset (I use ADO) but there is an SQL statement that you can execute to get the record count and that is COUNT.
SELECT COUNT(*) FROM MyTable WHERE Clause
I don't know how to run SQL statements using CRecordset, so hopefully someone else would like to add to my post. Or probably you know the answer already.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
If one of the columns was a unique identifier, then you could jump right to that record.
As far as counting goes, some DBMSs return the high-water mark, while others return the actual count. You have to experiment with each one.
You could also look at CRecordset::SetAbsolutePosition(), but it is not considered reliable.
|
|
|
|
|
Sorry about the previous post. I thought you were trying to get the record count but you're not. Anyways, to get to the record that you want to, as DavidCrow suggested you could use unique identifiers. However, if you don't have unique identifiers, you can set filters and then the number of records that you have to iterate will be very small. More details you add to the filter, less records you will get.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
[EDIT: Whoops! I used WORD wParam insted of WPARAM wParam (this is not Win16 code)]
I have a list box control in a dialog with notify selected.
Now here is the problem: when I click on a selection the dialogbox receives a notification ( HIWORD(wParam) ) = 0 insted of = 1 (LBN_SELCHANGE). I have used listboxes and comboboxes for years and have always receive the correct value (1). 0 is not even a valid notification code (unless it's undocumented).
Any ideas?
INTP
|
|
|
|
|
I downloaded sample application and the source codes. I tried to run the application but
I couldn't. While I was compiling the codes, I met some problems. First of all psapi.h error.
I dowloaded psapi.h end psapi.lib files and placed include and lib in the folders. But
I read the Q&A part. atlsecurity.h file wasn't appeared. Whe I compiled the codes, I met some errors below.
I use VC6 and Win98 Second edition.
Can you say me how can I compile and the sample? Please describe as possible as simple. Because
I am new in VC6.
w32process.cpp(83) : error C2039: 'GetProcessImageFileName' : is not a member of '`global namespace''
w32process.cpp(83) : error C2065: 'GetProcessImageFileName' : undeclared identifier
w32pSample\w32process.cpp(100) : error C2065: '_alloca' : undeclared identifier
w32pSample\w32process.cpp(100) : error C2440: 'static_cast' : cannot convert from 'int' to 'struct _TOKEN_USER *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
w32pSample\w32process.cpp(395) : error C2039: 'OpenThread' : is not a member of '`global namespace''
w32pSample\w32process.cpp(395) : error C2065: 'OpenThread' : undeclared identifier
w32pSample\w32process.cpp(395) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Good bye.
|
|
|
|
|
Hi!
anyone here knows where I can find some info/samples (can be online or a book) about developing plugins for Exchange Server?
Thanks!
---------------
Tired of Spam? InboxShield 2.0.2 for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
http://www.slipstick.com/[^] used to be pretty good. I haven't visited for a while, so I don't know if it has changed.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I have an MFC ActiveX control and an MFC application that uses it. I use Visual C++ 6.0 on Windows NT 4.0 SP6.
I recently added a new property and a new method to the ActiveX control. The control compiled, linked, and registered just fine.
Then I went to the application project, regenerated the wrapper class for the control (Project->Add To Project->Components And Controls..., Registered ActiveX Controls), and rebuilt the app successfully...
But when I run the app, it gets COM Type Mismatch errors when it tries to access a property and a method that were already in the control before my modifications!
I compared the .odl file in the ActiveX control project with the previous version from SourceSafe, and the only changes made to the file were the new property and method I added, which my app isn't even trying to use yet.
I compared the wrapper class in my applicaton to the .odl file to make sure the property/method ID's and parameter/return types all match, and they do. I also looked up the DISPATCH_MAP entries for the misbehaving items in the control's source code - they match too.
And yes, I tried a Rebuild All on both projects - no effect.
Does anyone have any idea why these type mismatch errors are occurring or how I can avoid them?
This problem has me completely flabbergasted and my project has ground to a halt as a result. Any information that could help shed light on this problem would be greatly appreciated.
|
|
|
|
|
Is it possible to play sounds (such as MIDI or mp3 files from a console program?
Thanks, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
|
I'll study the info you sent me John, thanks much
Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
I've never tried it but would sndPlaySound() work?
|
|
|
|
|
DavidCrow wrote:
I've never tried it but would sndPlaySound() work?
Only for .WAV files. Using MCI will allow MIDI and MP3 files as well.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi,i am writing an activex control to print the webrowser content through MFC.i want to get the device context of the browserwindow exluding all the title bars etc..(only document of the browser)
my intention is to print completely the document of the browser which might pan horizontally multiple pages.
when i am using
GetWindowDC(browser handle) i am getting the complete screen(that is what this function does)is there a way for me to get just the document area,if i need to use getDC,how can i get the device context by passing the browser handle.i am confused.
please suggest me a solution
regds
GVS
gvs
|
|
|
|
|
hello people
I want to add a COMBO BOX or any other Windows control in a LIST CONTROL that is the COMBO BOX should appear as if it were an item of the LIST CONTROL
Regards
Ahmed Ajmal
|
|
|
|
|
|
MFC has a data type of _int64 but I just found out I can't serialize it...
I can read the low and high words and serialize them seperatly, but that's too much work.
Shay
|
|
|
|