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. Where to add a dialog in a non-mfc dll?

Where to add a dialog in a non-mfc dll?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
9 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.
  • T Offline
    T Offline
    Tommy Svensson
    wrote on last edited by
    #1

    Hi all, I wish to create a dialog from within my non-mfc dll. I want to start the dialog as soon as possible! Can I do it in PROCESS_ATTACH...? The docs says only simple initialization is allowed there. Anyone? /T

    L 1 Reply Last reply
    0
    • T Tommy Svensson

      Hi all, I wish to create a dialog from within my non-mfc dll. I want to start the dialog as soon as possible! Can I do it in PROCESS_ATTACH...? The docs says only simple initialization is allowed there. Anyone? /T

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      In DLL_PROCESS_ATTACH, I call a function that creates and displays the window. Don't know if this is the correct way, however it works like a charm. regards

      L M 2 Replies Last reply
      0
      • L Lost User

        In DLL_PROCESS_ATTACH, I call a function that creates and displays the window. Don't know if this is the correct way, however it works like a charm. regards

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Can you not have the dialog as a static instance of the dll? Then the dialog will be constructed as soon as the dll is loaded, and its done in the correct order?

        L 1 Reply Last reply
        0
        • L Lost User

          Can you not have the dialog as a static instance of the dll? Then the dialog will be constructed as soon as the dll is loaded, and its done in the correct order?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Another way is to define a function Initialise, and when the app loads the dll, call GetProcAddress(yourdllhandle, "Initialise"), which returns a pointer to the function which you can use to start the dialog, whether its modal or not.

          1 Reply Last reply
          0
          • L Lost User

            In DLL_PROCESS_ATTACH, I call a function that creates and displays the window. Don't know if this is the correct way, however it works like a charm. regards

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Read the docs on DllMain(), it has lots of warnings about what you aren't supposed to do, such as call APIs outside of kernel32. If your code works, then you're lucky. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

            L 1 Reply Last reply
            0
            • M Michael Dunn

              Read the docs on DllMain(), it has lots of warnings about what you aren't supposed to do, such as call APIs outside of kernel32. If your code works, then you're lucky. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Oh, I must have overread it, thanks for the info. Maybe I should redesign my code :~

              M 1 Reply Last reply
              0
              • L Lost User

                Oh, I must have overread it, thanks for the info. Maybe I should redesign my code :~

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #7

                See this article[^] about why following the DllMain() restrictions are important. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

                T 2 Replies Last reply
                0
                • M Michael Dunn

                  See this article[^] about why following the DllMain() restrictions are important. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

                  T Offline
                  T Offline
                  Tommy Svensson
                  wrote on last edited by
                  #8

                  Ok... so HOW then do I create and call a dialog/window in a dll as soon as possible...? Actually, what I want is a splash screen that kicks in when somebody calls LoadLibrary(mydll). /Tommy

                  1 Reply Last reply
                  0
                  • M Michael Dunn

                    See this article[^] about why following the DllMain() restrictions are important. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

                    T Offline
                    T Offline
                    Tommy Svensson
                    wrote on last edited by
                    #9

                    Inside PROCESS_ATTACH, is this a bad thing to do you mean: ---- hSplash = CreateWindow( "BUTTON", "Tommy testing Splash Screen...", WS_POPUP | BS_FLAT, (sx-W)/2, (sy-H)/2, W, H, NULL, NULL, hdll, NULL); ShowWindow(hSplash, SW_SHOW); UpdateWindow( hSplash); } // ... processing ... if ( hSplash) DestroyWindow( hSplash); ----

                    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