Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all 1542 articles
Browse latest View live

VB6 SHOW 3DMAX (Cult3D ActiveX Player),CO File format

$
0
0
Cult3D ActiveX Player

Cult3DP1.Visible = True
Cult3DP1.LoadCult3D App.Path & "\sun.co"

download 3d ocx:
http://www.web3d.com.cn/plugin/cult3d.html

how to use Cult3DP1?
Cult3DP1.***
Private Sub Cult3DP1_OnSendMessage(ByVal Message As String)
Me.Caption = "Message=" & Message
End Sub

VB6 2D-ChartPlotting (using the RC6.cChart HelperClass)

$
0
0
Just a little Demo, how to work with the new RC6.cChart-Class (requiring an RC6-version >= 6.0.3).

This Class follows a somewhat different pattern, compared to other Chart-Controls -
because it supports a "virtual concept" which:
- doesn't define the Chart-behaviour (or Type) as much via Properties
- but via OwnerDraw-Events instead

To "catch" these Events (to draw your own "ChartType"):
- you have to define your own Class (per ChartType)
- and in this Class, you will receive the OwnerDraw-Events

Example for such a UserDefined CharType-Class
(taken from the zipped example below, responsible for rendering the chart at the right-hand-side of the following ScreenShot):
Code:

Option Explicit

Public WithEvents Chart As cChart

Private Sub Class_Initialize()
  Set Chart = New_c.Chart
End Sub
 
'**** Class-specific Implementation of the Chart-Events *****
Private Sub Chart_DrawChartBackGroundAndTitle(CC As cCairoContext, ByVal Title As String)
  CC.Paint 1, Cairo.CreateSolidPatternLng(vbWhite)
  CC.SelectFont "Times New Roman", 13, &H222222, True, True
  CC.DrawText 0, 0, CC.Surface.Width, 50, Title, True, vbCenter, 3, True
End Sub
 
Private Sub Chart_OverrideAxisProps(Axis As cChartAxis, ByVal CurrentMin As Double, ByVal CurrentMax As Double, ByVal CurrentTickIntervals As Long)
  If Axis.Name = "X" Then Axis.TickIntervals = 10
End Sub

Private Sub Chart_DrawSingleTickForAxis(Axis As cChartAxis, CC As cCairoContext, ByVal TickValue, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long)
  Select Case UCase$(Axis.Name)
    Case "X"
      CC.DrawLine x, y, x, y + dy + 4, True, 1, vbRed, 0.5
      Axis.DrawTickText CC, x, y + 6, Format$(TickValue, "0.00")
    Case "Y"
      CC.DrawLine x - 4, y, x + dx, y, True, 1, vbBlue, 0.5
      Axis.DrawTickText CC, x - 4, y, Format$(TickValue, "0.00")
  End Select
End Sub
 
Private Sub Chart_DrawData(CC As cCairoContext, DataArr() As Variant, ByVal dx As Long, ByVal dy As Long)
  Dim PolyArr As cArrayList
  Set PolyArr = Chart.GetAxisScaledPolyArrXY(DataArr, Chart.AxisCol("X"), Chart.AxisCol("Y"))
 
  CC.SetLineWidth 2
  CC.PolygonPtr PolyArr.DataPtr, PolyArr.Count \ 2, False, splNormal, True, True
  CC.Stroke , Cairo.CreateSolidPatternLng(vbGreen)
End Sub

Here a ScreenShot:


Here is the zipped Demo-Code, which produced the above output:
ChartPlot.zip

Have fun,

Olaf
Attached Files

Convert hBitmap to hImage with GDI, it is possible?

$
0
0
Hello everyone,

I would like to know if hBitmap can be passed to hImage.

Let me explain, I am making a program that displays the covers extracted from the ITAG metadata of mp3 music files in a Picturebox.

In ‘Sub DrawImage (…)’, is where the images are loaded.

At this point I thought, well ... if I already have the image loaded in the variable 'Cover' type 'hBitmap' as a variable 'Publish' for the whole program, why not take advantage of it and not have to save it to a JPG file and then in a DrawImage () program line in 'GdipLoadImageFromFile (StrPtr (FileName), hImage)' have to load it back into variable 'FileName' and process the image 2 times.

