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. Get Window Handle to Modless Dialog Box After Create

Get Window Handle to Modless Dialog Box After Create

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 3 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I have a modeless dialog box in Which I create a Rich Edit After the Create I try to acess the Window Handle via GetSafeHwnd Sometimes I get an exception

        HWND dlgwnd;
     main\_app->progdbg->Create(IDD\_PROGDBG,AfxGetMainWnd());
     dlgwnd = main\_app->progdbg->GetSafeHwnd();
    
    CPalliniC V 2 Replies Last reply
    0
    • F ForNow

      Hi I have a modeless dialog box in Which I create a Rich Edit After the Create I try to acess the Window Handle via GetSafeHwnd Sometimes I get an exception

          HWND dlgwnd;
       main\_app->progdbg->Create(IDD\_PROGDBG,AfxGetMainWnd());
       dlgwnd = main\_app->progdbg->GetSafeHwnd();
      
      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Well, Create method might fail. You are not checking its return value (it is worth noting that Create, on success, returns the handle you are searching for).

      In testa che avete, signor di Ceprano?

      F 1 Reply Last reply
      0
      • F ForNow

        Hi I have a modeless dialog box in Which I create a Rich Edit After the Create I try to acess the Window Handle via GetSafeHwnd Sometimes I get an exception

            HWND dlgwnd;
         main\_app->progdbg->Create(IDD\_PROGDBG,AfxGetMainWnd());
         dlgwnd = main\_app->progdbg->GetSafeHwnd();
        
        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        ForNow wrote:

        Sometimes I get an exception

        And exactly this exception look like? And did you try to debug your code to be sure all the parts of your expressions are correct?

        1 Reply Last reply
        0
        • CPalliniC CPallini

          Well, Create method might fail. You are not checking its return value (it is worth noting that Create, on success, returns the handle you are searching for).

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #4

          Ok Thanks rebuild see what happens

          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