i wrote a vb6 program that will upload a file to an ftp and i use an inet controls
my question is when i compile the program does it need the ocx file for no vb6 users of my program??..
if yes , how do i make it standalone??.. thanx
Printable View
i wrote a vb6 program that will upload a file to an ftp and i use an inet controls
my question is when i compile the program does it need the ocx file for no vb6 users of my program??..
if yes , how do i make it standalone??.. thanx
If you wish to use any ocx or dll that is not included in the basic vb workspace you will need to include a copy. This copy can be placed in either the folder in which the compiled executable is located or the system32 folder.
Try looking into the Package and Deployment wizard, it automates the process for you.
You can also look up how to use resource files with your application as another alternative.
how does resource file works can you link me to an example.. thnx to ur reply
ok i got the resource work
but how can i make if it is registered dont registered or extract but it is not registered it?..
ok i got it but it has an error before it registers the ocx file i tried the "on error resume next" but it didnt work...it says that the file is missing
it should be registered by the installation package, if it is not being registered by the installation, you need to look at the method you are using to build the package, if you don't figure this try the application deployment forum
i don't believe you can register an OCX, or other referenced file, from within your program, as they are referenced as soon as the program starts
if you do not wish to deploy the inet ocx you can probably use api functions to do ftp upload, which will not require any additional files
can you give me that api
add the ftp module attached
then use code like
vb Code:
Dim session As Long, server As Long, ftpserver As String, user As String, pass As String Dim ret As Long, localfile As String, remotefile As String ftpserver = ' your ftp server user = 'login name pass = 'password localfile = App.Path & "\" & fname remotefile = fname session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE) server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, 1, 0, 0) ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0) InternetCloseHandle server InternetCloseHandle session
There are APIs to register ocx's. But another method is to use the cmd method
Code:shell "cmd /c regsvr32 /s " & app.path & "\msInet.ocx"
Quote:
Originally Posted by westconn1
thank you very much
can you make me an example project on how to upload a file because this is my first time to handle with API ....
make a new project, add the module, put the code above in a command button event, edit to give real values for localfile, remotefile, ftpserver, user and pass,
do not use app.path unless you save the project first, make sure some file is in the correct place (path\filename) for localfile
ret will = 1 if the file uploads correctly
thank you very much westconn1 your such a very good programmer
Quote:
Originally Posted by westconn1
If i have a folder called "data1" on my server, should the code look like this??
It does not upload my file.txtCode:localfile = App.Path & "\data1\" & "file.txt"
remotefile = "file.txt"
what is the value of ret after the upload, put
msgbox ret
on the line after ftpputfile, see what the return value is
your local computer or the ftp server??Quote:
If i have a folder called "data1" on my server
unless you change directory on the ftp server it will upload to the current root directory, changing the file name will not affect the folder it is copied into, if the folder is not on the local computer the file will not be found to upload
I got it worked :check:
I put msg box, and it was "0" . I changed the "\data1\" to "\" and then msg was "1" , i checked and i found my file.txt on root directory.
I tried so many options before and i failed everytime :P but , anyway, thanks westconn1 :)
I don't know how to set the directory \data1\ instead of root, but it's not very important, ok, going to read some more papers about VB ;)
:thumb:Thanks for a brilliant Post Westconn1.. :thumb:
I'm Now able to Upload in Ascii mode.
Is there a way to set CHMOD with this API?
A thing to mention; the server address must be in the form of .
Upload fails if this format is used.Code:ftp.someurl.com
Regards to allCode:ftp://ftp.someurl.com
~Mike~