i am trying to include the following P/Invoke function in a class:
[DllImport("coredll.dll")]
private static extern bool TerminateProcess(IntPtr hProcess,
uint ExitCode);

this is based on an MSDN article found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/ProcessManager.asp

the problem is when i try to compile, i get the error "The type or
namespace name 'DllImport' could not be found (are you missing a using
directive or an assembly reference?"

the project is a Pocket PC 2003 project.

any ideas how to successfully get this going?

Re: DLLimport by Alex

Alex
Tue Jul 05 18:56:21 CDT 2005

Are you missing the "using" directive?

using System.Runtime.Interop

Please, read the error messages. Most of them are informative, sometimes to
a fault

--
Alex Feinman
---
Visit http://www.opennetcf.org
"farseer" <farseer@optonline.net> wrote in message
news:1120607127.487611.226830@f14g2000cwb.googlegroups.com...
>i am trying to include the following P/Invoke function in a class:
> [DllImport("coredll.dll")]
> private static extern bool TerminateProcess(IntPtr hProcess,
> uint ExitCode);
>
> this is based on an MSDN article found here:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/ProcessManager.asp
>
> the problem is when i try to compile, i get the error "The type or
> namespace name 'DllImport' could not be found (are you missing a using
> directive or an assembly reference?"
>
> the project is a Pocket PC 2003 project.
>
> any ideas how to successfully get this going?
>


Re: DLLimport by farseer

farseer
Tue Jul 05 19:20:20 CDT 2005

i don't believe a using is needed with DLLImports. the error indicates
it cannot find the specified dll, but i did find that dll on my system
at the following locations:

what i did to solve this was change my device from "Pocket PC 2003 SE
Emulator" to "Pocket PC 2003 Device"


Re: DLLimport by farseer

farseer
Tue Jul 05 20:19:54 CDT 2005

i was wrong...though i thought for sure changing the taget device
worked....it is not working anymore.

so i am not sure why i can't compile. i see that the DLLs it is
referencing do exist on my system (one in System32, so should be in the
path). i am wondering if this needs to be set somewhere in the
emulator i am using and if so, how do i do this?


Re: DLLimport by ctacke/>

ctacke/>
Tue Jul 05 22:22:02 CDT 2005

No, you *must* have a "using System.Runtime.InteropServices" at the top of
the code page. That's what the error is telling you.

-Chris

"farseer" <farseer@optonline.net> wrote in message
news:1120612794.857838.42820@o13g2000cwo.googlegroups.com...
>i was wrong...though i thought for sure changing the taget device
> worked....it is not working anymore.
>
> so i am not sure why i can't compile. i see that the DLLs it is
> referencing do exist on my system (one in System32, so should be in the
> path). i am wondering if this needs to be set somewhere in the
> emulator i am using and if so, how do i do this?
>



Re: DLLimport by farseer

farseer
Tue Jul 05 22:44:06 CDT 2005

ah, thanks much.