From: Nemo on
Hi. I am trying to insert an image into a RichEditCtrl, and was
following the code provided at MSDN KB 220844.
I seem to be getting stuck right at the first step. The assert
following the SendMessage always fails :

::SendMessage(m_ctlRichText.m_hWnd, EM_GETOLEINTERFACE, 0,
(LPARAM)&m_pRichEditOle);
ASSERT(m_pRichEditOle != NULL);

I tried to look up on MSDN, but I can't seem to find any documentation
as to why the attempt to get the interface might fail. Yet. I have a
funny feeling it is some initialization call that I must be missing.

btw, I do call AfxInitRichEdit(). I even stuck in a AfxOleInit() to be
sure.

I even tried using the GetIRichEditOle() method. But the same result -
I got back a null pointer.

Any insight, I'm sure, would be handy.

Thanks,

From: Joseph M. Newcomer on
At what point are you calling this? Are you sure the m_ctlRichText.m_hWnd is a valid
window handle? Otherwise it looks like it should work, given the article.

Otherwise, I'm as stuck as you are.
joe


On Wed, 16 Apr 2008 16:26:37 -0700 (PDT), Nemo <nnimod(a)gmail.com> wrote:

>Hi. I am trying to insert an image into a RichEditCtrl, and was
>following the code provided at MSDN KB 220844.
>I seem to be getting stuck right at the first step. The assert
>following the SendMessage always fails :
>
> ::SendMessage(m_ctlRichText.m_hWnd, EM_GETOLEINTERFACE, 0,
>(LPARAM)&m_pRichEditOle);
> ASSERT(m_pRichEditOle != NULL);
>
>I tried to look up on MSDN, but I can't seem to find any documentation
>as to why the attempt to get the interface might fail. Yet. I have a
>funny feeling it is some initialization call that I must be missing.
>
>btw, I do call AfxInitRichEdit(). I even stuck in a AfxOleInit() to be
>sure.
>
>I even tried using the GetIRichEditOle() method. But the same result -
>I got back a null pointer.
>
>Any insight, I'm sure, would be handy.
>
>Thanks,
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Nemo on
I call the SendMessage in OnInitDialog. After I read your reply, just
to be sure I stuck in an ASSERT(::IsWindow(m_ctlRichText.m_hWnd)). No
problems there.

I'm a bit puzzled as to why I am not able to find any other instance
(atleast on the net) of someone running into this problem. Is there
any other way of inserting images into an edit control?

Thanks for thinking about my problem Joe. Appreciate it.


On Apr 20, 6:08 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
> At what point are you calling this?  Are you sure the m_ctlRichText.m_hWnd is a valid
> window handle?  Otherwise it looks like it should work, given the article.  
>
> Otherwise, I'm as stuck as you are.
>                                 joe
>
>
>
> On Wed, 16 Apr 2008 16:26:37 -0700 (PDT), Nemo <nni...(a)gmail.com> wrote:
> >Hi. I am trying to insert an image into a RichEditCtrl, and was
> >following the code provided at MSDN KB 220844.
> >I seem to be getting stuck right at the first step. The assert
> >following the SendMessage always fails :
>
> >    ::SendMessage(m_ctlRichText.m_hWnd, EM_GETOLEINTERFACE, 0,
> >(LPARAM)&m_pRichEditOle);
> >     ASSERT(m_pRichEditOle != NULL);
>
> >I tried to look up on MSDN, but I can't seem to find any documentation
> >as to why the attempt to get the interface might fail. Yet. I have a
> >funny feeling it is some initialization call that I must be missing.
>
> >btw, I do call AfxInitRichEdit(). I even stuck in a AfxOleInit() to be
> >sure.
>
> >I even tried using the GetIRichEditOle() method. But the same result -
> >I got back a null pointer.
>
> >Any insight, I'm sure, would be handy.
>
> >Thanks,
>
> Joseph M. Newcomer [MVP]
> email: newco...(a)flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

From: Joseph M. Newcomer on
My basic problem here is that I've never actually sent this message; the files I have that
have pictures were created by WordPad, which inserted the pictures. However, you might
consider looking at the WordPad source, to see how it does it. It's somewhere on the MSDN
(I'm not sure it's THE WordPad source, but it is A WordPad source, and I've sometimes
stepped through it with the debugger to help me understand other aspects of Rich Edit
controls)
joe

On Mon, 21 Apr 2008 10:01:36 -0700 (PDT), Nemo <nnimod(a)gmail.com> wrote:

>I call the SendMessage in OnInitDialog. After I read your reply, just
>to be sure I stuck in an ASSERT(::IsWindow(m_ctlRichText.m_hWnd)). No
>problems there.
>
>I'm a bit puzzled as to why I am not able to find any other instance
>(atleast on the net) of someone running into this problem. Is there
>any other way of inserting images into an edit control?
>
>Thanks for thinking about my problem Joe. Appreciate it.
>
>
>On Apr 20, 6:08�pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
>> At what point are you calling this? �Are you sure the m_ctlRichText.m_hWnd is a valid
>> window handle? �Otherwise it looks like it should work, given the article. �
>>
>> Otherwise, I'm as stuck as you are.
>> � � � � � � � � � � � � � � � � joe
>>
>>
>>
>> On Wed, 16 Apr 2008 16:26:37 -0700 (PDT), Nemo <nni...(a)gmail.com> wrote:
>> >Hi. I am trying to insert an image into a RichEditCtrl, and was
>> >following the code provided at MSDN KB 220844.
>> >I seem to be getting stuck right at the first step. The assert
>> >following the SendMessage always fails :
>>
>> > � �::SendMessage(m_ctlRichText.m_hWnd, EM_GETOLEINTERFACE, 0,
>> >(LPARAM)&m_pRichEditOle);
>> > � � ASSERT(m_pRichEditOle != NULL);
>>
>> >I tried to look up on MSDN, but I can't seem to find any documentation
>> >as to why the attempt to get the interface might fail. Yet. I have a
>> >funny feeling it is some initialization call that I must be missing.
>>
>> >btw, I do call AfxInitRichEdit(). I even stuck in a AfxOleInit() to be
>> >sure.
>>
>> >I even tried using the GetIRichEditOle() method. But the same result -
>> >I got back a null pointer.
>>
>> >Any insight, I'm sure, would be handy.
>>
>> >Thanks,
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...(a)flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Ajay Kalra on
I am curious as to why do you need this interface?

--
Ajay

On Apr 16, 7:26 pm, Nemo <nni...(a)gmail.com> wrote:
> Hi. I am trying to insert an image into a RichEditCtrl, and was
> following the code provided at MSDN KB 220844.
> I seem to be getting stuck right at the first step. The assert
> following the SendMessage always fails :
>
> ::SendMessage(m_ctlRichText.m_hWnd, EM_GETOLEINTERFACE, 0,
> (LPARAM)&m_pRichEditOle);
> ASSERT(m_pRichEditOle != NULL);
>
> I tried to look up on MSDN, but I can't seem to find any documentation
> as to why the attempt to get the interface might fail. Yet. I have a
> funny feeling it is some initialization call that I must be missing.
>
> btw, I do call AfxInitRichEdit(). I even stuck in a AfxOleInit() to be
> sure.
>
> I even tried using the GetIRichEditOle() method. But the same result -
> I got back a null pointer.
>
> Any insight, I'm sure, would be handy.
>
> Thanks,

 |  Next  |  Last
Pages: 1 2
Prev: UNICODE conversion
Next: CListCtrl sort not working