웹프로그래밍

Global It Leader!!


컴퓨터언어


 
 

VB inet을 이용한 UTF-8 소스 읽어오기

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 5,148회 작성일 15-02-11 19:51

본문

 Private Declare Sub RtlMoveMemory Lib "kernel32" ( _
     ByRef Destination As Any, _
     ByRef Source As Any, _
     ByVal Length As Long _
)

Private Declare Function MultiByteToWideChar Lib "kernel32.dll" (ByVal CodePage As Long, ByVal dwFlags As Long, ByRef lpMultiByteStr As Any, ByVal cbMultiByte As Long, ByRef lpWideCharStr As Any, ByVal cchWideChar As Long) As Long
Private Const CP_UTF8 As Long = 65001

Private Const CHUNK_SIZE& = 4096&

Private Function OpenURLWithIE2(ByVal URL As String, ByRef Inet As Inet) As String
'-- 제작자 : 수학쟁이(startgoora)
'-- 수정자 : 축복(q_death)
     Dim TotBuf() As Byte, ChunkedBuf() As Byte, Converted() As Byte, ni As Long

     With Inet
          .Cancel
          .URL = URL
          .Execute , "GET", inputhdrs:="User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)" & vbCrLf
         
          Do While .StillExecuting
               DoEvents
          Loop
         
          ChunkedBuf() = .GetChunk(CHUNK_SIZE, icByteArray)
         
          Do While UBound(ChunkedBuf) >= 0
               ni = ni + UBound(ChunkedBuf) + 1
               ReDim Preserve TotBuf(ni - 1)
               RtlMoveMemory TotBuf(ni - UBound(ChunkedBuf) - 1), ChunkedBuf(0), UBound(ChunkedBuf) + 1&
               ChunkedBuf() = .GetChunk(CHUNK_SIZE, icByteArray)
          Loop
     End With
   
     Dim lSize As Long
     lSize = MultiByteToWideChar(CP_UTF8, 0&, TotBuf(0), UBound(TotBuf) + 1&, ByVal 0&, 0&)
   
     ReDim Converted(lSize * 2 - 1)
     MultiByteToWideChar CP_UTF8, 0&, TotBuf(0), UBound(TotBuf) + 1&, Converted(0), lSize
   
     OpenURLWithIE2 = Converted
End Function

댓글목록

등록된 댓글이 없습니다.

전체 441
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5149 02-11
300 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5137 02-11
299 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4980 02-07
298 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4690 02-04
297 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4760 02-03
296 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4902 01-12
295 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5009 09-12
294 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5302 09-06
293 Mysql no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4923 09-02
292 Mysql no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4761 09-02
291 PHP no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6536 08-19
290 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4758 08-04
289 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4710 04-04
288 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5080 03-21
287 Mysql no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4989 03-20
286 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16195 02-14
285 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7904 02-14
284 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5357 01-30
283 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4988 01-30
282 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4969 01-30