파일 다운로드 에러
큰나래
오류에 대하여 질문하신다면, 어느 부분에서 어떤 내용의 오류가 나는지를 써주세요.
안녕하세요. 제가 지금 비베 시작한지 몇달바께 안되서 잘이해가 안가는 부분이 있어서 고구마 분들께 질문좀 드리겠습니다.
제가 알고싶은 것은 소스는 멀쩡한거같은데 나중에 해보면 에러가 나서 질문드립니다.
Private Declare Function SendMessage Lib user32 Alias SendMessageA _(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Sub ReleaseCapture Lib user32 ()Const WM_NCLBUTTONDOWN = &HA1Const HTCAPTION = 2Dim WinHttp As New WinHttpRequest
Option ExplicitPrivate Declare Function GetWindowLong Lib user32 Alias GetWindowLongA (ByVal hWnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib user32 Alias SetWindowLongA (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function SetLayeredWindowAttributes Lib user32 (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPrivate Const GWL_EXSTYLE = (-20)Private Const WS_EX_LAYERED = &H80000Private Const LWA_ALPHA = &H2
Private conet_new As BytePrivate conet_now As BytePrivate wz_new As BytePrivate wz_now As Byte
Private WithEvents http As WinHttpRequestPrivate mContentLength As LongPrivate mProgress As LongDim sHeader As StringDim sFileName As String
Private wzch1_new As String
Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Dim lngReturnValue As LongIf Button = 1 ThenCall ReleaseCaptureMakeLayeredWnd Me.hWndSetLayeredWindowAttributes Me.hWnd, 0, 255 * (0.5), LWA_ALPHAlngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)SetLayeredWindowAttributes Me.hWnd, 0, 255 * (0.99), LWA_ALPHAEnd IfEnd Sub
Public Function MakeLayeredWnd(hWnd As Long) As LongDim WndStyle As LongWndStyle = GetWindowLong(hWnd, GWL_EXSTYLE)WndStyle = WndStyle Or WS_EX_LAYEREDMakeLayeredWnd = SetWindowLong(hWnd, GWL_EXSTYLE, WndStyle)End Function
Private Sub Form_Load()Timer1.Enabled = FalseTimer2.Enabled = FalseTimer3.Enabled = FalseLabel1.Caption = 버전체크중...WinHttp.Open GET, http://hyunop312.dothome.co.kr/conet.txtWinHttp.Sendconet_new = StrConv(WinHttp.ResponseBody, vbUnicode)conet_now = 1If conet_new = conet_now ThenElseIf conet_new conet_now Then
End IfLabel1.Caption = 버전체크중...WinHttp.Open GET, http://hyunop312.dothome.co.kr/wz.txtWinHttp.Sendwz_new = StrConv(WinHttp.ResponseBody, vbUnicode)wz_now = 0If wz_new = wz_now ThenElseIf wz_new wz_now ThenTimer3.Enabled = TrueLabel3.Caption = Label3.Caption + 1End IfEnd Sub
Private Sub http_OnResponseDataAvailable(Data() As Byte)On Error GoTo Err: mProgress = mProgress + UBound(Data) + 1 pb2.value = mProgress Put #1, , DataExit Sub
Err:MsgBox 알수없는 오류가 발생했습니다., vbCritical, 오류End Sub
Private Sub http_OnResponseFinished()On Error GoTo Err:Close #1MsgBox 다운로드 완료!, , 다운로드EndErr:End Sub
Private Sub http_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)On Error GoTo Err:sHeader = http.GetAllResponseHeaders()mProgress = 0mContentLength = CLng(http.GetResponseHeader(Content-Length))pb2.Max = mContentLengthOpen App.Path & \ & sFileName For Binary As #1Exit SubErr:MsgBox 알수없는 오류가 발생했습니다., vbCritical, 오류End Sub
Private Sub Timer2_Timer()Dim strURL As StringstrURL = getFileURL(txtID, txtNo)If strURL = ThenMsgBox 파일 링크 추출 실패!, vbCritical, 오류Exit SubEnd IfDim arr() As Stringarr = Split(strURL, /)sFileName = arr(UBound(arr))Set http = New WinHttpRequesthttp.Open GET, strURL, Truehttp.SendEnd Sub
Private Sub Timer3_Timer()If Label3.Caption = 1 ThenWinHttp.Open GET, http://hyunop312.dothome.co.kr/wzch1.txtWinHttp.Sendwzch1_new = StrConv(WinHttp.ResponseBody, vbUnicode)txtNo.Text = wzch1_newTimer2.Enabled = TrueTimer3.Enabled = FalseEnd IfIf Label3.Caption = 2 ThenEndEnd IfEnd Sub
일단 위에 소스를 보면 알수있듯이 타이머 3이 켜지면 라벨의 캡션이 1올라가고 타이머에서 라벨이 1일경우 닷홈 호스팅에서 블로그 뒷자리 숫자주소를 얻어오고 그걸 txtNo텍박에 텍스트를 띄웁니다.그리고 타이머 2가 켜지고 타이머 3가 꺼지며 타이머 2에서 부터 제가 잘모르겠는데요 저부분에서 파일을 다운받으면 그때부터 계속 알수없는 오류가 발생합니다. 이거 해결방법이 없을까요? ㅎㅎ
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2701184 | 자동업데이트 다른질문 (1) | 꽃햇님 | 2025-07-11 |
2701160 | 관리프로그렘을 제작하고있는대요 (2) | 똘끼 | 2025-07-11 |
2701131 | 현재 폼이 비활성화인지 활성화인지 확인하는방법 | 동생몬 | 2025-07-11 |
2701099 | 배포한 파일 업데이트 (2) | 블레이 | 2025-07-11 |
2701014 | Text1에 있는 폴더를.. (9) | 들빛 | 2025-07-10 |
2700987 | 파일다운로드하는법 | 거북이 | 2025-07-10 |
2700933 | 사이트로그인 만들기 런타임424 (2) | 돌삥 | 2025-07-09 |
2700901 | 비베를 배우려고하는데 어떻게해야하는지 | 바람 | 2025-07-09 |
2700829 | 크롬 or 파폭 or 사파리 컨트롤 (5) | 리라 | 2025-07-08 |
2700772 | 이것좀 도와주세여. | 아이처럼 | 2025-07-08 |
2700747 | 확장자 바꾸는법 질문좀 | 착히 | 2025-07-07 |
2700722 | Shell 파일실행 재질문합니다. (10) | 해긴 | 2025-07-07 |
2700696 | 메일보내기 소스좀요 ㅠㅠ | 하람 | 2025-07-07 |
2700563 | 텍스트 모으기 | 맨삶이 | 2025-07-06 |
2700531 | 파일아이 자동로그인 주소로 햇는데 안돼요 . | 불꾼 | 2025-07-05 |
2700462 | 데이터형 확인하는 함수 알려주세요... (10) | 기쁨해 | 2025-07-05 |
2700427 | 비베에서 라고 안나올떄요 | 개랑 | 2025-07-04 |
2700401 | Winhttp 로그인부분과 게시글문제 (5) | 벤자민 | 2025-07-04 |
2700314 | 비주얼베이직 안의 텍스트를, HTML 처럼 왕복하게 만들수는 없을까요 ? | 초롬 | 2025-07-03 |
2700288 | 초등부정보올림피아드 공부할책좀추천해주시면감사하겠습니다. | 아유미 | 2025-07-03 |