PreTranslateMessage in ocx
-
Hi there, i wrote a ocx in MFC which has no user interface (hust empty rectangle is display on the client form). However, PreTranslateMessage is never called. How can i solve that problem?
-
Hi there, i wrote a ocx in MFC which has no user interface (hust empty rectangle is display on the client form). However, PreTranslateMessage is never called. How can i solve that problem?
It's not your problem. Container implementation should call IOleInPlaceActiveObject::TranslateAccelerator method when properly implemented. Regards "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me
-
It's not your problem. Container implementation should call IOleInPlaceActiveObject::TranslateAccelerator method when properly implemented. Regards "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me
Igor, thanks for the reply. However, i don't understand what you wrote. Let me explain what i need: I want to build an MFC OCX that uses TWAIN to scan images from flatbed scanner. There is already microsoft ocx for that, named ImgScan.ocx. However, it is not good for me, because i don't know how the get the image from it if it configured not to be saved to file. In order to work with the TWAIN i have to give it my window handle and i need to have a message loop. Everything works fine when i work with the TWAIN in a SDI application where I overrided the PreTranslateMessage. However PreTranslateMessage is never called in the OCX. My OCX has no user interface, i mean it has no controls. Do you know how to get messages in PreTranslateMessage in the OCX? How do i get the window handle of my OCX? I tried something else: creating a hidden window. But stil the PreTranslateMessage is never called .
-
Igor, thanks for the reply. However, i don't understand what you wrote. Let me explain what i need: I want to build an MFC OCX that uses TWAIN to scan images from flatbed scanner. There is already microsoft ocx for that, named ImgScan.ocx. However, it is not good for me, because i don't know how the get the image from it if it configured not to be saved to file. In order to work with the TWAIN i have to give it my window handle and i need to have a message loop. Everything works fine when i work with the TWAIN in a SDI application where I overrided the PreTranslateMessage. However PreTranslateMessage is never called in the OCX. My OCX has no user interface, i mean it has no controls. Do you know how to get messages in PreTranslateMessage in the OCX? How do i get the window handle of my OCX? I tried something else: creating a hidden window. But stil the PreTranslateMessage is never called .
I was saying that in standard implementation of OleControl it's responsibility of container to call IOleInPlaceActiveObject::TranslateAccelerator method of current InPlaceActiveObject on each keyboard/mouse message before processing it inside of container. Because you are using MFC and probably derived your control from COleControl: Correct implementation of IOleInPlaceActiveObject::TranslateAccelerator inside of your control should call PreTranslate message of your COleControl derived class: you may serach for the code in MFC for COleControl::XOleInPlaceActiveObject::TranslateAccelerator implementation (file CTLINPLC.CPP). Now, from what you explained: your control is not standard COleControl and it has it's own messagepump --> it makes it more complicated -- but in that case I'll be looking into just calling PreTranslateMessage in your message loop. Regards, I "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me
-
I was saying that in standard implementation of OleControl it's responsibility of container to call IOleInPlaceActiveObject::TranslateAccelerator method of current InPlaceActiveObject on each keyboard/mouse message before processing it inside of container. Because you are using MFC and probably derived your control from COleControl: Correct implementation of IOleInPlaceActiveObject::TranslateAccelerator inside of your control should call PreTranslate message of your COleControl derived class: you may serach for the code in MFC for COleControl::XOleInPlaceActiveObject::TranslateAccelerator implementation (file CTLINPLC.CPP). Now, from what you explained: your control is not standard COleControl and it has it's own messagepump --> it makes it more complicated -- but in that case I'll be looking into just calling PreTranslateMessage in your message loop. Regards, I "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me
Igor, I have created a thread which own its window message queue and it seems wo work fine. Nevertheless, I will try what you have suggested. Thanks, Dudi