Click here to Skip to main content
16,004,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Zoom Pin
john563219-Aug-10 1:30
john563219-Aug-10 1:30 
GeneralRe: Zoom Pin
CPallini19-Aug-10 1:59
mveCPallini19-Aug-10 1:59 
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 
Hi,

I have an editor in my application which has a find functionality implemented for it.The user will enter text in the editor and will try the Find option from menu.The problem is when I have n double byte characters(of japanese) in my text and say if I try to find an char or word which after the double byte chars then my search is displaced by n bytes.This issue happens only in japanese and the same application works fine in English.Going through the below blog which has a similar problem as that of mine I noticed that the problem is with the dependancy on ComCtrl 6 dll used in xp manifest theme.

http://www.insidercoding.com/post/2008/08/06/Visual-C2b2b-60-2b-XP-Manifest-3d3d-Problems.aspx

My application is also developed in vc6 and we use a manifest file for XP visual theme as below

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
      version="1.0.0.0"
      processorArchitecture="X86"
      name="wm"
      type="win32"/>
  <description>Merely an XP test.</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="X86"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
</assembly>

And I also cannot move my application to unicode. There are ASCII functions in my code.MFC by default supports MBCS.Even after placing _MBCS in project settings doesnt solve my problem. When I debug the below code I found the problem with lstrlen which is returning n chars extra for n double byte chars in my text to find.This happens only when I debug the code in japanese OS , the same works fine when I debug the same application in English OS.

static
int
FindStrPos( LPSTR lpSrc, LPSTR lpFind, BOOL bMatchCase )
{
  LPSTR  p;
  int   pos = -1, len;
  char  szFind[FIND_LEN];

  LPSTR  lpStr;

  lstrcpy( szFind, lpFind);
  if( !bMatchCase ) {
    len = lstrlen(lpSrc)+1;
    lpStr = (LPSTR)wwHeap_AllocPtr( hChunkWM,
      (GMEM_MOVEABLE | GMEM_ZEROINIT), len );
    if( lpStr ) {
      _fmemcpy( lpStr, lpSrc, len );
      _fstrupr( lpStr );
      _fstrupr( (LPSTR)szFind );
      p = _fstrstr( lpStr, (LPSTR)szFind );
      if( p ) {
        pos = p - lpStr;      
      }
      wwHeap_FreePtr( hChunkWM, lpStr );
      return( pos );
    } else {
      debug("Alloc failed compare case-sensitive");
    }
  }

  p = _fstrstr( lpSrc, lpFind );
  if( p )
    pos = p - lpSrc;

  return( pos );
}


I also used MBCS functions like _mbslen instead of lstrlen and _mbsstr instead of _fstrstr then _mbslen is returning accurate length in japanese and when while finding the difference between the search position and actual text pos the value of pos is again added with n bytes in japanese version for n double byte chars in Text.

I tried removing the manifest file as the unknown problem is with the dependancy of comcontrl dll version 6 for enabling Xp style but it is giving other problems in japanese.

Any suggestion would be helpful.

Thanks,

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

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 
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 

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.