Here's the problem, once the library 'GdipLoadImageFromFile' loads the temporary jpg file, it returns it as 'hImage'.

I think that in order not to waste so much time in this process and the images are loaded faster in the control there may be another solution.
I've been looking at libraries and there's one called 'GdipLoadImageFromStream (…) I don't know if it could work.

I hope you have explained me well and can help me.

This is what I am doing so far and it works, but could it be improved with the aforementioned ???

Code:

Private Sub DrawImage(hGraphics As Long, Index As Long, FileName As String, DestTR As RECTF)

    Dim TR As RECTF
    Dim Conver As Long
    Dim hImage As Long
    Dim ImagPlayMow As Long
    Dim PLeft As Long, PTop As Long
    Dim ReqWidth As Long, ReqHeight As Long
    Dim HScale As Double, VScale As Double
    Dim MyScale As Double
    Dim ImgWidth As Long
    Dim ImgHeight As Long
    Dim SourceHDC As Long
    Dim TempFile As String
   
If mLoadCover = FromMusicFile Then
   
    TempFile = App.Path & "\tmpCover.jpg"
    Call LoadTag(FileName)                'Calls the object that extracts the album art from the MP3 and saves it in the variable 'Cover' = hBitmap
    Call SavePicture(Cover, TempFile) 'Save the image of the variable 'Cover' in the temporary file' tmpCover.jpg '
    FileName = TempFile
End If


If GdipLoadImageFromFile(StrPtr(FileName), hImage) = 0 Then  'Open the temporary jpg  image.

    Call GdipGetImageBounds(hhImage, TR, UnitPixel)
       
        ImgWidth = TR.nWidth
        ImgHeight = TR.nHeight
       
        ArrDimensions(Index) = ImgWidth & " x " & ImgHeight
 
        If ImgWidth > DestTR.nWidth Or ImgHeight > DestTR.nHeight Then
            HScale = DestTR.nWidth / ImgWidth
            VScale = DestTR.nHeight / ImgHeight
       
            MyScale = IIf(VScale >= HScale, HScale, VScale)
           
            ReqWidth = ImgWidth * MyScale
            ReqHeight = ImgHeight * MyScale
   
            PLeft = DestTR.nLeft
            PTop = DestTR.nTop + 1
        Else
            ReqWidth = ImgWidth
            ReqHeight = ImgHeight
            PLeft = DestTR.nLeft
            PTop = DestTR.nTop + 1
        End If
   
        ReqWidth = ItemHeight - 10
        ReqHeight = ItemHeight - 10
     
        GdipDrawImageRectRectI hGraphics, hhImage, PLeft, PTop, ReqWidth, ReqHeight, 0, 0, ImgWidth, ImgHeight, UnitPixel, 0&, 0&, 0&
        Call GdipDisposeImage(hhImage)
End If
       
End Sub

Thanks.

[Add-In] Large Project Organiser (alternative Project Explorer) - No sub-classing!

$
0
0
Undeterred by the lukewarm reception of my tab-Strip Add-In :D, here I am with another one. Gotta fill-up those lock-down days doing something, eh?

This one is thought as a replacement for the built-in Project Explorer, and may be useful to somebody who is working with a large project. The idea (and not an original one!) is that you can organise your projects into something more meaningful than simply a list of Component Types: As illustrated below, create appropriate Groups and drag/drop into those

Overview




Cloning

And one is not limited to doing this on a one-to-one basis, either. Here I am cloning an item into more than one Group (via the CTRL key), just to show that that's possible, too:





Ordering

And, finally, one can order the Groups, however they see fit....



Download

...and here's the code:

ProjEx Addin.zip

Updated with the problem identified in post #2 fixed.
Attached Files

vb6 add table rows webbrowser

$
0
0
Please Help
Add web page table lines

code html

HTML Code:

<html dir="rtl">

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>aa</title>
</head>

<body>

<div align="center">
        <table border="1" id="ss" cellpadding="0" style="border-collapse: collapse" width="13%" dir="rtl">
                <tr>
                        <td style="color: #FFFFFF" bgcolor="#669999">
                        <p align="center">name</td>
                </tr>
                <tr>
                        <td>&nbsp;</td>
                </tr>
                </table>
