Announcement

Collapse
No announcement yet.

How to get hWnd for not-displayed dialog box?

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

  • How to get hWnd for not-displayed dialog box?

    I am trying to use some code that Semen had posted a while back
    that allows multiple files flagging for custom programs that have
    been added to Windows Explorer's File & rightclick Context Menu's.
    Semen's code works GREAT, BUT,
    his code uses a dialog that is displayed and that has a title.
    For the programs that *I've* written, I would like to have the
    multiple files flagging capability, yet still have ONE instance of
    the program process the files that are flagged, rather than have
    the Explorer call up a separate instance of the program for EACH
    of the flagged files.

    So, my question: in Semen's code, he uses the FindWindow API Call
    to find the hWnd of the custom program. He then uses the returned
    number (hWnd) to use the SendMessage to send the %WM_COPYDATA to
    the original program's instance dialog callback. So, is there
    any way to get the hWnd of a dialog (modeless) that is NOT being
    displayed, uses the %WS_EX_TOOLWINDOW extstyle, and immediately
    has the DIALOG SHOW STATE hDlg, 0 statement after the
    DIALO SHOW MODELESS hDlg CALL Proc()?

    This is not a critical question, but, I *hate* unnecessary GUI's,
    and the three programs I've added to my Windows Explorer's menu's
    are best run without the GUI, and should be run "unattended", after
    the files have been flagged.

    Thanks in advance!

    Regards,


    ------------------
    Clay C. Clear

    Clay Clear's Software
    mailto:[email protected][email protected]</A>

    [This message has been edited by Clay Clear (edited October 16, 2001).]

  • #2
    Disregard my original posting in this thread! I have since found out
    that FindWindow DOES return the hWnd for a modeless, hidden dialog!
    The problem with my test code was that it were processing the
    DIALOG DOEVENTS too quickly, so the subsequent permutations of the
    same program didn't have time to post their SendMessage to the original
    instance. Anyway, all's working FINE, now.

    Now, I've got to figure out how to retrieve ALL of the SendMessage's
    to the original instance's callback function, yet have it be the
    fastest that's possible. I "fixed it" just now by putting a 10-second
    timer function in the message loop.

    Any ideas?

    Thanks!

    Regards,



    ------------------
    Clay C. Clear

    Clay Clear's Software
    mailto:[email protected][email protected]</A>

    Comment


    • #3
      OK, no need to reply to ANY of these postings, as I reduced the
      timer function in the message pump to 2 seconds, yet the test
      program still accepted all *16* SendMessage messages, AND, it is
      HIGHLY unlikely that I'll need to simultaneously select even THAT
      many at a time.

      I would've killed this topic, but I figure some other members
      might like to see that it's possible.

      Regards,

      P.S. The timer function in the pump only waits for two seconds
      ONE time, NOT for each of the SendMessage iterations. I.E.:

      Code:
          DE1??? = TIMER
          '
          DO
              DIALOG DOEVENTS
          LOOP UNTIL TIMER > DE1??? + 2
          '
          DIALOG SEND hDlg, %WM_COMMAND, 254&, 0& 'the CBCTL that tells
              'callback to kill function so execution can resume in
              'WINMAIN and actually process the flagged files
          DIALOG DOEVENTS
          'put actual files processing here, as dialog should've been killed

      ------------------
      Clay C. Clear

      Clay Clear's Software
      mailto:[email protected][email protected]</A>

      Comment

      Working...
      X