home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,409 of 10,840   
   Antony Clements to J French   
   Re: a problem with copymem API   
   15 Feb 07 20:13:16   
   
   From: antony.clements@optusnet.com.au   
      
   i modified the code after i posted this, it no longer throws up an error but   
   it still doesn't work correctly.   
      
    dim var1 var2 and var3 as long   
      
   ReDim IVbytearray(0 To 7)   
   ReDim IVbytearray2(0 To 7)   
      
   bytearray() = Mid(stream1, b, 8)   
   bytearray2() = Mid(stream2, c, 8) 'a messagebox here proves that at this   
   point, the data held in bytearray() is different than the data held in   
   bytearray2()   
      
   var1 = bytearray()   
   var2 = bytearray2() 'this is where the problem is as var2 returns the same   
   value as var1 even though the value in bytearray() is different to the value   
   in bytearray2().   
      
   Call CopyMemory(var1, var1 Xor var2, 8)   
   Call CopyMemory(var1, var1 Xor var3, 8)   
      
      
   now here is the problem. even though the data source for bytearray() and   
   bytearray2() are different, for some reason or other they both have the same   
   value. var2 needs to be a value from the second data source. i hope this is   
   a clear indication of what i am trying to do.   
      
   "J French"  wrote in message   
   news:45d410e0.1920119@news.btopenworld.com...   
   > On Thu, 15 Feb 2007 10:27:25 +1100, "Antony Clements"   
   >  wrote:   
   >   
   >>i am using the following code   
   >>   
   >>private var1 as Long   
   >>private var2 as Long   
   >>private var3 as Long   
   >>   
   >>ReDim bytearray(0 To 3)   
   >>ReDim bytearray2(0 To 3)   
   >>   
   >>For a = 0 To 3   
   >>    bytearray(a) = Asc(Mid(DataSource, b, 1))   
   >>    bytearray2(a) = Asc(Mid(DataSource2, c, 1))   
   >>    b = b + 1   
   >>    c = c + 1   
   >>Next a   
   >>   
   >>var1 = IVbytearray(0) & IVbytearray(1) & IVbytearray(2) & IVbytearray(3)   
   >>var2 = IVbytearray2(0) & IVbytearray2(1) & IVbytearray2(2) &   
   >>IVbytearray2(3)   
   >>   
   >>CopyMemory var1, var1 Xor var2, 4   
   >>CopyMemory var1, var1 Xor var3, 4   
   >>   
   >>an overflow error is sometimes thrown up in the copymemory api, how do i   
   >>fix   
   >>it?   
   >   
   > I can't make any sense of this code   
   > - you don't use & for building a Long out of Bytes   
   >   
   > If you described what you are trying to do, then maybe we can come up   
   > with a suggestion.   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca