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. Tried dialog hidden technique from dlgboxtricks but it didn't work....

Tried dialog hidden technique from dlgboxtricks but it didn't work....

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelp
7 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.
  • B Offline
    B Offline
    balaclavabob
    wrote on last edited by
    #1

    Hi, I am trying to make Nishant Sivakumar - "Using global hotkeys" start hidden: http://www.codeproject.com/system/nishhotkeys01.asp I have added the hidden modal code from Nishant Sivakumar - "Some handy dialog box tricks, tips and workarounds ": http://www.codeproject.com/dialog/dlgboxtricks.asp It compiles, but it doesn't become hidden. Changes to the "Using global hotkeys" project I made: In "HotKeyTestDlg.cpp" I added: void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { if(!visible) pos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(pos); } and added "visible = FALSE;" to: CHotKeyTestDlg::CHotKeyTestDlg(CWnd* pParent /*=NULL*/) : CDialog(CHotKeyTestDlg::IDD, pParent) In "HotKeyTestDlg.h" I added "BOOL visible;" to protected under: class CHotKeyTestDlg : public CDialog This wouldn't compile "error C2509: 'OnWindowPosChanging' : member function not declared in 'CHotKeyTestDlg'" till I added "void OnWindowPosChanging(WINDOWPOS * pos);" to public under: class CHotKeyTestDlg : public CDialog So it now compiles and runs, but it doesn't start hidden.

    D 1 Reply Last reply
    0
    • B balaclavabob

      Hi, I am trying to make Nishant Sivakumar - "Using global hotkeys" start hidden: http://www.codeproject.com/system/nishhotkeys01.asp I have added the hidden modal code from Nishant Sivakumar - "Some handy dialog box tricks, tips and workarounds ": http://www.codeproject.com/dialog/dlgboxtricks.asp It compiles, but it doesn't become hidden. Changes to the "Using global hotkeys" project I made: In "HotKeyTestDlg.cpp" I added: void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { if(!visible) pos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(pos); } and added "visible = FALSE;" to: CHotKeyTestDlg::CHotKeyTestDlg(CWnd* pParent /*=NULL*/) : CDialog(CHotKeyTestDlg::IDD, pParent) In "HotKeyTestDlg.h" I added "BOOL visible;" to protected under: class CHotKeyTestDlg : public CDialog This wouldn't compile "error C2509: 'OnWindowPosChanging' : member function not declared in 'CHotKeyTestDlg'" till I added "void OnWindowPosChanging(WINDOWPOS * pos);" to public under: class CHotKeyTestDlg : public CDialog So it now compiles and runs, but it doesn't start hidden.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      balaclavabob wrote: This wouldn't compile... You could have avoided all of this hassle by letting ClassWizard add the method for you. It would have updated both the .cpp and .h files. balaclavabob wrote: So it now compiles and runs, but it doesn't start hidden. Cab you confirm that the pos->flags &= ~SWP_SHOWWINDOW statement is actually executed? If not, is visible being changed to TRUE somewhere? Do you have any calls to ShowWindow()?


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      B 1 Reply Last reply
      0
      • D David Crow

        balaclavabob wrote: This wouldn't compile... You could have avoided all of this hassle by letting ClassWizard add the method for you. It would have updated both the .cpp and .h files. balaclavabob wrote: So it now compiles and runs, but it doesn't start hidden. Cab you confirm that the pos->flags &= ~SWP_SHOWWINDOW statement is actually executed? If not, is visible being changed to TRUE somewhere? Do you have any calls to ShowWindow()?


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        B Offline
        B Offline
        balaclavabob
        wrote on last edited by
        #3

        DavidCrow wrote: You could have avoided all of this hassle by letting ClassWizard add the method for you. It would have updated both the .cpp and .h files. MFC is something I have been told to avoid at all costs and just go and learn .Net, so my knowledge of MFC is quite limited. DavidCrow wrote: Cab you confirm that the pos->flags &= ~SWP_SHOWWINDOW statement is actually executed? If not, is visible being changed to TRUE somewhere? It is not executing, I tried both: void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { if(!visible) { pos->flags &= ~SWP_SHOWWINDOW; MessageBox("This executed"); } CDialog::OnWindowPosChanging(pos); } void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { pos->flags &= ~SWP_SHOWWINDOW; MessageBox("This executed"); CDialog::OnWindowPosChanging(pos); } both didn't bring up the message box. visible is always false for the entire length of the program, I haven't modified it anywhere and it isn't being modified by anything. DavidCrow wrote: Do you have any calls to ShowWindow()? I have no calls to ShowWindow() at all.

        D 1 Reply Last reply
        0
        • B balaclavabob

          DavidCrow wrote: You could have avoided all of this hassle by letting ClassWizard add the method for you. It would have updated both the .cpp and .h files. MFC is something I have been told to avoid at all costs and just go and learn .Net, so my knowledge of MFC is quite limited. DavidCrow wrote: Cab you confirm that the pos->flags &= ~SWP_SHOWWINDOW statement is actually executed? If not, is visible being changed to TRUE somewhere? It is not executing, I tried both: void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { if(!visible) { pos->flags &= ~SWP_SHOWWINDOW; MessageBox("This executed"); } CDialog::OnWindowPosChanging(pos); } void CHotKeyTestDlg::OnWindowPosChanging(WINDOWPOS * pos) { pos->flags &= ~SWP_SHOWWINDOW; MessageBox("This executed"); CDialog::OnWindowPosChanging(pos); } both didn't bring up the message box. visible is always false for the entire length of the program, I haven't modified it anywhere and it isn't being modified by anything. DavidCrow wrote: Do you have any calls to ShowWindow()? I have no calls to ShowWindow() at all.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          You failed to add ON_WM_WINDOWPOSCHANGING() to the dialog's message map. This is something that ClassWizard would have handled for you!


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          B 1 Reply Last reply
          0
          • D David Crow

            You failed to add ON_WM_WINDOWPOSCHANGING() to the dialog's message map. This is something that ClassWizard would have handled for you!


            "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

            B Offline
            B Offline
            balaclavabob
            wrote on last edited by
            #5

            I added it manually and it worked. I was looking thru the ClassWizard and unless I added in ON_WM_WINDOWPOSCHANGING() manually it wouldn't have appeared.... For future reference how should I use ClassWizard todo something like this.... Thanks for your help.

            D 1 Reply Last reply
            0
            • B balaclavabob

              I added it manually and it worked. I was looking thru the ClassWizard and unless I added in ON_WM_WINDOWPOSCHANGING() manually it wouldn't have appeared.... For future reference how should I use ClassWizard todo something like this.... Thanks for your help.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              balaclavabob wrote: I was looking thru the ClassWizard and unless I added in ON_WM_WINDOWPOSCHANGING() manually it wouldn't have appeared.... Wrong again. ClassWizard has somehow been set to only show dialog-related messages. Click the Class Info tab and select Window in the Message filter: combobox. Back on the Message Maps tab, you should see WM_WINDOWPOSCHANGING in the list of messages.


              "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

              B 1 Reply Last reply
              0
              • D David Crow

                balaclavabob wrote: I was looking thru the ClassWizard and unless I added in ON_WM_WINDOWPOSCHANGING() manually it wouldn't have appeared.... Wrong again. ClassWizard has somehow been set to only show dialog-related messages. Click the Class Info tab and select Window in the Message filter: combobox. Back on the Message Maps tab, you should see WM_WINDOWPOSCHANGING in the list of messages.


                "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                B Offline
                B Offline
                balaclavabob
                wrote on last edited by
                #7

                DavidCrow wrote: Wrong again. ClassWizard has somehow been set to only show dialog-related messages. Click the Class Info tab and select Window in the Message filter: combobox. Back on the Message Maps tab, you should see WM_WINDOWPOSCHANGING in the list of messages. Thanks it worked.

                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