PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Custom and P/Invoke pb
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Custom and P/Invoke pb
![]() |
Custom and P/Invoke pb |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
My custom control use some p/Invoke that are in coredll.dll. One of this call is done each time the control render. It works fine when running, but Visual Studio crash when I add the control to a form using the designer, telling me that the coredll.dll is not find. How can I prevent that ? I've added DesktopCompatible = true is the xmta file but it does not work. Thanks, Steve |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You have a few choices here...
(1) If you need to be able to make the appropriate p/invoke call within the designer then you can do something like this. [DllImport("User32", EntryPoint="GetCapture")] private static extern IntPtr GetCaptureWin(); [DllImport("Coredll", EntryPoint="GetCapture")] private static extern IntPtr GetCaptureWinCE(); .... IntPtr hWnd; if (Environment.OSVersion.Platform == PlatformID.WinCE) { hWnd = GetCaptureWinCE(); } else { hWnd = GetCaptureWin(); } (2) If you don't need to be able to make the appropriate p/invoke call within the designer then you can either check the Platform and only execute the code if your running on WinCE, as above but ignoring the "else", or you can wrap the p/invoke in a try...catch. try { // Device specific code. } catch { } -- Tim Wilson ..NET Compact Framework MVP "Steve B." <steve_beauge@com.msn_swap_com_and_msn> wrote in message news:Oxn63vqGGHA.3532@TK2MSFTNGP14.phx.gbl... > Hi, > > My custom control use some p/Invoke that are in coredll.dll. > > One of this call is done each time the control render. It works fine when > running, but Visual Studio crash when I add the control to a form using the > designer, telling me that the coredll.dll is not find. > > How can I prevent that ? > I've added DesktopCompatible = true is the xmta file but it does not work. > > Thanks, > Steve > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks,
I just add the test before the call to the api, in order to disable it on desktop. It works fine. Thanks, Steve "Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> a écrit dans le message de news: OhYVbSrGGHA.1676@TK2MSFTNGP09.phx.gbl... > You have a few choices here... > > (1) If you need to be able to make the appropriate p/invoke call within > the > designer then you can do something like this. > > [DllImport("User32", EntryPoint="GetCapture")] > private static extern IntPtr GetCaptureWin(); > [DllImport("Coredll", EntryPoint="GetCapture")] > private static extern IntPtr GetCaptureWinCE(); > > ... > > IntPtr hWnd; > > if (Environment.OSVersion.Platform == PlatformID.WinCE) > { > hWnd = GetCaptureWinCE(); > } > else > { > hWnd = GetCaptureWin(); > } > > (2) If you don't need to be able to make the appropriate p/invoke call > within the designer then you can either check the Platform and only > execute > the code if your running on WinCE, as above but ignoring the "else", or > you > can wrap the p/invoke in a try...catch. > > try > { > // Device specific code. > } > catch > { > } > > -- > Tim Wilson > .NET Compact Framework MVP > > "Steve B." <steve_beauge@com.msn_swap_com_and_msn> wrote in message > news:Oxn63vqGGHA.3532@TK2MSFTNGP14.phx.gbl... >> Hi, >> >> My custom control use some p/Invoke that are in coredll.dll. >> >> One of this call is done each time the control render. It works fine when >> running, but Visual Studio crash when I add the control to a form using > the >> designer, telling me that the coredll.dll is not find. >> >> How can I prevent that ? >> I've added DesktopCompatible = true is the xmta file but it does not >> work. >> >> Thanks, >> Steve >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

