Results 1 to 12 of 12

Thread: How can i do these 2 things...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    How can i do these 2 things...

    Totally unrelated but how can i do them...

    1. Let my program connect up to the internet and save a file on the site so then they can load it later? This would probably have to include an accounts system.

    2. Make it work with a webcam so maybe like one of those webcam games where you can move and then virtual things can bounce off you?

  2. #2
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: How can i do these 2 things...

    Can you be more specific?

  3. #3
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: How can i do these 2 things...

    1. Inet (Internet Transfer Control)
    2. Winsock perhaps...

    Search the forums for both or check the Network FAQ.

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: How can i do these 2 things...

    By webcam games, I assume he means the "interactive" webcam games on the PS2 where you are a part of the game...way too complex to cover here :-)

    And regarding connecting to a site and uploading a file, you first need upload access on the site...it'd be better if you go more into detail about what you plan to do with that file, I think
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: How can i do these 2 things...

    Ok, ignore the webcam thing, it was just a thought and a quick idea i had.

    So concentrating more on uploading a file.. Well the program i made saves this file but the next version will have a game element to it and the files are easy to change so i would like people to be able to upload their files to my website. I use *.igc although i just kinda made that extension up. They're just text files really and there'd be a load and save thing inside the program and then they can load and save the files off the website.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: How can i do these 2 things...

    Anyone?

  7. #7
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: How can i do these 2 things...

    Try FTP.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: How can i do these 2 things...

    Ok, i'm sure that if i'm writing a program i can't just tell it to "try FTP" so i'll need more specific instructions than that lol.

  9. #9
    Lively Member Mr. G's Avatar
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    107

    Re: How can i do these 2 things...


  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    Re: How can i do these 2 things...

    Ok, i didn't understand a bit of that. Could someone PLEASE just explain it with lots of detail so i can actually understand what to do to make it work.

  11. #11
    Member
    Join Date
    Dec 2006
    Posts
    53

    Re: How can i do these 2 things...

    If you just want a small bit uploaded to a website... Try making an ASP page with a querystring input that reads pages with ? headers:

    mysite.com/myasp.asp?usersInput=something+new

    then make your vb6 program use MS INET or the WEBBROWSER control to connect to the asp page and add the small bit of information after the ? ...

    or instead of the ? style, try the "POST" method... Probably the easiest way to upload something to the internet...
    Help me win cash, vote for my code: Random Quotes - Setting / Retrieving Cookies

  12. #12
    Lively Member Mr. G's Avatar
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    107

    Re: How can i do these 2 things...

    First, put this code at the top of you're app.

    VB Code:
    1. Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
    2. Const FTP_TRANSFER_TYPE_ASCII = &H1
    3. Const FTP_TRANSFER_TYPE_BINARY = &H2
    4. Const INTERNET_DEFAULT_FTP_PORT = 21               ' default for FTP servers
    5. Const INTERNET_SERVICE_FTP = 1
    6. Const INTERNET_FLAG_PASSIVE = &H8000000            ' used for FTP connections
    7. Const INTERNET_OPEN_TYPE_PRECONFIG = 0                    ' use registry configuration
    8. Const INTERNET_OPEN_TYPE_DIRECT = 1                        ' direct to net
    9. Const INTERNET_OPEN_TYPE_PROXY = 3                         ' via named proxy
    10. Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4   ' prevent using java/script/INS
    11. Const MAX_PATH = 260
    12. Private Type FILETIME
    13.     dwLowDateTime As Long
    14.     dwHighDateTime As Long
    15. End Type
    16. Private Type WIN32_FIND_DATA
    17.     dwFileAttributes As Long
    18.     ftCreationTime As FILETIME
    19.     ftLastAccessTime As FILETIME
    20.     ftLastWriteTime As FILETIME
    21.     nFileSizeHigh As Long
    22.     nFileSizeLow As Long
    23.     dwReserved0 As Long
    24.     dwReserved1 As Long
    25.     cFileName As String * MAX_PATH
    26.     cAlternate As String * 14
    27. End Type
    28. Private Declare Function InternetCloseHandle Lib "wininet" (ByRef hInet As Long) As Long
    29. Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
    30. Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
    31. Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    32. Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
    33. Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    34. Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    35. Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
    36. Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
    37. Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
    38. Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
    39. Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
    40. Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
    41. Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
    42. Const PassiveConnection As Boolean = True

    Then this where you want it to upload the file:

    VB Code:
    1. 'KPD-Team 2000
    2.     'URL: [url]http://www.allapi.net[/url]
    3.     'E-Mail: [email][email protected][/email]
    4.     Dim hConnection As Long, hOpen As Long, sOrgPath  As String
    5.     'open an internet connection
    6.     hOpen = InternetOpen("API-Guide sample program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    7.     'connect to the FTP server
    8.     hConnection = InternetConnect(hOpen, "your ftp server", INTERNET_DEFAULT_FTP_PORT, "your login", "your password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
    9.     'create a buffer to store the original directory
    10.     sOrgPath = String(MAX_PATH, 0)
    11.     'get the directory
    12.     FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)
    13.     'create a new directory 'testing'
    14.     FtpCreateDirectory hConnection, "testing"
    15.     'set the current directory to 'root/testing'
    16.     FtpSetCurrentDirectory hConnection, "testing"
    17.     'upload the file 'test.htm'
    18.     FtpPutFile hConnection, "C:\test.htm", "test.htm", FTP_TRANSFER_TYPE_UNKNOWN, 0
    19.     'rename 'test.htm' to 'apiguide.htm'

    Replace the examples in the second code with the code you want.

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