|
-
Nov 23rd, 2000, 10:08 AM
#1
Thread Starter
Addicted Member
I need help, I’m writing an app that uses custom data and I want to be able to (copy this data to the clipboard/drag from the app) and then (paste/drop to file system). The files will be simple ASCII files so writing them is not a problem, but my custom data takes a while to construct. I'm guessing i will need some sort of OLE server, but don't know where to begin.
-
Nov 23rd, 2000, 12:34 PM
#2
Thread Starter
Addicted Member
Can nobody help me with this?
-
Nov 23rd, 2000, 12:45 PM
#3
Member
What kind of data/app and what do you mean with file system?
Life is trip, eat it and smile.
-
Nov 23rd, 2000, 01:12 PM
#4
Thread Starter
Addicted Member
O.K the custom data is stored on a remote server that has a custom data interface that I handle, this means is not accessible via the standard windows file system or by any other standard like FTP. I have to collect the data myself into my VB app. Once it is there I want to write away to the local windows file system somthing like this..
Code:
' Get the data from the remote server
mydata = GetRemoteData
' now write this away to a file
open "c:\data.dat" for output as #1
print #1,mydata
close #1
how I get the data does not matter, but I have GUI that displays this data like the explorer displays directories and files (i am using a TreeView). With this I want to select some data (nodes), copy/paste or drag to the desktop or the explorer. Now an application like an FTP program or indeed WinZip does this, their data is held in a place not accessible to the file system but they allow copy/paste and drag/drop to the desktop or explorer. I want to mimic this.
Sorry it's bit of longwinded explanation, but I want to be clear as to what I want to do.
-
Nov 23rd, 2000, 01:35 PM
#5
Thread Starter
Addicted Member
I have found a method of draging to the desktop that almost works, the problem is that my routine is so slow at getting the data the user has to hold down the mouse button until the data is retrieved. I am including some code that mimics this. What I want do do is to write the files away on the drop event, but VB complains of a file sharing error because the desktop shell is trying to move the file whislt I am creating it!
open a new project and on your form insert an listview control, then paste this code in. Try and drag to the desktop any of the listitems.
Code:
Option Explicit
Private Sub Form_Load()
ListView1.ColumnHeaders.Add , , "Name"
ListView1.ListItems.Add , , "Test 1"
ListView1.ListItems.Add , , "Test 2"
ListView1.ListItems.Add , , "Test 3"
End Sub
Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
ListView1.OLEDrag
End If
End Sub
Private Sub ListView1_OLESetData(Data As MSComctlLib.DataObject, DataFormat As Integer)
Dim lngcount As Long
Open "C:\Temp\" & ListView1.SelectedItem For Output As #1
For lngcount = 1 To 100000
DoEvents
Print #1, Timer & " " & ListView1.SelectedItem & "this is a test file"
Next
Close #1
Data.Files.Add "C:\Temp\" & ListView1.SelectedItem
End Sub
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
Data.SetData , vbCFFiles
AllowedEffects = vbDropEffectMove
End Sub
you will notice the doevents inside of the file write loop, this is used because my actual data retrieval method behaves like this. :<
[Edited by darrenl on 11-24-2000 at 07:13 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|