Announcement

Collapse
No announcement yet.

Invocation of Folder Options dialog

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

  • Invocation of Folder Options dialog

    This posting is not really a question, it's more of an observation that may or may not be interesting.

    In a program I am developing I do a bit of interprocess communication as follows

    Code:
          hWndFGr = GetForegroundWindow()
          IF hWndFGr <> hWndMain THEN
            CALL SendMessage (hWndFGr, %WM_INC_HYPER, hWndMain, 0)
          END IF
    The above code had been hastily written and I had assumed that if hWndFGr was not the handle of my main application window then it must be the window of one of the processes launched from the my main window process. Of course, that is a wrong assumption and I found that when its wrong the system Folder Options dialog pops up in response to the above SendMessage call. Strangely, the dialog only pops up, at least on my system, when the program is installed in a sub folder of C:\Program Files.
    BTW, %WM_INC_HYPER had been set to %WM_USER + 22.

    Keith

    ------------------


    [This message has been edited by Keith Waters (edited September 18, 2001).]

  • #2
    %WM_INC_HYPER I assume is a user-defined message value?

    Basically, you should use values that are at least %WM_USER + 500& upwards (to the limit of the %WM_USER range), since many (common) controls use messages below that value, such as you have found.

    For 100% guaranteed reliable custom/private message values, use:
    Code:
    WM_MY_MESSAGE& = RegisterWindowMessage("WM_MY_MESSAGE")
    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      [M$ recommendations]
      WM_USER through 0x7FFF Integer messages for use by private window classes.
      WM_APP through 0xBFFF Messages available for use by applications.
      0xC000 through 0xFFFF String messages for use by applications.
      [/M$ recommendations]

      ------------------
      Fred
      mailto:[email protected][email protected]</A>
      http://www.oxenby.se

      Fred
      mailto:[email protected][email protected]</A>
      http://www.oxenby.se

      Comment


      • #4
        Lance and Fred,

        Many thanks for the info on user-defined message values.

        Lance - Yes, RegisterWindowMessage is the route I've chosen for safety, as you say. Thanks for confirming that. Can't see how its 100% reliable, though, as there's still a chance of another application using the same message string, or do I worry too much.

        BTW, out of interest I used GetClassName to get the class name of my hWndFGr window handle and it was "Progman", so the following gave the same effect as the bug in my program by popping up the Folder Options dialog.

        Code:
            CALL SendMessage (FindWindow("Progman", BYVAL %NULL), _
                       %WM_USER + 22, hWndMain, 0)
        Presumably there are other, possibly useful, calls like this.

        Keith


        ------------------

        Comment

        Working...
        X