</div>

</body>

</html>

code vb

set table = WebBrowser1.document.getElementById("ss");


row = table.insertRow(0);


cell1 = row.insertCell(0);


cell1.innerHTML = "NEW CELL1";

Allengib7952

$
0
0
I have a movie list that seems to work very well click on anyone and movie starts.
My problem is I have a few that have episodes I don't want to show the episodes on the same screen because there is already over 1500 movies in list. I created frmepisodes to do that. I crated a different data base for each set of Series Some are 3 episodes long others are over 70
My problem is When I click on the Movie in DBGrid1 on frmMovie to put me in frmEpisodes How do it get DBGrid2 to show that one. Right now it shows only the one that I gave it name to. I want to avoid giving it a name and When I click on DBGrid1 to change the setting on DBGrid2 located on a different frm
I have built 7 databases each with just the shows from the series for it.
The short list is as an example is 10th kingdome is 3 Episodes. and Asceansion is 12 Episodes
I want DBGrid2 to only show the one I click on.

vb6 Secure Websocket

$
0
0
Secure webSocket in Pure VB6 no external Libraries or ActiveX.
Now wss://localhost:8088 is possible.
Now Lengthy(char length more than 65536) messages possible.

Thanks goes to :
Vladimir Vissoultchev(wqweto)
Olaf Schmidt
and many others.
https://github.com/wqweto/VbAsyncSocket

https://www.vbforums.com/showthread....ushServer-Demo

https://github.com/bloatless/php-websocket

https://www.cnblogs.com/xiii/p/5165303.html



In order to create a self-signed ssl certificate you need open-ssl. In my case I have done it in my cloud server and downloaded.
Follow the instructions given here :

https://www.freecodecamp.org/news/ho...-7af615770eec/

after install the certificate. open rootCa.crt -> Install Certificate - > Next -> Place all certificates in the following store -> Browse
-> Trusted Root Certification Authorities - > OK -> Next - > Finish - > Install/Approve

Download the attachment
vb-websocket.zip

Notes:

I have combined and ported codes from here and there, and given the references, detailed code explanations can be found there.
Attached Files

vb6 Call Cdecl Api by Function(stdcall)

$
0
0
'bind cdecl api to vb6 function
FixCdecl AddressOf VB_Add, CdeclApi, 2
c = VB_Add(a, b)

FORM1 CODE:
Code:

Dim h As Long
Dim CdeclApi_Add As Long

Private Sub Command1_Click()
If CdeclApi_Add = 0 Then
    h = LoadLibrary("cdecl.dll")
    CdeclApi_Add = GetProcAddress(h, "Add")
    FixCdecl GetAddress(AddressOf VB_Add), CdeclApi_Add, 2
End If

Dim a As Long, b As Long, c As Long
a = 44
b = 55

c = VB_Add(a, b)
MsgBox "c=" & c
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
RestoreFunctionMemory
FreeLibrary h
End Sub

Module1.bas
Code:

