469,282 Members | 1,955 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

DeviceIoControl in C#

Does any know any sample of how to do a basic DeviceIoControl with something
like IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 in C#

I have been stuck all week :(
and google doesnt yield anything of use.

Please help me, thanks
Marina
Jun 27 '08 #1
4 3681
Hi Marina,

Assuming that you are our Marina then how is the baby going?

Did you try it already in the newsgroup
microsoft.public.dotnet.languages.compactframework
It is and has always been a rather active newsgroup

http://groups.google.com/group/micro...rch+this+group

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:7F**********************************@microsof t.com...
Does any know any sample of how to do a basic DeviceIoControl with
something
like IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 in C#

I have been stuck all week :(
and google doesnt yield anything of use.

Please help me, thanks
Marina

Jun 27 '08 #2
Thank you but my mistake i meant to say:

DeviceIoControl using IOCTL_BATTERY_QUERY_STATUS (NOT CE)

Any ideas, life is hard

Marina

"Cor Ligthert[MVP]" wrote:
Hi Marina,

Assuming that you are our Marina then how is the baby going?

Did you try it already in the newsgroup
microsoft.public.dotnet.languages.compactframework
It is and has always been a rather active newsgroup

http://groups.google.com/group/micro...rch+this+group

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:7F**********************************@microsof t.com...
Does any know any sample of how to do a basic DeviceIoControl with
something
like IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 in C#

I have been stuck all week :(
and google doesnt yield anything of use.

Please help me, thanks
Marina
Jun 27 '08 #3
Marina,

There is a complete description in C++ for this how to handle this, should
be rather easy to tranform.

http://msdn.microsoft.com/en-us/libr...69(VS.85).aspx

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:AE**********************************@microsof t.com...
Thank you but my mistake i meant to say:

DeviceIoControl using IOCTL_BATTERY_QUERY_STATUS (NOT CE)

Any ideas, life is hard

Marina

"Cor Ligthert[MVP]" wrote:
>Hi Marina,

Assuming that you are our Marina then how is the baby going?

Did you try it already in the newsgroup
microsoft.public.dotnet.languages.compactframewor k
It is and has always been a rather active newsgroup

http://groups.google.com/group/micro...rch+this+group

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:7F**********************************@microso ft.com...
Does any know any sample of how to do a basic DeviceIoControl with
something
like IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 in C#

I have been stuck all week :(
and google doesnt yield anything of use.

Please help me, thanks
Marina

Jun 27 '08 #4
Thank you YES this looks like what i need to do but in C# ??

The furthest i got is:

[DllImport("Kernel32.dll", SetLastError = false, CharSet =
CharSet.Auto)]
public static extern bool DeviceIoControl(
Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
EIOControlCode IoControlCode,
[MarshalAs(UnmanagedType.AsAny)]
[In] object InBuffer,
uint nInBufferSize,
[MarshalAs(UnmanagedType.AsAny)]
[Out] object OutBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
[In] ref System.Threading.NativeOverlapped Overlapped);

i think now i need to populate some structures but i cannot find any example
on google or anywhere?
Anymore ideas?

Marina
"Cor Ligthert[MVP]" wrote:
Marina,

There is a complete description in C++ for this how to handle this, should
be rather easy to tranform.

http://msdn.microsoft.com/en-us/libr...69(VS.85).aspx

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:AE**********************************@microsof t.com...
Thank you but my mistake i meant to say:

DeviceIoControl using IOCTL_BATTERY_QUERY_STATUS (NOT CE)

Any ideas, life is hard

Marina

"Cor Ligthert[MVP]" wrote:
Hi Marina,

Assuming that you are our Marina then how is the baby going?

Did you try it already in the newsgroup
microsoft.public.dotnet.languages.compactframework
It is and has always been a rather active newsgroup

http://groups.google.com/group/micro...rch+this+group

Cor
"Marina" <Ma****@discussions.microsoft.comschreef in bericht
news:7F**********************************@microsof t.com...
Does any know any sample of how to do a basic DeviceIoControl with
something
like IOCTL_BATTERY_GETSYSTEMPOWERSTATUSEX2 in C#

I have been stuck all week :(
and google doesnt yield anything of use.

Please help me, thanks
Marina


Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jules Crown | last post: by
2 posts views Thread by Michael Allen | last post: by
1 post views Thread by Juan Pedro Gonzalez | last post: by
5 posts views Thread by Lou | last post: by
reply views Thread by Andrew | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.