Thread: WM_COPYDATA and mutex selecting multiple files

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    8

    WM_COPYDATA and mutex selecting multiple files

    Hope someone knows the answer. I am using the following method to select multiple files and folders in explorer and use them as input to my program:

    * Create unique mutex from first program instance.
    * When next call (next file/folder) is made check for mutex and if it is already there use
    a sendmessage WM_COPYDATA to copy the file/foldername to the first instance.

    Now when I choose 16 or more items in explorer I get a windows warning message that it may take a long time and the computer may respond slowly (this message is triggered before my program is called, so it looks like a default message when selecting 16 or more files and folders and use them as input to one program). I can set a check to prevent the warning message next time, but I see a lot of programs where I can select 16 or more files at once without windows showing me a warning message.

    Anyone got an idea how to prevent this message maybe in code?
    I integrated my program in the explorer menu with shell command in the registry.

    As far as I know this is the most easy solution for selection multiple files and folders in explorer and use them as input to a program. If there are better solutions I would be happy to hear them.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    My guess - the problem is how many instances of your program windows has to open - one per file...

    You can try to use DDE - so only one instance for the first file will be opened... (look at file associations for .doc if word is installed for example)
    About every additinal file explorer will send a DDE message to the first instance of the program that can process it...

    More info can be found here for example: http://www.angelfire.com/biz/rhamini...c.html#HowOpen
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    8
    Thanks for your info. I want my program to handle all files and folder types and not associate it to a specific extension. I'm going to look into DDE now.

    Thanks

Popular pages Recent additions subscribe to a feed