1. AviCap problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Apr 20, 2005
- 489 views
I'm trying to translate a piece of C++ code that fetches an image from a web camera. But for some reason, I can't even create the capturewindow. Here's the original C++ code: HWND hWnd=capCreateCaptureWindow(_T("AviCap_FrameGrabber_lite"), WS_CHILD|WS_CLIPSIBLINGS, x, y, 160, 120, pParentWnd?pParentWnd->GetSafeHwnd():NULL, 0xffff); The msdn for that function can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capcreatecapturewindow.asp Here's my code:
include win32lib.ew include get.e include machine.e constant avicap_dll = open_dll("avicap32.dll") constant xCapCreateCaptureWindow = define_c_func(avicap_dll, "capCreateCaptureWindowA", {C_POINTER, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT}, C_INT) function CreateCaptureWindow(sequence title, atom flags, integer x, integer y, integer width, integer height, atom parent, atom unknown) atom title_mem, ret title_mem = allocate_string(title) ret = c_func(xCapCreateCaptureWindow, {title_mem, flags, x, y, width, height, parent, unknown}) free(title_mem) return ret end function constant MainWin = create(Window, "Test", 0, Default, Default, 320, 240, 0) constant CapWin = CreateCaptureWindow("AviCap_Framegrabber_lite", or_all({WS_CHILD, WS_CLIPSIBLINGS}), 0, 0, 160, 120, MainWin, 65535) print(1, CapWin) WinMain(MainWin, Normal)
For some reason, CreateCapttureWindow() returns NULL. I wish those windows api errors could be a little more informative... Regards, Alexander Toresson
2. Re: AviCap problem
- Posted by Greg Haberek <ghaberek at gmail.com> Apr 20, 2005
- 466 views
> constant CapWin = CreateCaptureWindow("AviCap_Framegrabber_lite", or_al= l({WS_CHILD, WS_CLIPSIBLINGS}), 0, 0, 160, 120, MainWin, 65535) You're attempting to pass a Win32Lib ID number to a Windows API routine. That routine is expecting a Windows handle. Use getHandle(MainWin) instead. ~Greg
3. Re: AviCap problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Apr 20, 2005
- 458 views
Greg Haberek wrote: > > > constant CapWin = CreateCaptureWindow("AviCap_Framegrabber_lite", or_al= > l({WS_CHILD, WS_CLIPSIBLINGS}), 0, 0, 160, 120, MainWin, 65535) > > You're attempting to pass a Win32Lib ID number to a Windows API > routine. That routine is expecting a Windows handle. Use > getHandle(MainWin) instead. > > ~Greg > > Thank you! It works now. Regards, Alexander Toresson
4. Re: AviCap problem
- Posted by Dave Probert <zingo at purpletiger.com> Apr 20, 2005
- 459 views
Alexander, I hope you are successful with the Webcam capture software - are you going to release it once it's done? I tried a while ago to write a wrapper for avicap.dll, but I couldn't do it - not enough skill on my part to work it out!! Good luck, Dave . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development and part-time games developer contact dave_p at purpletiger dot com . .. : :: = == == = :: : .. .
5. Re: AviCap problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Apr 21, 2005
- 448 views
Dave Probert wrote: > > Alexander, > I hope you are successful with the Webcam capture software - are you going to > release > it once it's done? This is going to be a part of a commercial program. But this part of the program is quite standard, and there's nothing secret in it. Sorry, all open source freaks. I'll have to speak with the other guy working on it, but I don't think it will pose a problem. > I tried a while ago to write a wrapper for avicap.dll, but I couldn't do it - > not enough > skill on my part to work it out!! > Actually, it's avicap32.dll. And I have a piece of code in C++ (yuck) which I'm translating from. As far as I've seen, there won't be any problem writing it in Euphoria. Regards, Alexander Toresson