Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #32  
Old 06-23-2014, 07:41 PM
CoolBlue's Avatar
CoolBlue CoolBlue is offline Slow "comparison/replace" script Windows 7 64bit Slow "comparison/replace" script Office 2013
Advanced Beginner
 
Join Date: Jun 2014
Location: Australia
Posts: 40
CoolBlue is on a distinguished road
Default Slow "comparison/replace" script

Quote:
Originally Posted by whatsup View Post
O_o, quite interesting

May I ask you a few questions about your new function of the last upload?
1.
Code:
Public Const coBytes As Long = 4 * 8
You changed to 32 Bytes, just for purpose of demonstration or is there any particular reason?
The main reason is that the object structures are generaly more than one worrd so I wanted to see what was there in the structure to see if I could notice any patterns now that the byte order is fixed.
The Mem_Read for VarPtr is still set to 4 (it should be set to POINTER_LENGTH in fact).
Quote:
Originally Posted by whatsup View Post
2.
That's still the problem, that we don't know what data-structure we're really facing, isn't it?
Well, the data structures are interesting but not relevant to the test we are doing. But anyway, we now have a method for seeing the data properly (not scrambled by endian coding) so we can look at some standard structures like VB Variant structure for example to see if we can get some clue.
The main point is that we can confirm the relationship between VarPtr and ObjPtr for objects. We can confirm that the Loal Object, is just a LongPtr containing the address of the referenced object or zero, depending on if its been set or not.
Before I unscrambled the bytes, it was not obvious that the Mem_Read from VarPtr was in fact the address of the global object. But now we are clear on that.
So, using your Mod01 as an example, it means that we can say with 100% confidence that, after runtime:
If Mem_ReadHex_Words(lng_objPtr, 4) = 0 then
objwks is set to Nothing

If Mem_ReadHex_Words(lng_objPtr, 4) = ObjPtr(Sheet1) then
objwks has not been properly released

If Mem_ReadHex_Words(lng_objPtr, 4) <> ObjPtr(Sheet1) then
objwks has been properly released

Thus solving the problem that you raised earlier about ObjPtr returning the same thing for the local and global variables.
Quote:
Originally Posted by whatsup View Post
3.
Curiousity - I've never seen this before:
Code:
wordCount = Length \ wordLength
For divisions I use / you as well as I see in the following line. Therefore I wonder what's the joke on this?
/ is divide and \ is div or integer divide
Run this code...
Code:
Sub testIntDiv()
Debug.Print 3 / 5
Debug.Print 3 \ 5
End Sub
I use it like this:
if p / q = p\ q then p is divisible by q

Last edited by CoolBlue; 06-24-2014 at 07:30 PM.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd "script code" in a downloaded .doc file CNBarnes Word 2 10-18-2012 02:07 AM
Slow &quot;comparison/replace&quot; script replace data from variable with "sub and super script" from excel to word by vba krishnaoptif Word VBA 9 06-22-2012 05:08 AM
Slow &quot;comparison/replace&quot; script How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM
Rules and Alerts: "run a script"? discountvc Outlook 0 06-15-2010 07:36 AM
An "error has occurred in the script on this page" decann Outlook 8 09-03-2009 08:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft