Click here to Skip to main content
15,918,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Zoom Pin
john563219-Aug-10 2:17
john563219-Aug-10 2:17 
GeneralRe: Zoom Pin
CPallini19-Aug-10 2:30
mveCPallini19-Aug-10 2:30 
AnswerRe: Zoom Pin
Luc Pattyn19-Aug-10 2:35
sitebuilderLuc Pattyn19-Aug-10 2:35 
QuestionProblem caused by interception of API function using method 'code injection' Pin
VictorSotnikov18-Aug-10 23:55
VictorSotnikov18-Aug-10 23:55 
GeneralRe: Problem caused by interception of API function using method 'code injection' Pin
David Crow19-Aug-10 3:51
David Crow19-Aug-10 3:51 
QuestionProblem with doublebyte chars in Japanese Pin
narayanagvs18-Aug-10 21:13
narayanagvs18-Aug-10 21:13 
AnswerRe: Problem with doublebyte chars in Japanese Pin
norish19-Aug-10 8:03
norish19-Aug-10 8:03 
GeneralRe: Problem with doublebyte chars in Japanese Pin
narayanagvs20-Aug-10 0:35
narayanagvs20-Aug-10 0:35 
Sure ..

say with a text having 6 double byte chars as below and if I try to find word My then my search is displaced by 6 chars
and the pos is returned at "th"

" DIM a;DIM b;{ ‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨‚ ‚¢‚¤‚¦‚¨ } My Month "

using ascii version functions in my code


len = lstrlen(lpSrc)+1;  //Error  Length is returned as 6 extra bytes

_fstrstr( lpStr, (LPSTR)szFind );

   if( p ) {

    pos = p - lpStr;   

   }


Using MBCS functions

len = _mbslen((unsigned char *)lpSrc)+1; // Length is correctly returned
ucP = _mbsstr((unsigned char *)lpStr, (unsigned char *)(LPSTR)szFind );
			
   if(ucP)
   {
	pos = ucP - (unsigned char *)lpStr; // Error here the difference is 6 extra bytes
   }


This problem happens only in japanese OS and that too in my application's editor.
Removing the XP manifest file from my application folder seems to work fine.
Doing a sample application of the same and testing in both english and japanese OS is working fine.

Now I am changing my code to MBCS and then counting the double byte chars in my code and adjusting the position accordingly using below code.

int cPos = 0,count =0;
				while(cPos<pos)
				{
					if( IsDBCSLeadByte(lpStr[cPos] ))
					{
						cPos = cPos + 2;
						count++;
					}
					else
						cPos++;
				}
				pos = pos - count;



Thanks
Satya
Today is a gift, that's why it is called the present.

QuestionHelp needed in Solving LNK2001 Pin
Hari_1618-Aug-10 21:03
Hari_1618-Aug-10 21:03 
AnswerRe: Help needed in Solving LNK2001 Pin
bleedingfingers18-Aug-10 21:07
bleedingfingers18-Aug-10 21:07 
GeneralRe: Help needed in Solving LNK2001 Pin
Hari_1618-Aug-10 21:19
Hari_1618-Aug-10 21:19 
GeneralRe: Help needed in Solving LNK2001 Pin
Richard MacCutchan18-Aug-10 21:54
mveRichard MacCutchan18-Aug-10 21:54 
GeneralRe: Help needed in Solving LNK2001 Pin
bleedingfingers18-Aug-10 22:07
bleedingfingers18-Aug-10 22:07 
GeneralRe: Help needed in Solving LNK2001 Pin
Richard MacCutchan18-Aug-10 22:19
mveRichard MacCutchan18-Aug-10 22:19 
GeneralRe: Help needed in Solving LNK2001 Pin
bleedingfingers18-Aug-10 22:25
bleedingfingers18-Aug-10 22:25 
AnswerRe: Help needed in Solving LNK2001 Pin
Cedric Moonen18-Aug-10 21:50
Cedric Moonen18-Aug-10 21:50 
AnswerRe: Help needed in Solving LNK2001 Pin
Richard MacCutchan18-Aug-10 21:54
mveRichard MacCutchan18-Aug-10 21:54 
QuestionHow to safely release the memory when I dynamic create the the dialog ? Pin
wangningyu18-Aug-10 20:50
wangningyu18-Aug-10 20:50 
AnswerRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Eugen Podsypalnikov18-Aug-10 21:08
Eugen Podsypalnikov18-Aug-10 21:08 
AnswerRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Niklas L18-Aug-10 22:37
Niklas L18-Aug-10 22:37 
GeneralRe: How to safely release the memory when I dynamic create the the dialog ? [modified] Pin
Aescleal18-Aug-10 22:44
Aescleal18-Aug-10 22:44 
GeneralRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Niklas L18-Aug-10 23:24
Niklas L18-Aug-10 23:24 
GeneralRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Aescleal19-Aug-10 1:26
Aescleal19-Aug-10 1:26 
AnswerRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Aescleal18-Aug-10 22:39
Aescleal18-Aug-10 22:39 
GeneralRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Rick York19-Aug-10 15:34
mveRick York19-Aug-10 15:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.