Results 1 to 10 of 193

Thread: Appendix Thread 2. ( Codes for other Threads, HTML Tables, etc.)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Coding for this main forum question
    https://eileenslounge.com/viewtopic....324964#p324964
    https://eileenslounge.com/viewtopic....324975#p324975



    Code:
    Option Explicit  ' Destination Points to the starting address of the copied block’s destination.            Source Points to the starting address of the block of memory to copy               Length Specifies the size, in bytes, of the block of memory to copy.
     #If VBA7 Then
      Private Declare PtrSafe Sub VBGetTarget Lib "kernel32" Alias "RtlMoveMemory" (Target As Any, ByVal lPointer As LongPtr, ByVal cbCopy As LongPtr)
     #Else
      Private Declare Sub VBGetTarget Lib "kernel32" Alias "RtlMoveMemory" (Target As Any, ByVal lPointer As Long, ByVal cbCopy As Long)
     #End If
    Sub LongType() '        https://www.excelfox.com/forum/showthread.php/2404-Notes-tests-ByVal-ByRef-Application-Run-OnTime-Multiple-Variable-Arguments-ByRef-ByVal?p=11888&viewfull=1#post11888     https://www.excelfox.com/forum/showthread.php/2404-Notes-tests-ByVal-ByRef-Application-Run-OnTime-Multiple-Variable-Arguments-ByRef-ByVal/page4    https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-Pasting-API-Cliipboard-issues-and-Rough-notes-on-Advanced-API-stuff?p=17881&viewfull=1#post17881
    Dim LngDest As Long, LngSource As Long
    Rem 1  Biggest long number
    ' 1a)
     Let LngSource = 1073741824 + 1073741823 ' =2147483647      1073741824 is 2^30 which is the last but 1 (31th counting from the right), of 32 bits in the 32 Bit binary representation of a number       1073741823 is the resulting decimal you get if you have a 1 in the first 30, counting from the right, of a binary number         decimal 2147483647 is in binary 31 digits  1111111111111111111111111111111
    VBGetTarget LngDest, VarPtr(LngSource), 4 ' Anything less than 4 will give the wrong number
    Debug.Print LngDest '   2147483647     (31 digits 1111111111111111111111111111111)
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 3
    Debug.Print LngDest '    16777215      (24 digits 111111111111111111111111)
    
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 2
    Debug.Print LngDest '    65535         (16 digits 1111111111111111)
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 1
    Debug.Print LngDest '     255          (8 digits 11111111)
    
    
    Rem 2  Small long number
     Let LngSource = 2
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 4
    Debug.Print LngDest '      2
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 3
    Debug.Print LngDest '      2
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 2
    Debug.Print LngDest '      2
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 1
    Debug.Print LngDest '      2
    
    
    Rem 3  Number decimal  511    (9 digits 111111111)
     Let LngSource = 511
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 2
    Debug.Print LngDest '      511          (9 digits 111111111)
     
     Let LngDest = 0
    VBGetTarget LngDest, VarPtr(LngSource), 1
    Debug.Print LngDest '      255          (8 digits 11111111)
     
     
     Let LngDest = 0 '          LngSource = 511   ->  (9 digits 111111111)
    VBGetTarget LngDest, VarPtr(LngSource) + 1, 1
    Debug.Print LngDest '      1             ( 00000001  )
    End Sub



    Share ‘kernel32.dll’ https://app.box.com/s/124tsibbnl7pk1xz7assmzivuyyfplo3
    Share ‘rpiAPI.dll’ https://app.box.com/s/xfng1rft9mawgcpxlu5z64pps2sg7grv
    Attached Files Attached Files
    Last edited by DocAElstein; 02-07-2025 at 03:44 PM.

Similar Threads

  1. VBA to Reply All To Latest Email Thread
    By pkearney10 in forum Outlook Help
    Replies: 11
    Last Post: 12-22-2020, 11:15 PM
  2. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM
  3. Replies: 19
    Last Post: 04-20-2019, 02:38 PM
  4. Search List of my codes
    By PcMax in forum Excel Help
    Replies: 6
    Last Post: 08-03-2014, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •