|
if you want to draw a line between two controls, the safest way is to get the controls' actual on-screen positions, something like:
CRect r1, r2;
ctrl1.GetWindowRect(&r1);
ScreenToClient(r1);
ctrl2.GetWindowRect(&r2);
ScreenToClient(r2);
dc.MoveTo(r1.right, r1.top);
dc.LineTo(r2.left, r2.top);
|
|
|
|
|
|
I have a xml file which hold the structre of Menu items . I want to create the Menu at runtime by reading the XML file .
Can any body help to know how to do this.
Thaks.
|
|
|
|
|
Use the CreateMenu()[^] and associated functions, using the data from your XML file.
It's time for a new signature.
|
|
|
|
|
Hi all,
i have number of items and subitems in list.
no i want to find the clicked item or subitem on double click of ListCtrl.
and also fetch the text of clicked cell.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
I'm not sure which control you are using but most of the information you need should be here[^].
It's time for a new signature.
|
|
|
|
|
Le@rner wrote: no i want to find the clicked item or subitem on double click of ListCtrl.
Are you referring to this notification?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
How about you stick with your original thread here[^]? Go back there and use the "improve question" link to tell us what you've tried and what "not working" means.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
|
Just used the incredible tool Google, and found this[^]. It does pretty much what I understood you need. Implementation uses boost components for thread locking.
Edit: It has a few limitations, as not being able to use a timeout when waiting for elements, but since the source code is provided you can easily add such functionality if desired. If you don't fancy boost, you can replace it with a critical section or equivalent.
|
|
|
|
|
Personally, it'd be like the following:
char str[3];
CFile file;
....
while( !EOF() )
{
file.Read( &str, 3 );
}
file.Close();
But IDK how to write the codes for "!EOF()".
Or any other ways to read files continuously?
Thx in advance!
PS: .txt files
|
|
|
|
|
What do you mean exactly by "continuously" ?
Do you mean you want to read the complete file ?
|
|
|
|
|
yep!
In fact I wanna plot a range of x- and y-coordinates onto a graph while reading them in a txt file.
So I used "continuously".
|
|
|
|
|
The Read function returns the number of bytes read. When there's nothing more to read (because you reached the end of the file), the function will return 0.
|
|
|
|
|
|
What's wrong with:
while( file.Read( &str, 3 ) == 3 )
{
}
That will terminate the loop if it can't read 3 bytes from the file.
Cheers,
Ash
modified on Monday, September 6, 2010 12:17 PM
|
|
|
|
|
Aescleal wrote: What's wrong with: while...
The concept is OK, some details are all wrong.
|
|
|
|
|
Don't know what you're taking about!
(Thanks!)
Ash
|
|
|
|
|
No problem.
|
|
|
|
|
Hi
Best solution is listen events and read file after the file has changed.
If you read file continously, you waste CPU time.
If you want to see code sample how to do this, see:
https://gurux.svn.sourceforge.net/svnroot/gurux/GXCom/GXMedias/GuruxFile
GuruxFile is ATL component that listens selected file or folder and notifies when file changed.
Happy coding,
Mikko
http://www.gurux.org
|
|
|
|
|
char str[4];
try
{
CFile file;
....
while( file.Read( &str, 3 ) )
{
}
file.Close();
}
catch(CFileException e)
{
}
|
|
|
|
|
you have got a couple mistakes on the line
file.Read( &str, 3 );
First of all str by itself is provides a pointer, so there is no need to put the ampersand in front of it.
Secondly, you are reading 3 bytes, but your buffer is only 3 bytes. You will have no room for the terminating zero character, although one may be supplied by the file itself.
The code should be:
file.Read( str, 2 );
str[ 2 ] = '\0';
Refer to MSDN for further information
http://msdn.microsoft.com/en-us/library/ctka0kks%28v=VS.80%29.aspx[^]
|
|
|
|
|
Hi,
can anybody point me in a good direction on how this template works? I have not had any luck with the microsoft and boost documentations on this.
I thought it may be used to detect class interface members as in Interface Detection[^], at least that is what I take from the name.
Many thanks!
|
|
|
|
|
Use it to determine if the template parameter is a pointer to a member function. I think the microsoft documentation[^] is rather clear on this. It also gives a few examples.
|
|
|
|