Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. PreTranslateMessage in ocx

PreTranslateMessage in ocx

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++designhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dudi Avramov
    wrote on last edited by
    #1

    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?

    I 1 Reply Last reply
    0
    • D Dudi Avramov

      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?

      I Offline
      I Offline
      igor1960
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • I igor1960

        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

        D Offline
        D Offline
        Dudi Avramov
        wrote on last edited by
        #3

        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 1 Reply Last reply
        0
        • D Dudi Avramov

          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 Offline
          I Offline
          igor1960
          wrote on last edited by
          #4

          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

          D 1 Reply Last reply
          0
          • I igor1960

            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

            D Offline
            D Offline
            Dudi Avramov
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups