|
-
Jan 2nd, 2007, 11:35 AM
#1
Thread Starter
Addicted Member
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?
-
Jan 2nd, 2007, 11:53 AM
#2
Re: How can i do these 2 things...
Can you be more specific?
-
Jan 2nd, 2007, 12:04 PM
#3
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.
-
Jan 2nd, 2007, 12:13 PM
#4
PowerPoster
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.
-
Jan 2nd, 2007, 12:37 PM
#5
Thread Starter
Addicted Member
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.
-
Jan 3rd, 2007, 09:02 AM
#6
Thread Starter
Addicted Member
Re: How can i do these 2 things...
-
Jan 3rd, 2007, 09:14 AM
#7
Frenzied Member
Re: How can i do these 2 things...
-
Jan 3rd, 2007, 10:57 AM
#8
Thread Starter
Addicted Member
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.
-
Jan 3rd, 2007, 11:13 AM
#9
Lively Member
Re: How can i do these 2 things...
-
Jan 3rd, 2007, 11:30 AM
#10
Thread Starter
Addicted Member
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.
-
Jan 3rd, 2007, 12:24 PM
#11
Member
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...
-
Jan 3rd, 2007, 02:26 PM
#12
Lively Member
Re: How can i do these 2 things...
First, put this code at the top of you're app.
VB Code:
Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const FTP_TRANSFER_TYPE_BINARY = &H2
Const INTERNET_DEFAULT_FTP_PORT = 21 ' default for FTP servers
Const INTERNET_SERVICE_FTP = 1
Const INTERNET_FLAG_PASSIVE = &H8000000 ' used for FTP connections
Const INTERNET_OPEN_TYPE_PRECONFIG = 0 ' use registry configuration
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS
Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Private Declare Function InternetCloseHandle Lib "wininet" (ByRef hInet As Long) As Long
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
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
Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
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
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
Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
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
Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Const PassiveConnection As Boolean = True
Then this where you want it to upload the file:
VB Code:
'KPD-Team 2000
'URL: [url]http://www.allapi.net[/url]
Dim hConnection As Long, hOpen As Long, sOrgPath As String
'open an internet connection
hOpen = InternetOpen("API-Guide sample program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
'connect to the FTP server
hConnection = InternetConnect(hOpen, "your ftp server", INTERNET_DEFAULT_FTP_PORT, "your login", "your password", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
'create a buffer to store the original directory
sOrgPath = String(MAX_PATH, 0)
'get the directory
FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)
'create a new directory 'testing'
FtpCreateDirectory hConnection, "testing"
'set the current directory to 'root/testing'
FtpSetCurrentDirectory hConnection, "testing"
'upload the file 'test.htm'
FtpPutFile hConnection, "C:\test.htm", "test.htm", FTP_TRANSFER_TYPE_UNKNOWN, 0
'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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|