Results 1 to 16 of 16

Thread: [RESOLVED] INET.ocx will be needed???

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Resolved [RESOLVED] INET.ocx will be needed???

    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

  2. #2
    Fanatic Member Mxjerrett's Avatar
    Join Date
    Apr 2006
    Location
    Oklahoma
    Posts
    939

    Re: INET.ocx will be needed???

    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.

    If a post has been helpful please rate it.
    If your question has been answered, pull down the tread tools and mark it as resolved.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    how does resource file works can you link me to an example.. thnx to ur reply

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    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?..

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    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

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: INET.ocx will be needed???

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    can you give me that api

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: INET.ocx will be needed???

    add the ftp module attached
    then use code like
    vb Code:
    1. Dim session As Long, server As Long, ftpserver As String, user As String, pass As String
    2. Dim ret As Long, localfile As String, remotefile As String
    3. ftpserver = ' your ftp server
    4. user = 'login name
    5. pass = 'password
    6. localfile = App.Path & "\" & fname
    7. remotefile = fname
    8.  
    9. session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
    10. server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, 1, 0, 0)
    11. ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0)
    12. InternetCloseHandle server
    13. InternetCloseHandle session
    Attached Files Attached Files
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9
    Fanatic Member Mxjerrett's Avatar
    Join Date
    Apr 2006
    Location
    Oklahoma
    Posts
    939

    Re: INET.ocx will be needed???

    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"

    If a post has been helpful please rate it.
    If your question has been answered, pull down the tread tools and mark it as resolved.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    Quote Originally Posted by westconn1
    add the ftp module attached
    then use code like
    vb Code:
    1. Dim session As Long, server As Long, ftpserver As String, user As String, pass As String
    2. Dim ret As Long, localfile As String, remotefile As String
    3. ftpserver = ' your ftp server
    4. user = 'login name
    5. pass = 'password
    6. localfile = App.Path & "\" & fname
    7. remotefile = fname
    8.  
    9. session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
    10. server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, 1, 0, 0)
    11. ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0)
    12. InternetCloseHandle server
    13. InternetCloseHandle session

    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 ....

  11. #11
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: INET.ocx will be needed???

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    Re: INET.ocx will be needed???

    thank you very much westconn1 your such a very good programmer

  13. #13
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Re: INET.ocx will be needed???

    Quote Originally Posted by westconn1
    add the ftp module attached
    then use code like
    vb Code:
    1. Dim session As Long, server As Long, ftpserver As String, user As String, pass As String
    2. Dim ret As Long, localfile As String, remotefile As String
    3. ftpserver = ' your ftp server
    4. user = 'login name
    5. pass = 'password
    6. localfile = App.Path & "\" & fname
    7. remotefile = fname
    8.  
    9. session = InternetOpen(App.EXEName, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, INTERNET_FLAG_NO_CACHE_WRITE)
    10. server = InternetConnect(session, ftpserver, INTERNET_INVALID_PORT_NUMBER, user, pass, 1, 0, 0)
    11. ret = FtpPutFile(server, localfile, remotefile, FTP_TRANSFER_TYPE_BINARY, 0)
    12. InternetCloseHandle server
    13. InternetCloseHandle session

    If i have a folder called "data1" on my server, should the code look like this??


    Code:
     localfile = App.Path & "\data1\" & "file.txt"
    
          remotefile = "file.txt"
    It does not upload my file.txt

  14. #14
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [RESOLVED] INET.ocx will be needed???

    what is the value of ret after the upload, put
    msgbox ret
    on the line after ftpputfile, see what the return value is
    If i have a folder called "data1" on my server
    your local computer or the ftp 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 do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  15. #15
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Re: [RESOLVED] INET.ocx will be needed???

    I got it worked

    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

  16. #16
    New Member
    Join Date
    Jan 2007
    Posts
    7

    Re: [RESOLVED] INET.ocx will be needed???

    Thanks for a brilliant Post Westconn1..
    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 .
    Code:
    ftp.someurl.com
    Upload fails if this format is used.
    Code:
    ftp://ftp.someurl.com
    Regards to all
    ~Mike~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width