Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application on Memory Stick 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
Anyone played around with putting a completely stand alone application on a memory stick - Can it be done? It would be so good to have an application/runtime files/dll's etc on a device that you know will work when it gets given to a user. Just airing thoughts, wondered of the possibilities.
 
Yes, Plenty of us here. Wish I lived in Spain and didn't have a Tony Blair taking all my money. Fortunately my wife is a television addict so I get a bit of freebie time to be on the PC.
 
thanks for the support guys, this i will certainly bear in mind.



jgjge3.gif
[tt]"Very funny, Scotty... Now Beam down my clothes."[/tt]
 
The only problem i have with running an app from a memory stick, si that my software runs on a networked PCs. The user has 40 PC in an office, an has bought 10 sticks and app from me.

What is to stop the user from networking the memory stick, (USB drive), from one PC and allowing all the networked PCs to run the app? How can i stop the file share ability of the USB memory stick?

BB
 
What about adding a function to not allow the prog to run unless it is on a physical path?

e.g.

[tt]
Private Sub Form_Load()
'Check for a file on memory stick.
If Len(Dir("x:\onstick.txt")) = 0 Then
End 'Program
End If
End Sub
[/tt]

This way, if the user is running it from a networked drive, i.e. \\Server\memStick\onstick.txt
It isn't going to work (right?)

OR

Would the app.path variable return the network path if run on a shared dir?

If so, maybe this..

[tt]
Private Sub Form_Load()
If Mid(App.Path, 2, 1) <> &quot;:&quot; Then
End 'Program
End If
End Sub
[/tt]


Just playing with the idea, but I hope it helps...


jgjge3.gif
[tt]&quot;Very funny, Scotty... Now Beam down my clothes.&quot;[/tt]
 
Yes Ted, it's a good one. Thanks Jag, thats quite a neat idea. If someone was to put the stick in a PC and make his own copy of it locally, then it would not work unless he was up to drive X to load it on. Added to the password etc area partition on the stick, although I must look into how I read/write to that area. Regards
 

tedsmith,

Perhaps this forum in awhile but not by a long shot. I remember a thread that was almost 150 replies in forum68.

ZOR, JAG14,

So let me get this right. You are now looking to see if a USB device is shared across a network or if it is attached to the local machine, right? If so let me introduce you to the GetDriveType API...
[tt]
Private Declare Function GetDriveType Lib &quot;kernel32&quot; Alias &quot;GetDriveTypeA&quot; (ByVal nDrive As String) As Long

Private Const DRIVE_TYPE_UNDTERMINED = 0
Private Const DRIVE_ROOT_NOT_EXIST = 1
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6

Private Sub Form_Load()

Dim DriveType As Long, Msg As String

DriveType = GetDriveType(Left(App.Path, InStr(3, App.Path, &quot;\&quot;)))

Select Case DriveType
Case DRIVE_TYPE_UNDTERMINED
Msg = &quot;Huh?&quot;
Case DRIVE_ROOT_NOT_EXIST
Msg = &quot;No Root?&quot;
Case DRIVE_REMOVABLE
Msg = &quot;Removable&quot;
Case DRIVE_FIXED
Msg = &quot;Fixed&quot;
Case DRIVE_REMOTE
Msg = &quot;Remote&quot;
Case DRIVE_CDROM
Msg = &quot;CD&quot;
Case DRIVE_RAMDISK
Msg = &quot;Ram Disk&quot;
End Select

MsgBox Msg

End Sub

[/tt]

Ok, so let me explain the logic and reasoning behind this suggestion. First the logic...

See the call to the API where [tt]Left(App.Path, InStr(3, App.Path, &quot;\&quot;))[/tt] the 3 is. UNC paths are \\ServerName\ and Drive letters are C:\ so what would be returned from this is either C:\ or \\ServerName
Now for the reasoning...

If it is a UNC path it will return a value of 1 or = DRIVE_ROOT_NOT_EXIST so you will know it is an invalid drive.

AND, lets say the USB device is mapped to the machine as a drive letter then the call will return as DRIVE_REMOTE = 4 and once again it is an invalid drive.

BUT, if it is attached to the local machine then it will return DRIVE_REMOVABLE = 2 (I am using a USB Hardrive so it may return with a memory stick as DRIVE_RAMDISK = 6) of which I would think is what you are looking to verify and this would be a valid drive.

Good Luck

 
Probably the easiest way of performing this would be to set the Volume name of the Memory Stick to a set name. Say MyApp. You can then use VB code to check if the Volume exists on the machine the code is being run on. I don't have VB on the machine I am on at the moment but could provide code examples when I get back to my machine if needed.

Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
Thanks Greg, would appreciate any code samples referring to the volume name. Excellent addition to security.
Its not until one realises the potential a stick offers, having been so long in a mental block of a floppies holding nothing, a CD usually read only. It's going to be interesting in the future to see where they go. Thanks again
 
