Re: Problems developing an application to PocketPC

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Peter Foot [MVP] (feedback_at_nospam-inthehand.com)
Date: 08/05/04


Date: Thu, 5 Aug 2004 09:30:24 +0100

There is a bug in AddrOfPinnedObject which returns first the size of the
array, so you have to add 4 to the resulting pointer (4 byte = length of
Int32). You could do this in VB like so:-

Dim aux As IntPtr = CType(handle.AddrOfPinnedObject().ToInt32() + 4, IntPtr)

Peter

-- 
Peter Foot
Windows Embedded MVP
www.inthehand.com
Do have an opinion on the effectiveness of Microsoft Windows Mobile and 
Embedded newsgroups?  Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
"triki tron via .NET 247" <anonymous@dotnet247.com> wrote in message 
news:%233n6enheEHA.1424@tk2msftngp13.phx.gbl...
> (Type your message here)
> I have proved this code in an application for PC and works OK:
>
>
>   Dim RxBufferDatos(40) As Byte
>   Dim Arbuffer() As Byte
>
>   ReDim Preserve Arbuffer(ContadorDatos + nbRx - 1)
>
>   Dim handle As GCHandle = GCHandle.Alloc(RxBufferDatos, 
> GCHandleType.Pinned)
>   Dim aux As IntPtr = handle.AddrOfPinnedObject()
>   Marshal.Copy(aux, Arbuffer, ContadorDatos, RxBufferDatos.Length)
>   handle.Free()
>
>
> This copies a number of bytes from "RxBufferDatos" to "Arbuffer".
>
> But when I copy this code to an application to a PocketPC, this doesn?t 
> work OK.
> Do you know why and how can I do it?
>
>
> --------------------------------
> From: triki tron
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>n5sKkgAM1UKL7KlDR1sSiQ==</Id> 


Relevant Pages

  • Re: How do I access a text file on a PocketPC from VB.net?
    ... Dim sr As StreamReader ... > Peter Foot ... > Windows Embedded MVP ... >> a text file in vb.net on a PocketPC, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ADOCE
    ... > Dim cn As ADOCE.Connection ... > Peter Foot ... > Windows Embedded MVP ... >> many thanks for your prompt response. ...
    (microsoft.public.pocketpc.developer)
  • Re: Problem using WaitForSingleObject with Rapi
    ... Peter Foot ... > Dim dwWaitRet, dwTimeout As Long ...
    (microsoft.public.pocketpc.developer)
  • Re: OpennetCF setvalue registry problem
    ... After calling SetValue remember to call regVersion.Closeto close the key ... Peter Foot ... > Dim regVersion As OpenNETCF.Win32.RegistryKey ... > "Daniel Moth" wrote: ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Problem using WaitForSingleObject with Rapi
    ... Since you mentioned time out I increased the value of dwTimeout from ... Peter Foot wrote: ... >> Dim dwWaitRet, dwTimeout As Long ...
    (microsoft.public.pocketpc.developer)