![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Hi guys,
Been away for a while but just gettting back into some programming again. Found a little tool for copying files and folders called ROBOCOPY, like the old DOS XCOPY but better (see here... Robocopy), and I'm wanting to automate this with B4PPC. What I would like to know is if it is possible to detect when a USB drive has been plugged in? The best I have come up with is to run a DirExist("MyBackup.etc") periodically to check if the USB drive is present but this is very hit and miss. I'd much rather have some way of detecting that the drive has just been plugged in - is it possible? Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
Agraham your amazing..... is there anything you don't know?
I've not tried it yet but have every faith it will work. Thankyou very much, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
Further investigation shows that you only get one each of events with these wParam values on a change. There may still be a delay before the device is accessible. Again you need to change the Sub name to WMevent_MagicEvent for the dzEventsMagic library.
Code:
Sub WMEvent_WmEvent
msg = WMevent.wParam
Select msg
Case 32772:
Msgbox("Device removed")
Case 32768
Msgbox("Device added")
End Select
End Sub
|
|
||||
|
I've played some more and it seems, on my Vista desktop at least, that the USB drive is available as soon the drive added message arrives. This is convenient as it will save doing some timing logic before testing if it is true for all systems.
|
|
|||
|
You might be interested in this: Desktop-only backup utility.
Please let me know if you want the source code. |
|
||||
|
I like the twist on the ROBOCOPY name... Robscopy
![]() If you wouldn't mind then it would be nice to see your source code as there are some things you have done different such as using a TreeView to select paths and also the ability to exclude files (not just folders). My app is intended to run slightly differently in that I'd like to have it running in the background all of the time and then detect when x amount of time has passed (set by the user) and trigger the ROBOCOPY function, if the destination is a USB device it will wait for the device to be connected. Attached is my source code so that you can see the direction I've taken. This is no where near finished and does not include running in the background which needs to be added now that Agraham and DZT have been so kind as to show me a way forward. Most of my programming is done during a 30 minute meal break at work ![]() I've commented out the SHELL comand and just use a label to display the arguments for the time being. Regards, RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
|
||||
|
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Device with USB hard drive link | dan kabestan | Questions & Help Needed | 3 | 08-12-2008 12:47 AM |
| drive, file list boxes | scott93727 | Basic4ppc Wishlist | 0 | 06-22-2008 02:35 AM |
| int 13 drive 0 bad sector problems | scott93727 | Questions & Help Needed | 1 | 04-11-2008 10:26 AM |
| leap year detection | stbi | Code Samples & Tips | 3 | 07-02-2007 05:21 PM |