LB Booster
IDE and Compiler >> Compiler >> problem with AVICAP and LBB
http://lbb.conforums.com/index.cgi?board=compiler&action=display&num=1403716919

problem with AVICAP and LBB
Post by pierscintilla on Jun 25th, 2014, 5:21pm

Hi to all.
I'm not an expert programmer and for the first time I attempt with the video.
I'm having trouble converting the program VidCapLB by Callum Lowcay with LBB.
The program after connecting the webcam show only a still image and not respond to any event including the closure of the main window.

In an attempt to understand the problem, I realized that everything works until you try closing the window "Choose" at the end of the sub "ChooseDevice".
In fact:
1) If I put (for test) the instructions
Choose.cancel #, "!Disable"
wait
immediately after DevNum = DevNum-1 the program feels the closures of both the windows Choose and main
2) If I put the same instructions before close #Choose the program feels only the close event of the #main window (not the closure of #Choose);
3) If I try to insert (for test) the instructions
Main.CapStill #, "! Disable"
wait
immediately after the return from the sub "ChooseDevice" the program no longer feels any event also if the button "CapStill" is correctly disabled.

The source code for VidCapLB (too big to put here) can be downloaded from http://callumscode.com/old_projects/.

This code work fine under LB4 and win7 x 64 pro with internal webcam of my laptop Dell.

Thank you very much for any indication
Re: problem with AVICAP and LBB
Post by Richard Russell on Jun 25th, 2014, 6:28pm

on Jun 25th, 2014, 5:21pm, pierscintilla wrote:
Thank you very much for any indication

