Click here to Skip to main content
15,905,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 5:16
Code-o-mat12-Jun-10 5:16 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 6:25
Robert Inventor12-Jun-10 6:25 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 7:00
Code-o-mat12-Jun-10 7:00 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 15:18
Robert Inventor12-Jun-10 15:18 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 15:34
Robert Inventor12-Jun-10 15:34 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly [modified] Pin
Robert Inventor12-Jun-10 15:35
Robert Inventor12-Jun-10 15:35 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 23:08
Code-o-mat12-Jun-10 23:08 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor13-Jun-10 5:40
Robert Inventor13-Jun-10 5:40 
Yes sounds reasonable. I did a Google search just now - there's not much by way of example code for OleLoadPicturePath(..) but what there is all uses NULL for the second parameter. I don't know enough about the Com interface to know how to use IUnknown instead - just copied this code from somewhere else. Usually I add a comment to the code to say where I got it from, but this is very old code, maybe it comes from before I did that.

Strange thing is, though, why didn't Purify trigger an access violation here for the apparently identical code in one of my other programs? That might be a line of investigation to find out more about what is happening.

Apparently identical code in another program which Purify let through without any errors at all:

WCHAR wpath[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, pszPath, -1, wpath, MAX_PATH);
IPicture* pPic=NULL;
CoInitialize(NULL);
OleLoadPicturePath(wpath, NULL, NULL, NULL, IID_IPicture,(LPVOID*)&pPic);
if(pPic)
 {
  HBITMAP hPic = NULL;
  pPic->get_Handle((UINT*)&hPic);
  hPicRet = (HBITMAP)CopyImage(hPic, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG|LR_CREATEDIBSECTION);
  pPic->Release();
 }
 CoUninitialize();


OH I SEE IT NOW

Difference is the

CoInitialize(NULL);
// ...
CoUninitialize();


Must be required. I now remember this triggering a bug in one of my other programs until I fixed it though I can't remember any other details.

I'll add it in and test it in Purify. Need to reboot to Vista to do that, middle of doing things will do that later on (Purify doesn't run in Windows 7).

All this happens before the dialog with the rich edit in question is even created however. I wonder if missing out a required CoInitialise during start up could somehow have a sporadic effect on the rich edit processing?

I've done a new build with this bug fix and with the richedit subclassing code removed completely (it is just a minor feature and will hardly be missed).

So that will eliminate those two possible issues and will see if the rich edit bug still happens.

Robert
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat13-Jun-10 5:53
Code-o-mat13-Jun-10 5:53 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor13-Jun-10 10:50
Robert Inventor13-Jun-10 10:50 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat13-Jun-10 11:14
Code-o-mat13-Jun-10 11:14 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor20-Jun-10 6:03
Robert Inventor20-Jun-10 6:03 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat20-Jun-10 7:43
Code-o-mat20-Jun-10 7:43 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor3-Jul-10 6:30
Robert Inventor3-Jul-10 6:30 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat3-Jul-10 6:43
Code-o-mat3-Jul-10 6:43 
QuestionMs PowerPoint Pin
MsmVc10-Jun-10 23:21
MsmVc10-Jun-10 23:21 
AnswerRe: Ms PowerPoint Pin
Cool_Dev10-Jun-10 23:55
Cool_Dev10-Jun-10 23:55 
GeneralRe: Ms PowerPoint [modified] Pin
MsmVc11-Jun-10 0:03
MsmVc11-Jun-10 0:03 
GeneralRe: Ms PowerPoint Pin
Cool_Dev11-Jun-10 0:18
Cool_Dev11-Jun-10 0:18 
GeneralRe: Ms PowerPoint Pin
MsmVc11-Jun-10 0:23
MsmVc11-Jun-10 0:23 
GeneralRe: Ms PowerPoint Pin
Cool_Dev11-Jun-10 0:41
Cool_Dev11-Jun-10 0:41 
GeneralRe: Ms PowerPoint Pin
MsmVc11-Jun-10 0:43
MsmVc11-Jun-10 0:43 
GeneralRe: Ms PowerPoint Pin
MsmVc11-Jun-10 0:47
MsmVc11-Jun-10 0:47 
GeneralRe: Ms PowerPoint Pin
Cool_Dev11-Jun-10 0:48
Cool_Dev11-Jun-10 0:48 
GeneralRe: Ms PowerPoint Pin
MsmVc11-Jun-10 0:50
MsmVc11-Jun-10 0:50 

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.