Which is the fastest for data access, PCMCIA or USB? Following on from earlier questions in this thread, I have an app where i am using a memory card as the dongle. The app runs fine, without clitch on a compact flash card, using a PCMCIA card reader. Will this app run as quickly using a USB reader?

Speed is a real issue for my app, as it controls two USB devices in real-time.
 
Sorry vb5prgrmr, Don't know why, but I did not notice your posting in here first time round, it's only that the subject returned to the top that I saw it when scrolling down. Applogies for that, I was not ignoring you. I tried it on my local machine and it returns Removable. Is there a way to get the drive letter back. Although I don't have a use at the moment, it could have its interest in the future.
BiggerBrother, the application I have on the memory stick is noticeably slower than on the hard drive. It may be because its a cheap one, don't know. My use is mainly for having an application I can walk around with to show someone, without the need to put any files on his machine. Maybe Jag or anyone else following along can comment. Will wait to see. Regards
 
Zor,

Hello again!

I've been fiddling with this for a while now to try and optimise the speed of a prog on a USB Flash Drive (Pen Disk, MemStick, Many other Names) and found a noticeable improvement (when using Stand-Alone Xpress, For thos who don't know what this is, scroll up..) by removing the VB Runtime msvbvm60.dll from the include package and just placing the original file in the same directory on the USB Disk.
Also, the difference in using a USB1.1 to using a USB2.0 drive is significant enough for a mention simply because of the transfer speeds.

Hope this helps,



jgjge3.gif
[tt]&quot;Very funny, Scotty... Now Beam down my clothes.&quot;[/tt]
 
Is you set a reference to Microsoft Scripting Runtime (scrrun.dll) it exposes a FileSystemObject. This contains a drive object within a drives collection. There are several drive properties available including DriveLetter, DriveType, FileSystem (FAT32, NFTS, etc), SerialNumber, ShareName, VolumeName, etc. It may just be an encapsulation of the API vb5prgmr referred to above.

Sample

Dim fso As FileSystemObject
Dim drv As Drive
Set fso = New FileSystemObject
For Each drv In fso.Drives
With drv
MsgBox .DriveLetter & &quot; &quot; & .DriveType & &quot; &quot; & _
.FileSystem & &quot; &quot; & .SerialNumber & &quot; &quot; & _
.VolumeName
End With
Next drv
Set fso = Nothing
Set drv = Nothing

Good Luck! I greatly enjoyed this thread even though most of it is way over my head at this point.



Have a great day!

j2consulting@yahoo.com
 
Thanks SBendBuckeye, I'll give that a try when I get a minute. All snippets are always usefull to have as you never know when you want to use them, bit like the old bits of wood I keep after doing a job that the wife moans about. Having access to them is always good for the future.
Hello Jag, good to hear from you again. Vb5prgrmr says we have to go a long way to lengthen this thread to hold a record. Might happen?. Very interesting comment you made on seperating msvbvm60.dll, will try that one. I am only using the USB1.1 device, and as mentioned definately runs slower filling a flexgrid from a recordsource. I'm happy as it's portable and with Standalone is just that. All the best.
 
Hello JAG14,

I could not find anything when I went to this link as you posted above:

Goto and search for Stand-Alone Express

I am very interested in a product such as you described. Do you have a link that goes directly to their product or at least a category to narrow the search?

Thanks!

Have a great day!

j2consulting@yahoo.com
 
SBend,

That was a mistake I made before, sorry..
The product is called &quot;Stand-Alone Xpress&quot; (minus the E)
A search for the above term will bring up the software.

Zor,

I have a shedload of old bits of wood if you feel like annoying the wife, I may put them on eBay (Buyer Pays All Postage) ;-)

On the note of the running a DB from different speed USB Disks, I marked a 290% Increase in speed (from USB1.1 to USB2.0) Loading a 300 Record DB into a flexgrid.

Nothing like a useful piece of information on a monday night.

Take Care All,


jgjge3.gif
[tt]&quot;Very funny, Scotty... Now Beam down my clothes.&quot;[/tt]
 
Thanks, its Stand-Alone XPress, not Stand-Alone Express.

Have a great day!

j2consulting@yahoo.com
 
yup

jgjge3.gif
[tt]&quot;Very funny, Scotty... Now Beam down my clothes.&quot;[/tt]
 
Thanks Jag, I might take you up on the wood, although my wife might take up carpentry lessons and make my coffin as a first project.
Thats a really interesting increase in performance with the USB2.0 version. Don't know where BiggerBrother's gone after waking this thread back up again. Thanks for the info, I will look out for 2.0 version. People seem to be selling and stocking these sticks without much knowledge of versions. Will do a google search. Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top