Afternoon, All.

Just asking if anyone who has a webcam could test this email proggy for me?

I haven't got it checking for FD_WRITE yet, so it will seem to "freeze" while sending an email, because I'm just getting it to loop when it can't send.

To use:
Click on "Host" to set your smtp/pop3 host info.
Type in your email address and name.
Type in the email address and name to whom you wish to email.
Add the subject and message (obviously).
Click on the "Attach" button, and the proggy will save a small bmp from the webcam preview.
Click on "Send Mail", and the proggy will send the email.
(the webcam image will be sent with the email as an attachment).

I want to make sure the current code works on other 'puters, before I go ahead and clean up how the messages are handled.

Cheers,
Scronty
Posted on 2002-06-11 18:08:28 by Scronty
I didn't disassemble & test it yet ( :tongue: ), but I will when I am back at home.
Do you use VFW to access the Webcam via TWAIN?
If yes, Enumerate the TWAIN driver and let the user select the correct one. I have a Webcam and a Scanner on my machine... perhaps your program takes the scanner as TWAIN source :)
Posted on 2002-06-12 01:06:41 by bazik
Afternoon, bAZik.

I just used capCreateCaptureWindow to create a webcam window, and (if the returned handle is not NULL), I set its attributes using:
invoke SendMessage, hWndCap, WM_CAP_DRIVER_CONNECT, 0, 0

invoke SendMessage, hWndCap, WM_CAP_SET_PREVIEW, TRUE, 0
invoke SendMessage, hWndCap, WM_CAP_SET_PREVIEWRATE, 1, 0
invoke SendMessage, hWndCap, WM_CAP_SET_SCALE, TRUE, 0


Cheers,
Scronty
Posted on 2002-06-12 05:56:25 by Scronty


invoke SendMessage, hWndCap, WM_CAP_DRIVER_CONNECT, 0, 0


This will only allow you to use the primary capture device :/
This is what I use for enumerating the TWAIN devices:

(damn VB :) )



x = 0
Do
lResult = capGetDriverDescriptionA(x, lpszName, 255, lpszVer, 255) '// Retrieves driver info
If lResult Then
cmboSource.AddItem lpszName
x = x + 1
End If
Loop Until lResult = False
Posted on 2002-06-12 06:27:42 by bazik
Afternoon, bAZik.

Thanks for the algo.
I've made the changes so that you can select any capture devices you've got (I only have the one, so I can't actually test it).

I'll fix up the winsock message handling over the next few days so that it doesn't freeze.

Cheers,
Scronty
Posted on 2002-06-12 07:43:53 by Scronty
Hi Scronty!

There is still something wrong with the capturing. Look the attached screenshot. I have 3 TWAIN sources on my machine. You program finds only the "Microsoft WDM Image Capture (Win32)" ?!

And it doesn't make a picture at all :(

I have a Logitech Quickcam USB and run WindowsXP.

regards,
bAZiK
Posted on 2002-06-12 09:29:22 by bazik
Hi scronty, seems to work fine on my machine, shows the 2 devices in the list - running win 98se here
Posted on 2002-06-12 10:36:12 by Terab
Afternoon, Terab.

Thanks for that.

Afternoon, bAZik.

Here's the code I'm using to enumerate the devices and add them to the combobox:
; make a capture window

invoke RtlZeroMemory, ADDR buffer, sizeof buffer
invoke RtlZeroMemory, ADDR buffer2, sizeof buffer2
invoke GetDlgItem, hWnd, 144
mov hComboCapture, eax
mov ecx, 0
@@:
push ecx
invoke capGetDriverDescription, ecx, ADDR buffer, \
sizeof buffer, ADDR buffer2, sizeof buffer2
mov bResult, eax
.if eax == TRUE
invoke SendMessage, hComboCapture, CB_ADDSTRING, 0, ADDR buffer
.endif
pop ecx
add ecx, 1
cmp bResult, TRUE
jz @B

invoke SendMessage, hComboCapture, CB_SETCURSEL, 0, 0


Is this what you use? I don't know why it isn't working in XP:/

Cheers,
Scronty
Posted on 2002-06-12 21:48:10 by Scronty
Strange that this is not working...
BTW,



invoke GetDlgItem, hWnd, 144
mov hComboCapture, eax
xor ecx, ecx
@@:
push ecx
invoke capGetDriverDescription, ecx, ADDR buffer, \
sizeof buffer, ADDR buffer2, sizeof buffer2
or eax, eax
jz @F
invoke SendMessage, hComboCapture, CB_ADDSTRING, 0, ADDR buffer
invoke RtlZeroMemory, ADDR buffer, sizeof buffer ; better to empty them on each loop
invoke RtlZeroMemory, ADDR buffer2, sizeof buffer2
pop ecx
inc ecx
jmp @B
@@:

invoke SendMessage, hComboCapture, CB_SETCURSEL, 0, 0


optimized it a bit :)
Posted on 2002-06-13 00:53:30 by bazik

Hi scronty, seems to work fine on my machine, shows the 2 devices in the list - running win 98se here


Does it also show the "Microsoft WDM Image Capture (Win32)"?

I'll test it at my Win98 box when I am back at home.
Posted on 2002-06-13 00:55:09 by bazik



Does it also show the "Microsoft WDM Image Capture (Win32)"?

I'll test it at my Win98 box when I am back at home.


Yes shows Logitech quickcam express and the WDM stuff

I should be getting a second cam today so will test with that too. FUnny this is mentioned as one of the programs i'm working on for a client at the moment is webcam and internet related.
Posted on 2002-06-13 01:56:41 by Terab
Afternoon, All.

I've made a few adjustments. If it works, then it's because those buffers are being zero'ed out now.

Just to point out the obvious:
"Adjust" pops up any dialog boxes which the selected device has, so that its settings can be adjusted.
"Save" saves the current image as webcam.bmp
"Attach" if checked, it will attach webcam.bmp as an attachment. if not, then only the message is sent.

As with the combobox:
A device is initialized when the user selects it from the dropdown list. I've now made it so that a device name *isn't* displayed in the selection field. This should avoid confusion ;p .

Cheers,
Scronty
Posted on 2002-06-13 02:26:22 by Scronty
Afternoon, All.

Just attaching the vfw.inc file I've done so far. Not all of it has been translated from vfw.h yet, though there's enough in it for people to get a webcam up and running.

Cheers,
Scronty
Posted on 2002-06-13 18:15:36 by Scronty
Sorry, none of the files work on WinXP Pro. I get the same thing bAZiK got.
Posted on 2002-06-14 08:50:27 by Qweerdy
Afternoon, Qweedy.

Thanks for the reply.

In which way isn't it working? It's not enumerating all of your devices?

Does this one work?

Cheers,
Scronty
Posted on 2002-06-14 09:55:23 by Scronty
It showed "Microsoft WDM Image capture" but when I selected it the screen stayed black. I thought it was your program since Bazik reported something similar but... well... my webcam wasn't plugged in!! :grin: :o :o

:stupid:
Posted on 2002-06-15 13:50:12 by Qweerdy