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. 891130 - capturing an image from a camera

891130 - capturing an image from a camera

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelpquestioncareer
1 Posts 1 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.
  • I Offline
    I Offline
    ilostmyid2
    wrote on last edited by
    #1

    Application A was using C.dll as an interface for camera. C.dll was and is erroneous. Sometimes it throws exceptions and causes the application to crash. Since the application is intended to be running always in the platform and is responsible for many things as well as handling cameras, we decided to use in indirect method for the application to use the camera. The plan was to separate the dll from the application. Another application got responsible for getting involved with sending the appropriate commands to the camera via the dll and in another side be in communication with the application. We call it server. The application is now a client for it. The communication between these two separate processes is established via a named pipe. I've tested this link and it works fine. Now the problem is that after starting the camera I use the following code to capture an image:

    bool CCamera::CaptureImage(LPCSTR i_lpszBMPFileName)
    {
    if (m_hWnd &&
    capGrabFrameNoStop(m_hWnd) &&
    capFileSaveDIB(m_hWnd, i_lpszBMPFileName))
    return true;
    return false;
    }

    The m_hWnd is created with this code:

    m_hWnd = capCreateCaptureWindow(m_sName, WS_CHILD|WS_CLIPSIBLINGS, 0, 0, 160, 120, i_hwndParnt, 0xffff);

    i_hwndParent in both cases (before separating the application and after it) is obtained with the following code:

    i_hwndParent = CreateWindow("STATIC", "parent", WS_POPUP, 0, 0, 20, 10, NULL, NULL, NULL, NULL);

    Before changing the method to a client/server method, in CaptureImage everything was working fine. Both capxxx macros did their job and returned with true or false. But now, the program control remains inside them and the if statement is not evaluated until I stop the camera. After stopping the camera these macros return with true. It causes the application to remain in the CaptureImage function and never returns until the camera is stopped. I wondered what might be different in two methods. I couldn't realize why the macros don't return. Any idea? Thx

    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