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. Mobile Development
  3. Mobile
  4. Dialog BOx Question

Dialog BOx Question

Scheduled Pinned Locked Moved Mobile
question
3 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.
  • C Offline
    C Offline
    CSharpDavid
    wrote on last edited by
    #1

    I have a dialog with a timer that check to see if it can close itself when it can I kill the timer and send a PostMessage(WM_CLOSE); The dialog is very slow to close , If I click the system close button, it is immediate Also Tried SendMessage. Whats the best way to close the dialog ? NB: THe main dialog has a timer doing serial comms. Win CE 3.0 Thanks .Confused

    B D 2 Replies Last reply
    0
    • C CSharpDavid

      I have a dialog with a timer that check to see if it can close itself when it can I kill the timer and send a PostMessage(WM_CLOSE); The dialog is very slow to close , If I click the system close button, it is immediate Also Tried SendMessage. Whats the best way to close the dialog ? NB: THe main dialog has a timer doing serial comms. Win CE 3.0 Thanks .Confused

      B Offline
      B Offline
      besmel
      wrote on last edited by
      #2

      David, what's your platform ? Is it a HPC2K Industrial device ? In this case try to move the EXE to the RAM instead of running directly from the FLASH Memory : I've found that many times this solved my problems....

      1 Reply Last reply
      0
      • C CSharpDavid

        I have a dialog with a timer that check to see if it can close itself when it can I kill the timer and send a PostMessage(WM_CLOSE); The dialog is very slow to close , If I click the system close button, it is immediate Also Tried SendMessage. Whats the best way to close the dialog ? NB: THe main dialog has a timer doing serial comms. Win CE 3.0 Thanks .Confused

        D Offline
        D Offline
        Daniel Strigl
        wrote on last edited by
        #3

        I do it the following way:

        ...

        class CConnMsgDlg : public CDialog
        {
        ...

        // Implementation
        protected:
        // Generated message map functions
        //{{AFX_MSG(CConnMsgDlg)
        virtual BOOL OnInitDialog();
        ...
        //}}AFX_MSG
        afx_msg LRESULT OnEnd(WPARAM wParam, LPARAM lParam);
        DECLARE_MESSAGE_MAP()

        ...
        

        private:
        static const UINT MY_WM_END;
        };

        ...

        /////////////////////////////////////////////////////////////////////////////
        // Message table

        const UINT CConnMsgDlg::MY_WM_END =
        RegisterWindowMessage(_T("MY_WM_END-{29813B84-DD1E-11d7-9B13-0002B32C4875}"));

        BEGIN_MESSAGE_MAP(CConnMsgDlg, CDialog)
        //{{AFX_MSG_MAP(CConnMsgDlg)
        ...
        //}}AFX_MSG_MAP
        ON_REGISTERED_MESSAGE(MY_WM_END, OnEnd)
        END_MESSAGE_MAP()

        BOOL CConnMsgDlg::OnInitDialog()
        {
        CDialog::OnInitDialog();

        // TODO: Add extra initialization here
        
            // Create the thread and start it
        
        return TRUE;  // return TRUE unless you set the focus to a control
                      // EXCEPTION: OCX Property Pages should return FALSE
        

        }

        LRESULT CConnMsgDlg::OnEnd(WPARAM wParam, LPARAM lParam)
        {
        EndDialog(wParam);

        return 0L;
        

        }

        void CConnMsgDlg::ThreadFnc()
        {
        ...

        PostMessage(MY\_WM\_END, IDOK); // destroy the dialog
        

        }

        I have a dialog that starts a thread in the 'OnInitDialog' function. The thread reads some data from the serial port. This can take a long time, so I do it in a own thread. When the thread is ready it post the message 'MY_WM_END', that I have registered in the message map. The 'OnEnd' function closes the dialog with 'EndDialog'. Cheers, Daniel. -- FIND A JOB YOU LOVE, AND YOU'LL NEVER HAVE TO WORK A DAY OF YOUR LIFE. ;)

        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