|
Sir
when I type 'a' then 'D' is appearing as I used D in the sendmessage
when I type 'b' then I am trying to send 'e', but it is typing only b.
when I type 'e' then I am sending 'I' capital I so it is typing I.
I mapped all the requirements for a thru z but, it is not working for all the cases where I am sending small letters but, it is working fine for all Capital Letters.
How can I do it for sending small letters too through sendmessage ? or is there any other method?
I am typing no special characters frequently, so how can I replace the text in the richedit control for every time I press alphabet keys or punctuation keys ?
Thanks a lot
Jai Srimannarayana
|
|
|
|
|
kristna wrote:
I am typing no special characters frequently, so how can I replace the text in the richedit control for every time I press alphabet keys or punctuation keys ?
Instead of using SendMessage(WM_CHAR, 'D', 0) , using ReplaceSel("D") . This will prevent the recursion that David was talking about. This should work for lowercase and uppercase characters without a problem.
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"
|
|
|
|
|
Thanks for great idea, but still it did not work for me. I am a novice and if you can give the piece of the code, the line of code, I'll try with it. It says error undeclared identifier ReplaceSel.
Thanks a lot.
Jai Srimannarayana
|
|
|
|
|
Since you're using CRichEditView , you'll need to use GetRichEditCtrl().ReplaceSel(...)
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"
|
|
|
|
|
Thanks for your response. I am still in trouble.
It is giving the following error if I try to implement it.
error C2664: 'ReplaceSel' : cannot convert parameter 1 from 'char [2]' to 'const unsigned short *'
void CWordPadView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case 'b':
GetRichEditCtrl().ReplaceSel("e") ;
break;
...
Can I get some solution ?
Jai Srimannarayana
|
|
|
|
|
You didn't say you were compiling for Unicode Use _T("e") instead of just "e"
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"
|
|
|
|
|
Thanks dear Ryan Binns! It worked with _T("e"). Thanks a lot .
Using same replacesel I am unable to put the characters above 128. Is there any way to do that ?
Thank you again.
Jai Srimannarayana
|
|
|
|
|
Hi there
We've tried to write a screensaver that starts (a bit after it starts) and stops (after it stops) a service using the codeproject ServiceHelper class here: http://www.codeproject.com/system/cservicehelper.asp
the problem is that the screensaver runs fine when a user is logged in, but when they're logged out, there are no privileges granted to the process, so we get ERROR_ACCESS_DENIED from the call to the service control manager.
Can anyone help us think of a workaround?
|
|
|
|
|
Can we know, is your purpose to only start or stop this service if YOUR screensaver is running?
Or would you want this to happen for ANY screensaver?
Also, I just examined the source for the service helper class, and it asks for SERVICE_ALL_ACCESS just to start and stop a service. Why don't you try 'relaxing' the requirement to SERVICE_START for starting and SERVICE_STOP for stopping and see if that helps.
|
|
|
|
|
I want to add a button to the title bar. How can I do this using the API Windows ?
Thank in advance.![Confused | :confused:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
|
Thank Alok !![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
CryptAcquireContext(&cspContext,UserName,MS_DEF_PROV,PROV_RSA_FULL ,0); returns an error ERROR_FILE_NOT_FOUND ( 2L )
Anybody knows why ? How to getrid of this error ?
Sandeep Naik
|
|
|
|
|
Hi,
When I have designed my application, I had a class (CVerifiPoteau) that was inheriting from a base class (CPoteauBeton).
Now I want to serialize my class CVerifiPoteau and I have added another inherited class : CObject.
See my code here :
class CVerifiPoteau : public CPoteauBeton , public CObject
It seems to work properly since it respect C++, but I want to know if it can cause some difficulties with MFC (Visual Studio.NET 2003 C++).
Thanks,
Claude
|
|
|
|
|
Why would using a class that comes with MFC cause problems in MFC ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
Why would using a class that comes with MFC cause problems in MFC ?
Multiple inheritance and MFC does not mix particularly well See my answer below for the problem that I found.
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"
|
|
|
|
|
Although it shouldn't make a difference, the MSVC++6 compiler was dependent on the order in which the classes appeared in the derivation list for multiple inheritance. Consequently, it often caused very wierd runtime errors if the MFC class was not the first class in the derivation list. As a general rule, make the MFC class the first class in the derivation list (swap the two around in your example above) and it should work fine.
I don't know whether the same problem appears in the .NET 2003 compiler, but I would still put the MFC class first.
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"
|
|
|
|
|
wouldn't the following be better ?
class CPoteauBeton : public CObject {};
class CVerifiPoteau : public CPoteauBeton {};
Serge
|
|
|
|
|
I have to change color of some characters in RichEdit control.
It’s not difficult do with SetSel function and SetSelectionCharFormat.
But I have to change many characters in different colors, and it takes too much time.
How can I do it faster ? Perhaps without using by selection functions.
|
|
|
|
|
scanf wrote:
How can I do it faster ?
You could try using the StreamOut method to get a copy of the raw RTF, modify the RTF (it's just text - not too difficult to process), and then use StreamIn to put the new RTF into the control.
Parsing RTF is a bit tricky, but it will be quicker than using the formatting functions (which have to modify the RTF as well as updating the display)
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"
|
|
|
|
|
Yeah that’s a good direction.
static DWORD CALLBACK <br />
MyStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
And really not difficult.
Thank you for help.![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I want to create a shortcut within my Visual C++ program and put it in the All Users Startup directory. Anyone know how? Thanks, GAF
|
|
|
|
|
|
hello friends
plz help me in this problem. i m making an intrusion detection system using vc++, in this output of sniffer has to be written in text file. is there is any function for that.
thanx
bye
|
|
|
|
|
(all platforms) C/C++ functions: fopen, fclose, fwrite, fread, fprintf, fputs, fputc.
(Windows specific) C/C++ functions: CreateFile, CloseHandle, WriteFile, ReadFile.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|