copyhookhandler

how to use copyhookhandler in c++.? pls provide step by step code.

Comments

  • : how to use copyhookhandler in c++.? pls provide step by step code.
    :
    You need to provide a bit more information.

    From the name it sounds like a callback function, probably to keep the user informed of the progress of long copies. However without the system we can only guess.
  • : : how to use copyhookhandler in c++.? pls provide step by step code.
    : :
    : You need to provide a bit more information.
    :
    : From the name it sounds like a callback function, probably to keep
    : the user informed of the progress of long copies. However without
    : the system we can only guess.
    :


    yes, u r right, i am talking abt callback function, basically which determine whether file/folder will be move/copy /delete or not as per user input.
  • : : : how to use copyhookhandler in c++.? pls provide step by step code.
    : : :
    : : You need to provide a bit more information.
    : :
    : : From the name it sounds like a callback function, probably to keep
    : : the user informed of the progress of long copies. However without
    : : the system we can only guess.
    : :
    :
    :
    : yes, u r right, i am talking abt callback function, basically which
    : determine whether file/folder will be move/copy /delete or not as
    : per user input.
    :
    So it will work something like this

    /* prototype of Microsoft fucntion that takes the handler looks something like this
    but certainly not exactly */
    void MSCopy( char *filename, char *destination, int (*copyhookhandler)(void) );

    Your code

    HWND hwnd; /* gloab handle to your main window */
    int hook(void)
    {
    int answer;

    answer = MessageBox(hwnd, "Alert", "Do you really want to copy the file?", MB_YESNO);
    if(answer == IDYES)
    return 1;
    else
    return 0;
    }

    Your calling function

    /* code here */
    ....
    MSCopy("SourceFile.txt", "DestFile.txt", hook);
    ....
    /* more code here */


    This is basically how it will work, except I don't have all the details of the MS function. The hook function puts up a dialogue for the user to confirm the action. You then pass its address as a function pointer to the MS function (which won't be called MSCopy but will have a similar name), and it calls you back to see if user confirms or not.

  • : : : : how to use copyhookhandler in c++.? pls provide step by step code.
    : : : :
    : : : You need to provide a bit more information.
    : : :
    : : : From the name it sounds like a callback function, probably to keep
    : : : the user informed of the progress of long copies. However without
    : : : the system we can only guess.
    : : :
    : :
    : :
    : : yes, u r right, i am talking abt callback function, basically which
    : : determine whether file/folder will be move/copy /delete or not as
    : : per user input.
    : :
    : So it will work something like this
    :
    : /* prototype of Microsoft fucntion that takes the handler looks
    : something like this
    : but certainly not exactly */
    : void MSCopy( char *filename, char *destination, int
    : (*copyhookhandler)(void) );
    :
    : Your code
    :
    : HWND hwnd; /* gloab handle to your main window */
    : int hook(void)
    : {
    : int answer;
    :
    : answer = MessageBox(hwnd, "Alert", "Do you really want to copy the
    : file?", MB_YESNO);
    : if(answer == IDYES)
    : return 1;
    : else
    : return 0;
    : }
    :
    : Your calling function
    :
    : /* code here */
    : ....
    : MSCopy("SourceFile.txt", "DestFile.txt", hook);
    : ....
    : /* more code here */
    :
    :
    : This is basically how it will work, except I don't have all the
    : details of the MS function. The hook function puts up a dialogue for
    : the user to confirm the action. You then pass its address as a
    : function pointer to the MS function (which won't be called MSCopy
    : but will have a similar name), and it calls you back to see if user
    : confirms or not.
    :
    :


    As you said,copyhook give option to user either to copy or not and on the basis of input take action,can we change code so that it always assume user input as yes and take action. what changes will be required ,pls specify.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories