|
Thanks, actually I'm trying this on standard C++ pal
I appreciate your help all the time...
Eranga
|
|
|
|
|
This what I have done
string strPT("First name: name");
int strLength = strPT.length();
int indexOfCol = strPT.find(':');
string strMess = strPT.substr(indexOfCol + 2, (strLength - indexOfCol));
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi All,
"<Name>get input from user </Name>"
is it possible to get input from user as depicted in the above method.
The console will echo the "Name" tag and the cursor should be blinking in between the start and end of "Name" tag where in the user should enter a valid input.
kindly let me know. Thanks.
Regards,
lgatcodeproject
|
|
|
|
|
May be you could use gotoxy() to put the cursor in between.
|
|
|
|
|
how to remove ugly border arround the CButton control ? in vista
in win2k3 its appears narmal
the black color border luks ugly in vista
please some one suggest me with the solution
|
|
|
|
|
Join microsoft's design team?
More usefully, for an application to get the Vista look, it need to include what's called a manifest.
Do a search for vista, application, manifest etc, and that should help.
Good luck,
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Iain Clarke wrote: More usefully, for an application to get the Vista look, it need to include what's called a manifest.
So should the OP be removing the manifest then (if he doesn't want the new look)?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My reading was that he had a "classic" application, which was just fine when the OK and other apps matched.
Now he has it on a "shiny" os, the "classic" look doesn't fit in.
And I'm pretty sure that vista requires a manifest for the app before it will apply the new user controls look to it. Beyond that, it gets beyond me. I *think* a manifest is just some xml in the resources or in a similarly named (eg. myapp.exe.manifest) file nearby. Which is why I pointed him at google with the search clues in order to preserve my illusion of omniscience.
Iain,
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
I am debugging the application dealing with COM port.
The WaitCommEvent() function is called after setting mask with EV_RXCHAR and EV_TXEMPTY.
Even when there is no data coming from outside to COM port, WaitCommEvent() returns with new line character(10) continuously and the CPU usage becomes 100%.
Does anybody know why the new line character is coming?
Any help would be greatly appreciable!!
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: WaitCommEvent() returns with new line character(10)
WaitCommEvent returns a BOOL. Did you check if it returns TRUE ?
And what do you mean by "returns new line character" ? You read the port just after WaitCommEvent returns ?
Can you post a relevant code snippet ?
|
|
|
|
|
Hi, Sorry, WaitCommEvent() returns "false" and its 2nd parameter set to value RX_CHAR(i.e, 1)
and the ReadFile() function gives the new line character in its 2nd parameter.
Best Regards,
Suman
code snippet is here:
<br />
if(!SetCommMask(serialObj.m_hCom, EV_RXCHAR | EV_TXEMPTY)) <br />
return ERRCODE;<br />
<br />
while(serialObj.m_hCom != NULL)<br />
{<br />
BOOL bRet = WaitCommEvent( serialObj.m_hCom, &dwCommEvt, &serialObj.comReader );<br />
<br />
if ( dwCommEvt & EV_RXCHAR ) {<br />
<br />
do {<br />
retval = ReadFile( serialObj.m_hCom, &lpBuff, 1, &dwRead, &serialObj.comReader );<br />
<br />
if( retval && dwRead > 0 ) { <br />
<br />
....<br />
SetEvent(serialObj.hReadEvent);<br />
}<br />
}<br />
} while( dwRead > 0 );<br />
}<br />
}<br />
<br />
AfxEndThread(0);<br />
|
|
|
|
|
rp_suman wrote: WaitCommEvent() returns "false"
Well, that's your problem. The function failed. Did you check what was the problem by calling GetLastError() ?
BTW, did you check the documentation of the function ? You know that the function will return immediately when you are in overlapped mode ?
rp_suman wrote: AfxEndThread(0);
This is out of the context of your question but why do you call AfxEndThread here ? You should try to avoid killing your threads in such a brutal way, in general this can be easily avoided.
|
|
|
|
|
Hi, Thanks for the great help!!
I will check the points you have adviced.
Best Regards,
Suman
|
|
|
|
|
Hi,
After having WaitForSingleObject() function next to WaitCommEvent() function, the CPU rate become less.
With Thanks & Regards,
Suman
|
|
|
|
|
Hello everyone,
Could anyone show me the usage of pointer_default please (sample of when we need to use ref, unique and ptr)? After some search, I found too little materials on this topic.
thanks in advance,
George
|
|
|
|
|
George_George wrote: Could anyone show me the usage of pointer_default please (sample of when we need to use ref, unique and ptr)?
The ref attribute identifies a reference pointer. It is used simply to represent a level of indirection. Can not be NULL .
The unique attribute specifies a unique pointer. Can be NULL .
The ptr attribute designates a pointer as a full pointer. Can be NULL .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi DavidCrow,
I also got the similar one-setence description from other books, but no detailed description. Especially for ref and unique, what are the restrictions (exception nullable) compared with normal pointer ptr? Any ideas?
regards,
George
|
|
|
|
|
George_George wrote: Especially for ref and unique, what are the restrictions (exception nullable) compared with normal pointer ptr? Any ideas?
Here are whole pages on ref and unique. As an added bonus, there are even code samples.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Read the Remarks section of this to understand aliasing.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I have some further issue for unique attribute after some study for the link you recommended.
http://msdn2.microsoft.com/en-us/library/aa367294(VS.85).aspx[^]
(Especially confused about "before the call")
--------------------
Can use existing memory on the client without allocating new memory. When a unique pointer changes during a call from one non-NULL value to another, the pointer is assumed to point to a data object of the same type. Data returned from the server is written into existing storage specified by the value of the unique pointer before the call.
--------------------
I do not know why "Data returned from the server is written into existing storage specified by the value of the unique pointer before the call", especially "the value of the unique pointer before the call".
Suppose the following scenario,
1. client pass point ptr1 to server and ptr2 originally pointed to memory buffer1;
2. server change ptr1 to pointed to memory buffer2, which is different from buffer1;
3. server writes data through pointer ptr1, it should be written to buffer2.
So, it should be,
Data returned from the server is written into existing storage specified by the "lastest" value of the unique pointer, which is memory buffer 2.
Other than,
Data returned from the server is written into existing storage specified by the value of the unique pointer "before" the call, which is memory buffer 1.
Any comments?
regards,
George
|
|
|
|
|
Hello everyone,
The situation when we need to use this class is, we want to continue to append the content of string (not at one time, but at many times -- appending). Right?
Any other situations which use of this class (compared with other string and stream related class) will give us special benefits?
thanks in advance,
George
|
|
|
|
|
You can also expoit polymorphically the ostrsrteam inheritance from ostream to redirect the output on a string. The following (silly) sample depicts the idea
class HiFolks
{
ostream * _pos;
public:
HiFolks(ostream * pos):_pos(pos){};
void setos(ostream * pos){ _pos = pos;}
void sayHi()
{
(*_pos) << "hi folks" << endl;
}
};
void main()
{
strstream s;
HiFolks hf(&cout);
hf.sayHi();
hf.setos(&s);
hf.sayHi();
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
Cool sample!
Two more comments,
1. You agree with my points in original post?
2. In MSDN, there is no inheritance hierarchy information (at least I can not find from API document for ostrstream, could you find such information from MSDN)? for example ostrstream inherits from ostream.
regards,
George
|
|
|
|
|
George_George wrote: 1. You agree with my points in original post?
Since it is a (output) stream, yes.
George_George wrote: 2. In MSDN, there is no inheritance hierarchy information (at least I can not find from API document for ostrstream, could you find such information from MSDN)? for example ostrstream inherits from ostream.
Yes, here [^] (check out the grey rectangle).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|