I have explained this before. LBB will not work with arbitrary DLLs because - unlike LB - it is not a single-threaded application. DLLs are quite often fussy about which thread they are called from (the GUI thread or the interpreter's thread) - so I must set this individually for each DLL.

I don't believe that anybody has previously told me that they wish to use LBB with AVICAP, so it has not been configured for that DLL. I will make a note to do that for the next release.

Richard.
Re: problem with AVICAP and LBB
Post by pierscintilla on Jun 25th, 2014, 7:14pm

Incredible speed!
Thank you very much and look forward to ...
Re: problem with AVICAP and LBB
Post by pierscintilla on Jun 25th, 2014, 9:18pm

If you're interested, it would be nice to include in the list of dll supported by lbb also all those that are contained in the file YoingcoDLLs.zip (https://groups.yahoo.com/neo/groups/lbfiles/files/DLLs/).
They are all very interesting, especially the Comalexcel.dll which can produce excel file..
Re: problem with AVICAP and LBB
Post by Richard Russell on Jun 26th, 2014, 06:04am

on Jun 25th, 2014, 9:18pm, pierscintilla wrote:
If you're interested, it would be nice to include in the list of dll supported by lbb

I can consider providing a list, but I must emphasise that if a DLL isn't on the list it doesn't mean it won't work - it simply means it might not work.

Some DLLs, especially those that don't in themselves provide a GUI, are not fussy about what thread they are called from, and will 'just work' without any effort from me. So it is always worth trying it first.

The ones that often won't work, without me making special provision in LBB, are commonly those which create their own windows. And of course AVICAP does create a 'capture window'.

Richard.
Re: problem with AVICAP and LBB
Post by pierscintilla on Jun 26th, 2014, 09:25am

Ok. Thank you very much.
For Comalexcel I tried it and it does not work. This DLL (like the one on the same list that interfaces with WORD) could open the doc or xls documents by using the appropriate application.

Pier
Re: problem with AVICAP and LBB
Post by Richard Russell on Jun 26th, 2014, 1:18pm

on Jun 26th, 2014, 09:25am, pierscintilla wrote:
could open the doc or xls documents by using the appropriate application.

Why do you need a DLL for that? The ShellExecute API is the correct way to open a document using the registered application for the file type (e.g. Word for .doc and Excel for.xls). That works fine from LBB, of course.

I would not recommend using DLLs which have been developed simply as a workaround to LB's limitations. For example there's a DLL which can be used to access COM Automation objects, but since you can do it directly from LBB without any DLL that's preferable.

Richard.
Re: problem with AVICAP and LBB
Post by pierscintilla on Jun 26th, 2014, 7:40pm

I beg your pardon. I have not explained properly. Actually I use ShellExecute to open a document with a registered application but I use Comalexcel (and its equivalent for Word) only to GENERATE and/or to MODIFY Excel or Word files.
I was talking about opening documents just to say that the only GUI that is used by the DLL mentioned is of the application (which I think is not to be considered for the problems of working with LBB).

Pier
Re: problem with AVICAP and LBB
Post by Richard Russell on Jun 30th, 2014, 08:53am

I have updated LBB to version 2.62, which incorporates the necessary modification to ensure compatibility with AVICAP32.DLL:

http://www.lbbooster.com/LBB.exe
http://www.lbbooster.com/LBBRUN.exe

The VidCapLB program now runs correctly for me on my Windows XP machine. It doesn't run on my Windows 8.1 notebook, but neither does it run in LB 4.04 so that appears to be a different issue.

Richard.

Re: problem with AVICAP and LBB
Post by pierscintilla on Jul 1st, 2014, 5:02pm

Hello.
Thank you very much for the alert. Now, with version 2.63, the Avicap problem is solved.
It can also be with the version 6.22 but I did not tested.
I must to give you a monument!
However, I have discovered another problem:
It seems that GETBMP or BMPSAVE not works.
I copy a part of the image of the camera and go to put this in a file "temp.bmp" with the following lines:

PRINT # main, "getbmp screen 40 40 320 240"
BMPSAVE "screen", "temp.bmp"

but the image in the file is completely white ..

Many thanks
Pier
Re: problem with AVICAP and LBB
Post by Richard Russell on Jul 1st, 2014, 6:01pm

on Jul 1st, 2014, 5:02pm, pierscintilla wrote:
It seems that GETBMP or BMPSAVE not works.

The GETBMP command doesn't read the 'screen', it reads the 'graphics window'. This is documented in the Liberty BASIC help file: "This command will make a bitmap copied from the graphics window at x, y and using width and height".

A feature of LB 4.04 is that the GETBMP command doesn't actually do what the docs say - instead of copying from the graphics window it copies from the screen. This is normally undesirable, because it means if the graphics window is covered by another window GETBMP doesn't work correctly. I have fixed this fault in LBB.

It sounds as though your program relies on LB's faulty behaviour, but it should never have worked. You will need to read the screen using a 'legitimate' method, for example by using the BitBlt API (that will work in LB, too).

It would be neither sensible nor desirable for LBB to reproduce all LB's quirks, especially those which contradict the documentation. Sorry.

Richard.
Re: problem with AVICAP and LBB
Post by pierscintilla on Jul 1st, 2014, 6:20pm

Remarks absolutely shared.
Actually I realized that GETBMP copy the screen and not the graphics window, and this was a problem even if I have accepted the strange behavior.
Now I will try with BitBlt although for me (not a good programmer), is a little more complicated.
Thanks again
Pier
Re: problem with AVICAP and LBB
Post by Richard Russell on Jul 1st, 2014, 6:32pm

on Jul 1st, 2014, 6:20pm, pierscintilla wrote:
Now I will try with BitBlt although for me (not a good programmer), is a little more complicated.

If you want to save a still-frame to a bitmap file, can't you simply send the WM_CAP_FILE_SAVEDIB message:

http://msdn.microsoft.com/en-gb/library/windows/desktop/dd743900.aspx

Richard.
Re: problem with AVICAP and LBB
Post by pierscintilla on Jul 1st, 2014, 7:24pm

Help fantastic.
thank you very much!!!!!!!!!!!
Re: problem with AVICAP and LBB
Post by Richard Russell on Jul 1st, 2014, 8:28pm

on Jun 25th, 2014, 9:18pm, pierscintilla wrote:
If you're interested, it would be nice to include in the list of dll supported by lbb

I have created a page on the Wiki listing those DLLs that I know to be compatible (or incompatible) with LBB:

http://lbbooster.wikispaces.com/DLLs+compatible+with+LBB

This is of course a community-editable Wiki so can I ask that anybody with additional information adds to the page. If you find a DLL which doesn't work with LBB, but you would like it to, please also post a request here.

Richard.
Re: problem with AVICAP and LBB
Post by Richard Russell on Jul 2nd, 2014, 6:02pm

on Jun 25th, 2014, 9:18pm, pierscintilla wrote:
If you're interested, it would be nice to include in the list of dll supported by lbb also all those that are contained in the file YoingcoDLLs.zip (https://groups.yahoo.com/neo/groups/lbfiles/files/DLLs/).

Tried to look there, but membership has to be approved and I think I can predict what would happen if I tried to join. sad

Richard.

Re: problem with AVICAP and LBB
Post by pierscintilla on Jul 4th, 2014, 6:23pm

Ok, at the end to save the frame on the BMP file I used the user32 and SendMessageA that work fine.

For the YoingcoDLLs.zip file (with the various nice DLL ) if you want I can myself send it to you (is public domain) grin.

Thanks again for the generous advice and for the valuable gift (LBB)

Pier