|
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
|
|
|
|
|
Shay Harel wrote:
I can read the low and high words and serialize them seperatly, but that's too much work.
If MFC does not searialize _int64 you must do it seperatly.
John
|
|
|
|
|
Shay Harel wrote:
MFC has a data type of _int64...
This should read "Microsoft has a data type of _int64..."
Shay Harel wrote:
I can read the low and high words and serialize them seperatly, but that's too much work.
Actually I believe those are DWORDs, which CArchive does know how to handle, but here's a piece of code that might work for you:
char szNum[64];
if (ar.IsStoring())
{
sprintf(szNum, "%I64u", m_i64MyBigNumber);
ar.Write(szNum, sizeof(szNum));
}
else
{
ar.Read(szNum, sizeof(szNum));
m_i64MyBigNumber = _atoi64(szNum);
}
|
|
|
|
|
I use the << and >> operators.
What I did is tricky, I just broke it to 2 ints and serialized them one after the other, but I will try your stuff as well.
|
|
|
|
|
You can always call the Read and Write methods of CArchive, passing a pointer to your int64. EX:
void CMyClass::Serialize(CArchive &ar)
{
if (ar.IsStoring())
{
ar.Write((void *)&m_i64MyBigInt,sizeof(_int64));
}
else
{
ar.Read((void *)&m_i64MyBigInt,sizeof(_int64));
}
}
Using the Read and Write methods allows you to serialize "non-serializable" data (non-mfc data containers).
onwards and upwards...
|
|
|
|
|
Hello,
I am working on an application where I get passed a list of line segments. I want to convert the line segments into polygons. Anybody have a reference to an algorithm or code fragment that can do this? Anybody have a quick sketch of an algorithm to do this. Thanks for any ideas.
Craig
|
|
|
|
|
BOOL Polygon(
HDC hdc, // handle to DC
CONST POINT *lpPoints, // polygon vertices
int nCount // count of polygon vertices
);
or am I missing something?
INTP
|
|
|
|