DanielF
Wed Aug 24 14:09:01 CDT 2005
Thank you for your quick response. I was not able to find this documented
anywhere. I have it working now thanks to your help. It turned out to be not
quite as difficult as I thought - I was concerned that I would have to put
conditional logic everywhere that references the DLLImports which is hundreds
of places, but now I realize that it is only for the ones that might get
executed during Design phase.
Thanks again!
"Peter Foot [MVP]" wrote:
> You can alter your code so that the P/Invokes are only called on the device.
> e.g. using
>
> if(System.Environment.OSVersion.Platform==PlatformID.WindowsCE)
> {
> //do device specific stuff
> }
>
> to exclude the calls from the desktop, or you could use an alternative e.g.
> desktop p/invoke. You can simplify this slightly by using a static boolean
> which is set once on initialisation e.g.
> private static bool isDevice =
> (System.Environment.OSVersion.Platform==PlatformID.WindowsCE);
>
> If the P/Invokes occur during property setter/getters you can disable these
> from appearing in the designer, if they are called within OnPaint,
> OnParentChanged etc you'll need to wrap them as shown above.
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
>
http://www.inthehand.com |
http://www.peterfoot.net
>
> "DanielF" <DanielF@discussions.microsoft.com> wrote in message
> news:72B96282-4911-4AA1-B9C5-03991BD3A151@microsoft.com...
> >I am trying to port some existing CF custom controls to VS 2005. I have
> >read
> > the article "Creating Custom Controls for MS .NET CF in VS 2005" which was
> > helpful, but it does not deal with DLLImports. I have created the .xmta
> > file
> > to deal with the design attributes that are required and have installed
> > the
> > control into the toolbox, but still have errors when I drag-n-drop the
> > control onto a form. It complains about the DLLImports and then crashes
> > VS. I
> > have searched this Newsgroup but no joy. Does anyone know how to deal with
> > this issue? Is there an attribute that needs to be added to handle this or
> > do
> > you have to code around each and every reference to the DLLImport
> > functions?
> > Any help will be appreciated.
>
>
>