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

VB6 MultiThreading,A new way to get the VB header,For CreateThread

$
0
0
Msgbox GetVBHeader

Code:

Private Type MODULEINFO
    lpBaseDLL As Long
    ImageSize As Long
    EntryPoint As Long
End Type

Private Declare Function GetModuleInformation Lib "psapi.dll" (ByVal hProcess As Long, ByVal hModule As Long, mInfo As MODULEINFO, ByVal cbSize As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

Function GetVBHeader() As Long
  Dim mInfo As MODULEINFO
  GetModuleInformation GetCurrentProcess(), &H400000, mInfo, 12
  If mInfo.EntryPoint Then CopyMemory GetVBHeader, ByVal mInfo.EntryPoint + 1, 4
End Function


GetVBHeader ,This is only part of the function of VB multi-threaded programming. It is like a medical insurance product in a hospital, masks are just one of them.

[VB6] - Module for working with multithreading.-VBForums
https://www.vbforums.com/showthread....=1#post5456137
:)stdexethd.zip
Code:

hModule = App.hInstance
       
' // Get VBHeader structure
Public Function GetVBHeader() As Long
    Dim ptr    As Long
   
    ' // Get e_lfanew
    GetMem4 ByVal hModule + &H3C, ptr
    ' // Get AddressOfEntryPoint
    GetMem4 ByVal ptr + &H28 + hModule, ptr
    ' // Get VBHeader
    GetMem4 ByVal ptr + hModule + 1, GetVBHeader
   
End Function


Viewing all articles
Browse latest Browse all 1480

Trending Articles



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