|
To insert newline at apropriate place in string, he can use GetTextMetrics(), and insert '\n' at every (staticCtrlWidth/textMatrics.tmAveCharWidth) position of string. Or any other way?
|
|
|
|
|
That can be done, but the output of a string like "iiiiiiiiiiiiiiWWWWWWWWWWWWWWW" would not be as expected.
|
|
|
|
|
Yes.. average character width makes the problem. Need to track the extend of each character, and apropriately insert the '\n'.
|
|
|
|
|
Hi,
How can I set bitmap or image on CDateTimeCtrl on updown button?
|
|
|
|
|
I am reading id3v2 frame headers from an MP3 file. I am able to read some headers correctly. I read that the frame header TLEN has the total length of the file in milliseconds. The problem is that I have encountered some MP3 files which do not have this frame header "TLEN". I have used Groove Hex editor to check and they are all true. How do I calculate the total length of the file if it does not have the TLEN frame header?
|
|
|
|
|
Me think that the TLEN tag is only informative (option) and not essential. so you will have to find your track lenght somewhere else (probably decode and check the header frame
see this : MPEG Audio Frame Header[^]
M.
Watched code never compiles.
|
|
|
|
|
As Maximilien suggested, to decode and get the duration, render the file using DirectShow, IGraphBuilder::RenderFile(). Obtain IMediaSeeking interface and call GetDuration(). That wil give you the correct duration.
|
|
|
|
|
I am not programming in directshow but I am doing it in C. I want to understand it well so I don't want to use a library.
|
|
|
|
|
well.. if you are programming in C for windows, still you can use directshow, its a part of windows sdk now. Only need to know the usage of COM.
|
|
|
|
|
Hi all,
apologize if this is not right fourm to post this question.
i am really curious to know how we(our program) can mointor the network connections ?
say Zonealram will mointor all the network connection that are getting(incoming/outgoing) how this can be done ? any one if they can share there ideas will be great.
i googled it but i didnt find relavent info so thought of asking experts .
Thanks in advance.
|
|
|
|
|
One thought would be to use the ISensNetwork interface.
"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
|
|
|
|
|
|
if you are a firewall, you see all network packets that have your IP address as a source or destination, so by watching traffic you can build a list of all other IP addresses of interest.
|
|
|
|
|
Hi Luc, Thanks for your reply.
|
|
|
|
|
Hi All,
I am getting a CString variable which has a value like this
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
I have to process all these tab and newline before sending this CString variable to to 3rd party function.
Example:
This is what I receive:
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
I have send this str like this to the 3rd party function:
str = "ABCD EFGH IJKL MNOP
QRST"
Please give your suggestions.
Thanks,
Joseph
|
|
|
|
|
Can't you use the CString::Replace() method?
"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
|
|
|
|
|
I dont want to replace anything. If I find a \t then I have to execute that \t. Please see the example below.
Execute means, if there is a \t then I have to give 5 spaces (tab).
If there is a \n then I have to move the remaining string to the next line.
I have to process this str:
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
like this:
str = "ABCD(TAB)EFGH(TAB)IJKL(TAB)MNOP(NEWLINE)QRST"
There should be 5 spaces in (TAB)
A newline should be in (NEWLINE)
Thanks,
Josef
|
|
|
|
|
Joseph82 wrote: I dont want to replace anything
Yes, that's what you want to do: you want to replace the string "\t" by a tab character and the string "\n" by a newline character. So you have to replace a sequence "\\t" by a sequence "\t" (that's what you have to specify to the replace function, since you have to escape the "\" character).
Executing a '\t' doesn't mean anything, you can't "execute" a tab or a new line.
|
|
|
|
|
Thanks. But how to do it.
How will I get this output in the CString Variable:
str = "ABCD(5spaces)EFGH(5spaces)IJKL(5spaces)MNOP(newline)QRST"
Thanks
Josef
|
|
|
|
|
Did you check the post from David ? Check the documentation of the function to see how to use it.
|
|
|
|
|
you want to replace the actual "tab" character with the "visual" representation of the tab ?
for example what would happen if the tab is visually represented by 2 spaces or by 3 spaces ?
Watched code never compiles.
|
|
|
|
|
|
so, just replace (CString::Replace) the "\t" with " ".
Watched code never compiles.
|
|
|
|
|
What should I do for newline?
|
|
|
|
|
It make no sense to "execute" a newline inside a string! Inside a string you could put printable characters, like 'a', 'b', 'c' and so on, and/or control characters, like '\t' (i.e. TAB), '\n' (i.e. LF) and so on.
If you pass such a string to functions like printf , that functions will print-out the printable characters and do what the control characters ask for, for example:
printf("first>\tthis is a sentence...\nsecond>\tthis is another sentence...")
will produce an output on screen similar to the following:
first> this is a sentence...
second> this is another sentence...
as you can see TAB (\t) is not simply expanded to a certain number of characters, but it make the text formatted in columns; the LF instead instruct the printf function to move to the beginning of the next line and place the remaining text there.
Then:
- if you like it, you can replace the TABs expanding them to a fixed number of spaces (supposed that you have a
CString named str , you have only to call str.Replace(_T("\t"), _T(" ")); on it); be aware that usually this is not the behaviour of TAB that the rest of the world is expecting. - absolutely it make no sense to replace the \n characters in a string with newline because in strings \n has the meaning of newline!
|
|
|
|