|
Thanks for you response, but it didn´t help:
int nItem = m_Liste.GetNextSelectedItem(pos);
m_Liste.SetItemState( nItem, LVS_EX_FULLROWSELECT,
LVS_EX_FULLROWSELECT | LVIS_FOCUSED);
m_Liste.EnsureVisible( nItem, FALSE);
|
|
|
|
|
When your ListView control is first created or attached to (like in CDialog::OnInitDialog(...) ):
m_Liste.SetExtendedStyle( LVS_EX_FULLROWSELECT );
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
All right, I´ve got it. Thanks a lot.
m_Liste.SetExtendedStyle( LVS_EX_FULLROWSELECT);
POSITION pos;
pos = m_Liste.GetFirstSelectedItemPosition();
if( pos == NULL)
{
*pResult = 0;
return;
}
else
{
// Use the following to display an entire row as selected
// should you need to do so.
int nItem = m_Liste.GetNextSelectedItem(pos);
m_Liste.SetItemState( nItem, LVS_EX_FULLROWSELECT,
LVS_EX_FULLROWSELECT | LVIS_FOCUSED);
m_Liste.EnsureVisible( nItem, FALSE);
}
|
|
|
|
|
Anyone know of an easy to use timer for MFC. Just want to check the time it takes to execute two function calls.
Thanks
|
|
|
|
|
|
|
'Ya know, I never understood the use of difftime(...) in this context - time(...) uses a resolution of (whole) seconds, but difftime(...) returns a floating point value...? Has anyone ever really got a fractional value returned from that function?
Anyway, if the function being timed takes less than a second, I would think that using time(...) would be the wrong way to time it.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: Has anyone ever really got a fractional value returned from that function?
It's not for fractional numbers, it's the range. Remember that a time_t is (usually) a typedef'd long (not unsigned). It's possible to get a difference between two values that overflows the range of a long, necessitating a larger data type - a double . Since the typedef can change, you can't just use an unsigned long for the return value - it may give different answers if a larger data type is used for time_t . The only practical solution is to use the largest datatype possible.
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"
|
|
|
|
|
That is an excellent point that I did not consider. I have been away from 8/16-bit development for too long a time, I guess (and man, I used to LOVE Turbo C...!
Thanks for that!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
The quick-n-dirty way is to call GetTickCount() before and after and compare the difference. However, the resolution of that function is not usually 1ms. For example, it is possible to call the function before and after a method that takes 5ms and get back a difference of 0ms one time and 15ms the next.
If you need better accuracy, I would suggest a multimedia timer or something similar.
it MIGHT help to call Sleep() right before calling into the function if you think the function executes is less than a quantum, to try to avoid a context switch while the function is executing.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
If you're doing it in the development environment, use the profiler.
If you can get it to work (I remember having some "issues"), it is much easier and more accurate than using GetTickCount, etc.
Of course, in production software this is not available.
|
|
|
|
|
Hi all:
Is there any clues to solve the ordinary differential equations in C++??? Expecially for stiff equations. If there is any code available??
Thanks in advance
Asura
|
|
|
|
|
You can purchase "Numerical recipes in C", second edition, Cambridge University press. It contains C code for the most common ODE solvers (runge kunta 4 and 5 order, Ridchardson, Rosenbrock, Adams-Bashforth, and provide solid background on the math and tricks behind. Those methods covers borh normal and stiff ODE.
Unfortunatly, they give no code for Gear like methods, wich, to my understanding, are becoming very popular to solve stiff ODE.
The other drawback is the the C coding style. I have no issue doing maths in pure C in a C++ program, as it allow more time efficient code, but the C style in the book is not very nice and readable. I advice to use it as a canvas then rewrite things yourself.
There are other sources for C or C++ ODE solvers on the net. Most are in FORTRAN, not alwways well documented, and reverse engenering to get it in C or C++ is tough.
Take a look at www.gnu.org/software/gsl, it's a mathematical librairy in the GNU project and contains sources for many ODE.
I'm looking myself for a good C or C++ GEAR code, so if you find any, let me know
|
|
|
|
|
Pls dont send me any link i have gone through them ,
I have an MFC Application .
My problem is simple that i have a document from which
in need to print . but when i print the font size change
gets small which is also visisble in the printpriview .
is there any simple way by which i can have the same
printout as it is visible in the frame window
thanx
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
In your view's OnPrepareDC() method, play around with SetMapMode() , SetWindowOrg() , SetViewportOrg() , SetWindowExt() , and SetViewportExt() . I might have left a sample in the code for this article.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
How are you creating your font for printing?
You can use CreatPointFont(), passing in the printer DC which will account for the higher DPI of the printer as compared to the screen. Or you could use CreateFontIndirect() and calculating the LOGFONT.lfHeight variable depending on the DPI of the printer
logfont.lfHeight = -MulDiv(PointSize, PrinterDC.GetDeviceCaps(LOGPIXELSY), 72);
MyCFont.CreateFontIndirect(&logfont); I can't recall where I got the MulDiv formula from, but I am sure it is in MSDN somewhere.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I'm having the same problem.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
How can i progrmatically determine the existing drives/patitions?
|
|
|
|
|
With GetLogicalDrives(VOID) and associated APIs
~RaGE();
|
|
|
|
|
You can use FindFirstVolume(...) and its related functions to iterate over configured volumes (on systems that support volume management). Partitions are going to be a bit harder, because there could be Partition types on the system that Windows does not recognize (e.g. ext2 , ext3 ).
Getting just the configured drive letters only gets you the ones that are actually assigned to drive letters.
You may have to actually read a drive's partition table - CreateFile(...) to open a physical drive using \\.\PHYSICALDRIVE0 , \\.\PHYSICALDRIVE1 , etc., and DeviceIOControl(...) to access partition information. Look up the PARTITION_INFORMATION and PARTITION_INFORMATION_EX structures in an updated MSDN Library (or online) for more information.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
how can i add a hyperlink in dialog; i have tried following
in the text/caption property;
<A href = "http://codeproject.com">cp</A>
but it simply displays the above line and not the hyperlink.
thanks in advance
|
|
|
|
|
|
|
Hi
I'm using my own class witch derives from CListCtrl and I can't select rows, and I dynamicly creat it with ::Create(...); it's like the CListCtrl doesn't receive input at all. How how can I get to see selection?
I tried to create CListCtr at design time and it works all right.
|
|
|
|
|
I think This Example is your answer
This Example For CStatic Control But for your answer
CStatic --> CListCtrl
Function Onclick -> your Function
in the BEGIN_MESSAGE_MAP
you should use functions CListCtrl
//In cpp File
BEGIN_MESSAGE_MAP(CViewerView, CFormView)
ON_STN_CLICKED(ID_SCROLLSIZE, OnClick)
END_MESSAGE_MAP()
void CViewerView::OnInitial()
{
....
....
CRect Rect;
m_ScrollSize.Create("",SS_BLACKRECT|WS_CHILD|WS_VISIBLE|SS_NOTIFY,
Rect,this,ID_SCROLLSIZE);
}
in Header file////////////////////
#define ID_SCROLLSIZE 100;
class CAnswer : public CDialog
{
...
...
DECLARE_MESSAGE_MAP()
public:
CStatic m_ScrollSize;
afx_msg void OnClick();
};
|
|
|
|