Results 1 to 7 of 7

Thread: CreateThread by Activex Exe In vb6(Support Shared variables)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    CreateThread by Activex Exe In vb6(Support Shared variables)

    CreateThread by Activex Exe In vb6(Support Shared variables)
    Code:
    ActivexExeThread.bas
    Public Src As String '主变量
    Public MEM(0) As String
    Public x As Long
    
    Public ABC As Long, X2 As Long
    Public AbcArr(0) As Long
    
    in thread forms:
    Private Sub ShowSrcAbc_Click()
    Dim OldAbc As Long
    'AbcArr(X2)=abc
    'MEM(x) =src
    OldAbc = AbcArr(X2)
    MEM(x) = "test:" & Now
    AbcArr(X2) = AbcArr(X2) + 1
    MsgBox "Src=" & MEM(x) & vbCrLf & "Old Abc=" & OldAbc & vbCrLf & "New ABC=" & AbcArr(X2), , "ThreadID = " & App.ThreadID
    End Sub
    
    in main form:
    MsgBox "Src=" & Src & vbCrLf & "ABC=" & ABC, , "threadid=" & App.ThreadID
    Name:  activex_exe_CreateThread.jpg
Views: 559
Size:  34.7 KBv2CreateThread by Activex Exe In vb6.zip
    Last edited by xiaoyao; Feb 10th, 2020 at 08:07 AM.

  2. #2
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    356

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    Quote Originally Posted by xiaoyao View Post
    CreateThread by Activex Exe In vb6(Support Shared variables)
    Code:
    ActivexExeThread.bas
    Public Src As String '主变量
    Public MEM(0) As String
    Public x As Long
    
    Public ABC As Long, X2 As Long
    Public AbcArr(0) As Long
    
    in thread forms:
    Private Sub ShowSrcAbc_Click()
    Dim OldAbc As Long
    'AbcArr(X2)=abc
    'MEM(x) =src
    OldAbc = AbcArr(X2)
    MEM(x) = "test:" & Now
    AbcArr(X2) = AbcArr(X2) + 1
    MsgBox "Src=" & MEM(x) & vbCrLf & "Old Abc=" & OldAbc & vbCrLf & "New ABC=" & AbcArr(X2), , "ThreadID = " & App.ThreadID
    End Sub
    
    in main form:
    MsgBox "Src=" & Src & vbCrLf & "ABC=" & ABC, , "threadid=" & App.ThreadID
    Name:  activex_exe_CreateThread.jpg
Views: 559
Size:  34.7 KBv2CreateThread by Activex Exe In vb6.zip
    dear xiaoyao,

    Nice example supporting shared variables.You can update it to support user control using http://www.vbforums.com/attachment.p...3&d=1581316682

    regards,
    JSVenu

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    please put,move this thread to code bank
    @postmaster

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    Quote Originally Posted by xiaoyao View Post
    please put,move this thread to code bank
    @postmaster
    I'd rather suggest to the moderators, to remove this spam from the forum...
    (your posts still do not contain anything useful, they are complete nonsense).

    Olaf

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    Standard dll, multithreading, function callbacks, in many cases do not support global variables. You can use pointer, secure array method, using variable address offset to read write data. You can also use the memory mapping method (createfilemapping), was originally used for multi-process sharing data, this process, multi-thread can also be used. There is also a way to write function addresses to data in a compiled way during the run. The equivalent of dynamic compilation, other threads can read this function to get the data.
    Last edited by xiaoyao; Feb 20th, 2020 at 09:05 PM.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    Quote Originally Posted by jsvenu View Post
    dear xiaoyao,

    Nice example supporting shared variables.You can update it to support user control using http://www.vbforums.com/attachment.p...3&d=1581316682

    regards,
    JSVenu
    Vb6 multithreading supports ocx controls, display windows, many people may think it is not necessary at all, we (forum member: The trick,jsvenu) also studied activex.exe support multithreading, display ocx controls, user-defined controls, I think it is very fun, accumulate technology and experience. In the past, I used to use vb to develop a standard dll, double click that can output functions to run the display form (supporting multithreading) as a normal exe, with ocx controls and a com dll. The functions inside allow vba to support multithreading. Maybe such a multifunctional freak dll file doesn't seem to have much use. But when it comes to doing it, it proves that vb6 is powerful and can do more impossible things. I learned a lot of experience in the course of the challenge.

  7. #7
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: CreateThread by Activex Exe In vb6(Support Shared variables)

    Quote Originally Posted by xiaoyao View Post
    ...it proves that vb6 is powerful
    VB6 is powerful without any of the "wannabe-hacker" nonsense.

    Quote Originally Posted by xiaoyao View Post
    I learned a lot of experience in the course of the challenge.
    And still I've not seen a single Real-World-Demo-App from you,
    which applies this (allegedly) "advanced coding" in something concrete (in a scenario that does something really useful).

    Furthermore, most of these "advanced" snippets were not developed by you -
    all I've seen you do (in your uploaded Zip-Files) is:
    - reposting parts of the "advanced" hacks (without giving any credits to the original authors)
    - in a coding-style which is nearly unreadable
    - all in so far only synthetic demos (which never show, what the purpose of the whole "hacking-exercise" is, or what problem it tries to solve)
    - all accompanied by a lot of "noise" in bad, autotranslated english (often followed by "probably badly written chinese" as well)

    I'm still not entirely sure, whether we see some "bot-testing" here ...
    A handful of the responses could be "occasionally beautified by the bot-developer" it seems -
    but all the rest of your postings read like autogenerated (unsufficiently, only halfway) context-related bot-responses.

    Please stop this spamming, unless you have some real-world-demos to show, which you developed yourself.

    Olaf

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