Option Explicit
Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Public Const PAGE_EXECUTE_READWRITE As Long = &H40
Private Declare Sub CopyMemory2 Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Declare Function WriteProcessMemory2 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function VirtualProtect2 Lib "kernel32" Alias "VirtualProtect" (ByRef lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long  '设置内存可读写
Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Dim OldFunctionAsm(18) As Byte, FunctionPtr As Long, THUNK_SIZE As Long
'演示用,最简化代码
Function VB_Add(ByVal a As Long, ByVal b As Long, Optional NoUsed As Long) As Long
    MsgBox 1
    MsgBox 1
    MsgBox 1
End Function

Sub FixCdecl(VbFunction As Long, CdeclApi As Long, Args As Long) 'GOOD
  'MsgBox "call-FixCdecl"
    Dim Asm(4) As String, Stub() As Byte ', THUNK_SIZE As Long
    '  0: 58                  pop        eax
    '  1: 89 84 24 XX XX XX XX mov        dword ptr [esp+Xh],eax
    Asm(0) = "58 89 84 24 " & LongToHex(Args * 4) '&H24848958
    Asm(1) = "B8 " & LongToHex(CdeclApi)      'B8 90807000    MOV EAX,708090
    Asm(2) = "FF D0"                          'FFD0          CALL EAX
    Asm(3) = "83 C4 " & Hex(Args * 4) '83 C4 XX      add esp, XX    'cleanup args
    Asm(4) = "C3"
   
    Stub() = toBytes(Join(Asm, " "))
    THUNK_SIZE = UBound(Stub) + 1
   
    Dim bInIDE          As Boolean
    Debug.Assert pvSetTrue(bInIDE)
 
    If bInIDE Then
        CopyMemory2 VbFunction, ByVal VbFunction + &H16, 4
    Else
        VirtualProtect2 VbFunction, THUNK_SIZE, PAGE_EXECUTE_READWRITE, 0    '更改函数地址所在页面属性
    End If
    FunctionPtr = VbFunction
   
    CopyMemory2 ByVal VarPtr(OldFunctionAsm(0)), ByVal VbFunction, THUNK_SIZE '保存函数旧数据
    WriteProcessMemory2 -1, VbFunction, VarPtr(Stub(0)), THUNK_SIZE, 0
End Sub
Sub RestoreFunctionMemory() '恢复原来函数的部分汇编代码,必不可少,否则会崩
    If THUNK_SIZE > 0 Then
        WriteProcessMemory2 -1, FunctionPtr, VarPtr(OldFunctionAsm(0)), THUNK_SIZE, 0
    End If
End Sub
Function toBytes(x As String) As Byte()
    Dim tmp() As String
    Dim fx() As Byte
    Dim i As Long
    tmp = Split(x, " ")
    ReDim fx(UBound(tmp))
    For i = 0 To UBound(tmp)
        fx(i) = CInt("&h" & tmp(i))
    Next
    toBytes = fx()
End Function
 Function LongToHex(x As Long) As String
    Dim b(1 To 4) As Byte
    CopyMemory2 b(1), x, 4
    LongToHex = Hex(b(1)) & " " & Hex(b(2)) & " " & Hex(b(3)) & " " & Hex(b(4))
End Function
 Function pvSetTrue(bValue As Boolean) As Boolean
    bValue = True
    pvSetTrue = True
End Function

Function GetAddress(ByVal V As Long) As Long
GetAddress = V
End Function


Bind Cdecl Api To vb6 Function(stdcall),support run in IDE

$
0
0
'bind cdecl api to vb6 function
FixCdecl AddressOf VB_Add, CdeclApi, 2
c = VB_Add(a, b)

FORM1 CODE:
Code:

Dim h As Long
Dim CdeclApi_Add As Long

Private Sub Command1_Click()
If CdeclApi_Add = 0 Then
    h = LoadLibrary("cdecl.dll")
    CdeclApi_Add = GetProcAddress(h, "Add")
    FixCdecl GetAddress(AddressOf VB_Add), CdeclApi_Add, 2
End If

Dim a As Long, b As Long, c As Long
a = 44
b = 55

c = VB_Add(a, b)
MsgBox "c=" & c
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
RestoreFunctionMemory
FreeLibrary h
End Sub

Module1.bas
Code:

Option Explicit
Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Public Const PAGE_EXECUTE_READWRITE As Long = &H40
Private Declare Sub CopyMemory2 Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Declare Function WriteProcessMemory2 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function VirtualProtect2 Lib "kernel32" Alias "VirtualProtect" (ByRef lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long  '设置内存可读写
Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Dim OldFunctionAsm(18) As Byte, FunctionPtr As Long, THUNK_SIZE As Long
'演示用,最简化代码
Function VB_Add(ByVal a As Long, ByVal b As Long, Optional NoUsed As Long) As Long
    MsgBox 1
    MsgBox 1
    MsgBox 1
End Function

Sub FixCdecl(VbFunction As Long, CdeclApi As Long, Args As Long) 'GOOD
  'MsgBox "call-FixCdecl"
    Dim Asm(4) As String, Stub() As Byte ', THUNK_SIZE As Long
    '  0: 58                  pop        eax
    '  1: 89 84 24 XX XX XX XX mov        dword ptr [esp+Xh],eax
    Asm(0) = "58 89 84 24 " & LongToHex(Args * 4) '&H24848958
    Asm(1) = "B8 " & LongToHex(CdeclApi)      'B8 90807000    MOV EAX,708090
    Asm(2) = "FF D0"                          'FFD0          CALL EAX
    Asm(3) = "83 C4 " & Hex(Args * 4) '83 C4 XX      add esp, XX    'cleanup args
    Asm(4) = "C3"
   
    Stub() = toBytes(Join(Asm, " "))
    THUNK_SIZE = UBound(Stub) + 1
   
    Dim bInIDE          As Boolean
    Debug.Assert pvSetTrue(bInIDE)
 
    If bInIDE Then
        CopyMemory2 VbFunction, ByVal VbFunction + &H16, 4
    Else
        VirtualProtect2 VbFunction, THUNK_SIZE, PAGE_EXECUTE_READWRITE, 0    '更改函数地址所在页面属性
    End If
    FunctionPtr = VbFunction
   
    CopyMemory2 ByVal VarPtr(OldFunctionAsm(0)), ByVal VbFunction, THUNK_SIZE '保存函数旧数据
    WriteProcessMemory2 -1, VbFunction, VarPtr(Stub(0)), THUNK_SIZE, 0
End Sub
Sub RestoreFunctionMemory() '恢复原来函数的部分汇编代码,必不可少,否则会崩
    If THUNK_SIZE > 0 Then
        WriteProcessMemory2 -1, FunctionPtr, VarPtr(OldFunctionAsm(0)), THUNK_SIZE, 0
    End If
End Sub
Function toBytes(x As String) As Byte()
    Dim tmp() As String
    Dim fx() As Byte
    Dim i As Long
    tmp = Split(x, " ")
    ReDim fx(UBound(tmp))
    For i = 0 To UBound(tmp)
        fx(i) = CInt("&h" & tmp(i))
    Next
    toBytes = fx()
End Function
 Function LongToHex(x As Long) As String
    Dim b(1 To 4) As Byte
    CopyMemory2 b(1), x, 4
    LongToHex = Hex(b(1)) & " " & Hex(b(2)) & " " & Hex(b(3)) & " " & Hex(b(4))
End Function
 Function pvSetTrue(bValue As Boolean) As Boolean
    bValue = True
    pvSetTrue = True
End Function

Function GetAddress(ByVal V As Long) As Long
GetAddress = V
End Function

[VB6] - sSlide - User Control

Freehand drawing with GDI+

$
0
0
Illustrates how to perform freehand drawing within a GDI+ path. I needed this capability in an application some time ago but was only able to find one example which used GDI+, but it was done there by continuously updating an array of path points and so it was slow and produced ragged edges.

So I wrote this and it worked fine for me. It is very simple and fast. One caveat - using more transparency i.e. less opacity may cause line caps to become more visible.
Attached Files

Path Rotation with GDI+

$
0
0
Illustrates how to rotate a GDI+ path around a center axis. Uses a simple transformation matrix. Useful for certain drawing applications. I originally wrote this for use with certain elements of a custom user interface.
Attached Files

(VB6) Compare two controls interfaces

CreateThread Sample--Vfb(Visual Freebasic),vb7,WinFBE

$
0
0
Code:

Sub Form1_Command2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)  '单击
  Dim ABC As String Ptr = New String
  *ABC = "China"

  'CreateThread (NULL,0,@ThreadSub,ABC,0,0)
    Threaddetach ThreadCreate(Cast(Any Ptr ,@ThreadSub) ,ABC)
End Sub

Sub ThreadSub(StrAPtr As String Ptr)
  MsgBox *StrAPtr
  Delete  StrAPtr
End Sub

VB6 has stopped updating for 25 years. We have a development tool similar to VB6. Everyone is welcome to use it together and let the VISUAL BASIC syntax last forever.

vfb(visual freebasic),ide like vb6,vb7.support x64,createthread,asm code
(94) Vfb IDE【Visual Freebasic】Like vb6,vb7,Update2021-2-23 - freebasic.net
https://www.freebasic.net/forum/view...hp?f=8&t=28522
download vfb ide:
https://github.com/xiaoyaocode163/VisualFreeBasic
http://www.yfvb.com/soft-48.htm (version 5.5.3,update:2021-2-23)

All Freebasic Code Sample,Vfb(Visual Freebasic),Like VB6,VB7

$
0
0
VB6 has stopped updating for 25 years. We have a development tool similar to VB6. Everyone is welcome to use it together and let the VISUAL BASIC syntax last forever.

vfb(visual freebasic),ide like vb6,vb7.support x64,createthread,asm code
(94) Vfb IDE【Visual Freebasic】Like vb6,vb7,Update2021-2-23 - freebasic.net
https://www.freebasic.net/forum/view...hp?f=8&t=28522
download vfb ide:
https://github.com/xiaoyaocode163/VisualFreeBasic
http://www.yfvb.com/soft-48.htm (version 5.5.3,update:2021-2-23)

============================
sample 1:CreateThread Sample--Vfb(Visual Freebasic),vb7,WinFBE-VBForums
https://www.vbforums.com/showthread....68#post5513868

sorry,Chrome OCX,Miniblink,VB6 chromium,Chrome core only one dll

$
0
0
This is a good Google Chrome control, free and open source. And the author is not me.

I've been sharing and uploading for free for almost a year. And I've never used it myself.


one developer was working on a software development project the other day and needed to use this control. He can't use it, and he needs me to develop many new functions for him. He contacted me on his own initiative and wanted to pay me some fees to help him develop the work project. This project is not mine, I have no obligation to unconditionally fix all bugs free of charge,If someone needs to develop Russian language for him or spend tens of thousands of dollars to add other functions, I have to give him free production, I can't help it.


Other people's projects were originally free, and I share them with you. Am I obligated to answer all technical questions unconditionally?

We just found some good source code, free to share for everyone to use.
If you need to add some functions, or fix some software technical bugs, you can ask to share it. Can you complete the free and unconditional modification and ask him to add any more functions? Am I his boss? But I didn't pay him salary.


Chrome OCX,Miniblink,VB6 chromium,Chrome core only one dll
download node.dll from here:
https://github.com/weolar/miniblink49/releases
GitHub - imxcstar/vb6-miniblink-SBrowser: Miniblink control made with vb6 encapsulates all APIs of miniblink free version
https://github.com/imxcstar/vb6-miniblink-SBrowser

GitHub - weolar/miniblink49: a lighter, faster browser kernel of blink to integrate HTML UI in your app. A small, lightweight browser kernel to replace wke和libcef
https://github.com/weolar/miniblink49

[VB6] Simple VNC Server using DXGI Desktop Duplication

$
0
0
https://github.com/wqweto/VbVncServer

A single-class VNC server for embedding in LOB applications for built-in client support.

Very much work in progress but first cut seems to work.

Based on RFC 6143 and can be used with any VNC viewer like RealVNC or any other you prefer best.

cheers,
</wqw>

The fastest way to download web pages(GET,POST)

$
0
0
Research using multiple methods to download web pages and choose the fastest solution

2021/3/17 14:29:29--WinHttp4(No Options) UsedTime=19795 Ms,Size=319628
2021/3/17 14:29:09--WinHttpRequest3 UsedTime=21714.3689 Ms,Size=319628,Crc32=-2146165443
2021/3/17 14:28:47--WinHttpRequest3_GZIP UsedTime=5174.1903 Ms,Size=59198,Crc32=-2146165443,UnGzip Used Time=2.5319 Ms

Winhttp DonwLoad Use 21 Seconds,by GZIP,only use 5 Seconds

One of the test application examples:
best way to get or save utf-8 content url faster?(https support)-VBForums
https://www.vbforums.com/showthread....https-support)

in my computer, i don't khnow why WinHttpRequest is slowly
WinHttp.WinHttpRequest.5.1,Used 28 seconds
Xmlhttp used 5 seconds


Code:

Sub WinHttpRequest3_GZIP(URL As String, Optional ByVal TimeoutSec As Long = 5)
On Error Resume Next
    QueryPerformanceCounter CPUv1
    Dim http As WinHttpRequest
    Set http = New WinHttpRequest
    With http
        .open "GET", URL, True
        .Option(WinHttpRequestOption_SecureProtocols) = SecureProtocol_ALL
        .Option(WinHttpRequestOption_EnableRedirects) = True
        .Option(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_Ignore_All
       
        .setRequestHeader "Accept-Encoding", "gzip, deflate"
        .setRequestHeader "Accept-Language", "zh-CN,zh;q=0.9,ru;q=0.8"
        .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
        .send
        .waitForResponse (TimeoutSec)
    End With
   
    QueryPerformanceCounter CPUv2
    UsedTime1 = (CPUv2 - CPUv1) / MsCount
    Dim bt() As Byte, Bytes As Long
    bt = http.responseBody
    Bytes = UBound(bt) + 1
    Result = "WinHttpRequest3_GZIP UsedTime=" & UsedTime1 & " Ms,Size=" & Bytes
   
   
    Debug.Print Result
End Sub

Download Sample Xmlhttp_WithEvent-2.zip

test result:
2021/3/16 21:39:29 --Xmlhttp DownStart
2021/3/16 21:39:29 --XmlhttpState=1(UsedTime=6.8953 Ms)
2021/3/16 21:39:34 --XmlhttpState=2(UsedTime=4597.2895 Ms)
2021/3/16 21:39:34 --XmlhttpState=3(UsedTime=4598.3393 Ms)
2021/3/16 21:39:34 --XmlhttpState=4(UsedTime=4599.6692 Ms)
DownLoad Url UsedTime=4599.6692 Milliseconds ,Size=318284
------------
2021/3/16 21:31:57 --XmlhttpState=1
2021/3/16 21:32:01 --XmlhttpState=2
2021/3/16 21:32:01 --XmlhttpState=3
2021/3/16 21:32:13 --XmlhttpState=4
DownLoad Url UsedTime=15834.51 Milliseconds


Code:

Private Declare Function timeBeginPeriod Lib "winmm.dll" _
  (ByVal uPeriod As Long) As Long
Private Declare Function timeGetTime Lib "winmm.dll" () As Long

Private Sub Form_Load()
timeBeginPeriod 1
End Sub

Method 1:
Reference DLL:Microsoft scripting runtime,Microsoft Active Data Object,Microsoft MsXml

Code:

Public Function doSome() 'Set AS Class Default Method
    QueryPerformanceCounter CPUv2
    UsedTime1 = (CPUv2 - CPUv1) / MsCount
    Debug.Print Now & " --XmlhttpState=" & XmlhttpObj.readyState & "(UsedTime=" & UsedTime1 & " Ms)"
 
  If XmlhttpObj.readyState = 4 Then
    On Error Resume Next
    Dim bt() As Byte, Bytes As Long
    bt = XmlhttpObj.responseBody
    Bytes = UBound(bt) + 1
    Debug.Print "DownLoad Url UsedTime=" & UsedTime1 & " Milliseconds ,Size=" & Bytes
        Form1.Command1.Caption = "DownLoad Used " & UsedTime1 & " Milliseconds"
    Call SaveByte
  End If
End Function

Form1 code
Code:


  Public a As MSXML2.XMLHTTP
 

Private Sub Command1_Click()
  Dim d As Class1
  Set a = New MSXML2.XMLHTTP
  a.open "get", "http://www.ljc.com/sll.txt", True
  Set d = New Class1
  a.onreadystatechange = d
  a.send
End Sub

Class1 CODE:
Code:

Dim b As ADODB.Stream
 Dim fso As Scripting.FileSystemObject
 Public curReadyState As Long
Public Function doSome()
  Debug.Print Form1.a.readyState
  If Form1.a.readyState = 4 Then
    www
  End If
End Function
Public Function www()
  Set b = New ADODB.Stream
  b.Type = 1
  b.open
  Set fso = New Scripting.FileSystemObject
  If Form1.a.readyState = 4 Then
        b.Write (Form1.a.responseBody)
        If Not fso.FileExists("c:/mmm.txt") Then
          b.SaveToFile "c:/mmm.txt"
        End If
  End If
  b.Close
  Set b = Nothing
  Set fso = Nothing
End Function

Attached Files

vb6 Gif Ocx/Png OCX,Show Movie by DirectShow,WebBrowser,AniGif.OCX

$
0
0
Name:  ShowGif_byWebbrowser.jpg
Views: 18
Size:  30.0 KB
Usercontrol.ctl about Webbrowser GIF(PNG ,JPG),Support Url,Localdisk File
[gif ocx,Png ocx] activex control

Code:

Dim WithEvents M_Dom As MSHTML.HTMLDocument
Public Event ImgClick()
Private Url As String
'Usercontrol Name:WebImgOcx

Private Sub UserControl_Initialize()
'add Webbrowser to Usercontrol
UserControl.ScaleMode = 3
WebBrowser1.Visible = False
End Sub

Public Property Get ImgUrl() As String
    ImgUrl = Url
End Property

Public Property Let ImgUrl(ByVal vNewValue As String)
Url = vNewValue
If Url <> "" Then
    WebBrowser1.Visible = True
    SetImg Url
Else
    WebBrowser1.Visible = False
End If
End Property
 

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  ImgUrl = PropBag.ReadProperty("ImgUrl", "")
End Sub
 

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
 PropBag.WriteProperty "ImgUrl", ImgUrl
End Sub
 

Sub SetImg(UrlA As String)
    Url = UrlA
    WebBrowser1.Navigate Url
End Sub
Private Function M_Dom_onclick() As Boolean
    RaiseEvent ImgClick
End Function

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, Url As Variant)
If Url = "" Then Exit Sub
    Dim body As Object
    Set M_Dom = WebBrowser1.Document
    Set body = WebBrowser1.Document.body
   
    body.Scroll = "no"
    body.Style.border = "none"
    body.leftMargin = 0
    body.topMargin = 0
   
       
    WebBrowser1.Width = body.All(0).clientWidth
    WebBrowser1.Height = body.All(0).clientHeight
    UserControl.Width = WebBrowser1.Width * Screen.TwipsPerPixelX
    UserControl.Height = WebBrowser1.Height * Screen.TwipsPerPixelY
   
   
    Call WebBrowser1.Document.parentWindow.execScript("document.body.ondragstart=function(){return false}", "javascript") 'good
    Call WebBrowser1.Document.parentWindow.execScript("document.body.oncontextmenu=function(){return false}", "javascript") 'good '禁止右键
End Sub

CALL Usercontrol OCX IN FORM1
Code:

WebImgOcx2.Imgurl="http://www.a.com/123.gif"

Private Sub WebImgOcx2_ImgClick()
 MsgBox WebImgOcx2.ImgUrl
End Sub

Attached Images
 
Attached Files

Neumorphism Design

$
0
0
In this case, it is, on the one hand, a class Module and, on the other, a Usercontrol to create a modern user interface called Neumorphism, which began to become fashionable as of 2020, although it is designed for mobile applications or webs I see no reason not to implement it in our beloved vb6, at least in small applications so as not to overload memory and slow down our app. The whole engine is based on GDI +.

With the class module there is an example where we can play with the properties of the class and other forms with some graphical examples.
In addition, this allows you to draw a GDI + Path with which an extra module was used, where you can create different shapes (Shapes) and the style can be applied to them, I take the opportunity to thank Eduardo for taking part in the routines of his ShapeEx. and thank you very much to SomeYguy for the rutine to rotate path.

With the Usercontrol there are three applied examples. I am not going to detail all the properties, it is a matter of reaching out and playing a bit, they are the same as the module. Accompanying the examples is the "LabelPlus" usercontrol, which is to add text and icons to the forms, (I didn't want to reprogram all this, that's why I used two usercontrols).

Later I am going to upload a music player in which I am working where you can see all this applied.

Finally I want to clarify that all this works faster when it is compiled.

Name:  Neumorphism1.jpg
Views: 79
Size:  17.1 KBName:  Neumorphism2.jpg
Views: 79
Size:  18.1 KBName:  Neumorphism4.jpg
Views: 79
Size:  32.0 KBName:  Neumorphism5.jpg
Views: 79
Size:  15.4 KB

Neumorphism.zip
Attached Images
    
Attached Files
Viewing all 1542 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>