Loading ...
Sorry, an error occurred while loading the content.

Re: Cancelling ReqData() midway through

Expand Messages
  • L. Lee Saunders
    Hi Chris, ... OK, here you go (You may kick your self after you read this): To cancel a ReqData() normally you would hit return/escape/left mouse button right?
    Message 1 of 3 , May 1 6:36 AM
    • 0 Attachment
      Hi Chris,

      >I am running into a problem that I'm sure is easy to get around if
      >one knows the ins and outs of the XP API. I realize that this is my
      >1000th question for the week; sorry about this. :-)
      >
      >I am using ReqData() to get the user to type in a file name at the
      >command line. So far so good, but I also want the user to be able to
      >right-click when prompted for the file name and have my XP command
      >respond by bringing up the Open File dialog. This much I can do: I
      >defined a function that brings up the dialog, and passed the func-
      >tion's address to ReqData() by making it the third parameter of my
      >RDATA structure.
      >
      >The problem is that my XP command needs to know that once the user
      >dismisses the dialog (whether cancelling it or hitting okay), the
      >file name request has been fulfilled. What it does instead, once
      >the user dismisses the dialog, is leave the file name prompt text
      >on the command line and wait for the user to give it input.
      >
      >So I'm wondering how one goes about cancelling a request made via
      >ReqData(), or how to notify CC2 that the request has been fulfilled
      >via the right-click function specified in the RDATA structure. If
      >there's a way to do this, then my XP command can signal CC2 when the
      >user has chosen a file name using the dialog, instead of having CC2
      >just sit there and wait for more input. I tried a few things, in-
      >cluding the enigmatic AbortEdit() function (it doesn't have any de-
      >scription that I can find with the XP development toolkit), but that
      >didn't do the trick.

      OK, here you go (You may kick your self after you read this):

      To cancel a ReqData() normally you would hit return/escape/left mouse button
      right?

      Well to do it in code you would:

      PostMessage(MyXP.hMainWin, WM_KEYDOWN, VK_ESCAPE, 0);

      The next function that should run is the exit function listed in your
      ReqData. If you need to redirect from there, set a global variable as a
      flag right before you call postmessage and then check for it like this:

      if (Result != X_OK)
      {
      if (Flag == 1)
      {
      //Redirect from here
      }
      CmdEnd;
      return;
      }

      Hope this helps,

      Lee



      ________________________________________________________________________
      Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
    • Christopher Golden
      ... Yup, I m kicking myself. Thanks Lee; I wasn t thinking in Win32 API mode when I should ve been. I ve tried this and it s working well. Take care, Chris
      Message 2 of 3 , May 1 7:48 AM
      • 0 Attachment
        L. Lee Saunders wrote:

        > OK, here you go (You may kick your self after you read this):
        >
        > To cancel a ReqData() normally you would hit return/escape/left mouse button
        > right?
        >
        > Well to do it in code you would:
        >
        > PostMessage(MyXP.hMainWin, WM_KEYDOWN, VK_ESCAPE, 0);

        Yup, I'm kicking myself. Thanks Lee; I wasn't thinking in Win32
        API mode when I should've been. I've tried this and it's working
        well.

        Take care,
        Chris G.
        golden@...
      Your message has been successfully submitted and would be delivered to recipients shortly.