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. Custom Control in a DLL

Custom Control in a DLL

Scheduled Pinned Locked Moved C / C++ / MFC
data-structurestutorialquestion
1 Posts 1 Posters 1 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.
  • R Offline
    R Offline
    Russell Robinson
    wrote on last edited by
    #1

    I have created a custom control in a DLL and it works perfectly when used in a dialog box or property page. However, if I try to use the control in a view window, I get infinite recursion. The following window procedure is straight out of David Kruglinksi: LRESULT CALLBACK AFX_EXPORT OCTimeslotCtrlWndProc(HWND h_wnd,UINT message,WPARAM w_param,LPARAM l_param) { CWnd* p_wnd; p_wnd = CWnd::FromHandlePermanent(h_wnd); if (p_wnd == NULL) { // // first-time; a new window has been created // p_wnd = new OCTimeslotCtrl; p_wnd->Attach(h_wnd); ASSERT(p_wnd == CWnd::FromHandlePermanent(h_wnd)); } ASSERT(p_wnd->m_hWnd == h_wnd); LRESULT l_res = AfxCallWndProc(p_wnd,h_wnd,message,w_param,l_param); return (l_res); } As I said, this works fine when the control is used in a dialog box. However, when used in a view, the call to AfxCallWndProc simply indirectly recurses back to OCTimeslotCtrlWndProc. A stack overflow immediately occurs. Does anyone know how to get a custom control in a DLL to work everywhere?

    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