Announcement

Collapse
No announcement yet.

SetDialogFocus (does this exist?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SetDialogFocus (does this exist?)

    http://blogs.msdn.com/oldnewthing/ar...02/205624.aspx

  • #2
    No.

    SetDialogFocus is just a wrapper made up by Raymond Chen for the WM_NEXTDLGCTL message.
    A similar wrapper in PowerBASIC would be
    Code:
    SUB SetDialogFocus(BYVAL hdlg AS DWORD, BYVAL hwndControl AS DWord)
    
      SendMessage(hdlg, %WM_NEXTDLGCTL, hwndControl, %TRUE)
    
    END SUB
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

    Comment


    • #3
      Thank you.

      How about this?
      Code:
      DIALOG SHOW STATE hDlg, %SW_SHOWNORMAL 'in case minimized
      SetForegroundWindow(hDlg)

      Comment


      • #4
        What are you trying to do?
        Dominic Mitchell
        Phoenix Visual Designer
        http://www.phnxthunder.com

        Comment


        • #5
          Make dialog visible.

          Comment


          • #6
            That's too vague.
            Usually to show or hide a window only the SDK's ShowWindow or PB's verbose Dialog Show State is needed.
            Why do you need SetForegroundWindow? I am trying to figure out the context in which the dialog is being
            made visible.
            Is it at application startup?
            Is it after the dialog has been minimized to the system tray?
            Are you trying to forcefully grab the foreground from another app?
            Dominic Mitchell
            Phoenix Visual Designer
            http://www.phnxthunder.com

            Comment


            • #7
              This is Gosta's app. See post #24 and after.
              What I would like to do is to force the Dialog to the top when the timer runs out but I dont know how to do that. I fooled with Dialog styles but no go.
              http://www.powerbasic.com/support/pb...ad.php?t=41701


              My suggestion was to use DIALOG SHOW STATE hDlg, %SW_SHOWNORMAL in case minimized
              and SetForegroundWindow(hDlg) in case behind another window.
              Last edited by Mike Doty; 20 Oct 2009, 08:33 PM.

              Comment


              • #8
                Keep in mind that even the Windows API help file suggests that, in general, you shouldn't use the SetForegroundWindow function but let the user choose which window is in the foreground. There are times when it might be necessary but usually, you shouldn't need this. Many applications now simply flash the window and the taskbar button, using something like the FlashWindow API function, to let the user know that something has changed and then the user can switch to the window themselves.
                Jeff Blakeney

                Comment

                Working...
                X