Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / January 2005

Tip: Looking for answers? Try searching our database.

API interfacing with a LPBYTE from C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave A - 02 Jan 2005 04:51 GMT
Hi, I have the following function that I need to call from C#.

HRESULT CamPreviewGetBGR16(HANDLE hCamera,LPBYTE pBuffer);

but I am stuggling with the LPBYTE pBuffer. I have decalred it as

[DllImport("mobilecamapi.dll",EntryPoint="CamPreviewGetBGR16")]
public static extern int CamPreviewGetBGR16(uint hCamera, byte[] pBuffer);

and have called it via:

byte[] buffer = new byte[width * height * 2];
result = CamPreviewGetBGR16(cameraHandle, buffer);

It is returning with a missing method exception. I think the 'byte[]
pBuffer' in the API definition needs to be a 'uint pBuffer' but then how do
I convert the 'byte[] buffer' in the calling code to be a uint? (I am a bit
of a novice at all of this Interop stuff)

Any suggestions are greatly appreaciated.

Thanks

Dave A
Xedecimal - 02 Jan 2005 08:11 GMT
Dug around a bit for lpbyte and C# and found some information on it...

System.Runtime.InteropServices.Marshal.CopyBytesToManaged(Int32 source,
Byte[] destination, Int32 startIndex, Int32 length)

Not sure but it looks to be what will make you a managed lpbyte array, also
if you have too much trouble with this dll, there's avicap32.dll that I
always used to do webcam things with.

> Hi, I have the following function that I need to call from C#.
>
[quoted text clipped - 20 lines]
>
> Dave A
Dave A - 02 Jan 2005 13:42 GMT
Thanks! That looks like the answer.

This is for the Pocket PC. I don't think avicap32.dll will work.

Regards
Dave

> Dug around a bit for lpbyte and C# and found some information on it...
>
[quoted text clipped - 29 lines]
> >
> > Dave A

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.