|
You can try this:
int maxArray = sizeof(myarray)/sizeof(long);
later
...er - well I guess the max index would be that - 1 ...
|
|
|
|
|
Why don't you use STL vector instead of "plain" array?
I vote pro drink
|
|
|
|
|
How do I sort DaoRecordsets on a numeric field?
m_pSet->m_strSort="[My long Field]"; gives a sort, but it appears to alpha-numeric, not numeric.
All help apperciated!
Richard
|
|
|
|
|
The problem is that m_strSort only returns the name of the fields or fields that were includes in the Order By if you opened the recordset with a Query.
For example if you open de recordset with some like this:
Select * from table Order by field1, field2
The m_strSort will return you 'field1, field2'.
For make a order in a table you will need to use CDaoRecordset::SetCurrentIndex but the problem is that the field must be a index.
Did you Understand?
Cheers.
Carlos Antollini.
|
|
|
|
|
Suppose I have 2 pens created like these:
CPen m_pPenR, m_pPenN;
m_pPenR.CreatePen(PS_SOLID,3,RGB(255,0,0));
m_pPenN.CreatePen(PS_SOLID,3,RGB(255,150,0));
...
more code
...
pDC->SelectObject(m_pPenR);
myGraphic (a,b,pDC);
...
more code
...
pDC->SelectObject(m_pPenN);
myGraphic (c,d,pDC);
...
And into myGraphic(...) function I want to use the selected pens, drawing some lines but changing sometimes one or two of pens parameters (for example I want it with PS_DOT and width=1pixel, but remaining the color) and sometimes don´t.
How can I do it?
Thank you.
|
|
|
|
|
Hi all,
Does anyone know how to transfer the unsigned char to char AND how to transfer the char to unsigned char???
I know it is stupid......;P
Thanks
|
|
|
|
|
Do you just want to assign between two variables? Then use casts:
signed char ch = -1;
unsigned char uch = (unsigned char) ch;
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Hi. I have a big problem about my application like a Windows Commander. When I have folder and folder has too many files, when I double-click to folder, I must wait about 10 and more seconds to open a folder. I need any optimization idea to find file operation - need file parameters and file icon (I used two methods - use ::FindFirstFile, ::FileNextFile and second method is use CFileFind). Thanks Ivan
|
|
|
|
|
I love this Place. I came to Codeproject.com with this question and here it is!
Thanx alot!
Enzi
|
|
|
|
|
Everybody's seen default buttons (that click when enter is pressed) in dialog boxes, but now I have a toolbar button that I would like to act this way. There is an edit ctrl in the toolbar, and when the user types a value they should be able to press enter if they're too lazy to click on the button. Ideas?
thanks,
Jake
|
|
|
|
|
If you are fairly certain this can not be done, can you let me know, because my boss has been bugging me about it for over a week I've told him I can't do it, and I need some backup from you guys. thanks,
Jake
|
|
|
|
|
I would think it is possible to do this by making a custom command bar with your edit control and button. You could then capture the keydown events and check for enter.
|
|
|
|
|
I think you can just derive a class from CToolBar, override PreTranslateMessage, and do something like this:
/*********************************************************************/
BOOL CYourToolbar::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) {
//
// Call the handler for the button
//
return TRUE;
}
else
return CToolbar::PreTranslateMessage( pMsg );
}
I'm not totally sure. This is hacked from some other project... but you might give it a try.
|
|
|
|
|
My team is having an odd problem:
We are getting severe slowdowns when typing in largeish files: 2, 3 sometimes as long as four seconds when hitting Return.
It seems to be limited to fairly large source files (3,000 or more lines, but I haven't narrowed down the threshold yet).
And if we close the workspace, then there is no problem at all with performance. Reopen the workspace, and the slowdowns are back. So, it's clearly something in Visual Studio.
Some facts about what we're doing:
- Our workspace is large with hundreds of .cp files and more than a thousand .h files broken up into "folders" within the workspace.
- In fairly large files, typing can be very slow: 2, 3 even four seconds of a "pause" when hitting return
- Task Manager does show CPU spikes during this activity
- We are running P3 733 dual CPU Compaq AP550 workstations
- If we close the workspace, typing performance is normal and does not exhibit the slowdowns
- Generate Browse Info is turned off in Project Settings | C++
- Build Browse Info file is turned off in Project Settings | Browse Info
- We are no longer using USERTYPE.DAT for user defined keywords, the file does not even exist
- We are using SourceSafe for source control, but SourceSafe itself is not open at the time of these slowdowns
- All four of the VS "statement completion options" in Options | Editor are off (Auto list members, auto type info, etc.)
- The VS "auto indent" feature in Options | Tabs seems to make no difference: we've tried None, Default and Smart
- We are using Visual C++ 6.0 SP5
- We are not using any other AddIns other than DevTrueColor to patch the color menus to allow us any color in the syntax color chooser
- I've search MSDN and the KB as much as I can, but can't find anything
Any ideas would be very much appreciated.
--
Bryan
|
|
|
|
|
Some information was sent to me offline...
OK, my search on Knowledge Base failed because I search for "slow typing". But... Q202591 "Developer Studio Source and Dialog Editors Respond Slowly":
"When editing source code or a dialog resource with the Visual C++ version 6.0 source or resource editors, the user may experience a slowdown in performance. The resource editor shows a noticeable delay when tabbing between controls. In the source editor, the cursor seems to hesitate when passing through function definitions when using the arrow keys. In both instances the CPU usage is near or at 100%. "
This sounds exactly like my problem so I'll pursue this. Thanks!
--
Bryan
|
|
|
|
|
I've been looking for a function on MSDN that will let me get a percentage of the system's cpu usage, but to no avail Anything similar to this, like a struct that could let me calculate the percent usage would be just as helpful!
|
|
|
|
|
Anyone know how to change or assign a color to a CRectTracker? Thanks.
|
|
|
|
|
Subclass it, add the apropriate get/set methods and overide the Draw method to use your brushes.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
How to call by cl.a button another exe programs?
Thank's.
|
|
|
|
|
|
Hi,
I've created a singleton object as described in Gof4,- but I get LNK2001 error-the constructor can't be called because it is protected.
I'm using VC++ 6 sp5.
Any ideas?
|
|
|
|
|
Any ideas?
Just like linker tells you - constructor is protected. You're trying to instantiate singleton outside its class. Read Gof4 again and look into their Instance() method implementation.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Ok, I reviewed the implemention of Instance(), and I'm still having trouble.
interface:
class S {
public:
static S* Instance();
protected:
S();
private:
static S* _instance;
};
implementation:
S* S::_instance = 0;
S* S::Instance(){
if (_instance==0){
_instance = new S;
}
return _instance;
}
Am I using the static member function wrong?
Thanks.
|
|
|
|
|
Have you *defined* the constructor (not merely declared it)?
|
|
|
|
|
Thanks. That did it. I will try to refrain from posting completely idiotic questions here in the future, if at all possible.
|
|
|
|