Hi..
I've got a question about SendMessage API (in context of capturing webcam image)..
Below is the code for capturing image from a webcam.
I am wondering, what does SendMessage(hwdc, 1034, 0, 0) do..? When I change the number to 1033, it doesn't work.. Does anybody know where i can find out what all the numbers in the SendMessage command mean..? I guess its part of SendMessage API...
Thanks..
Code:'Module1 Public Const ws_child As Long = &H40000000 Public Const ws_visible As Long = &H10000000 Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal a As String, ByVal b As Long, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer, ByVal g As Long, ByVal h As Integer) As Long 'Code Dim hwdc As Long Dim startcap As Boolean Private Sub cmdCapture_Click() Dim temp As Long hwdc = capCreateCaptureWindow("Dixanta Vision System", ws_child Or ws_visible, 0, 0, 320, 240, Picture1.hWnd, 0) If (hwdc <> 0) Then temp = SendMessage(hwdc, 1034, 0, 0) temp = SendMessage(hwdc, 1074, 1, 0) temp = SendMessage(hwdc, 1076, 30, 0) startcap = True Else MsgBox ("No Webcam found") End If End Sub Private Sub cmdClose_Click() Dim temp As Long If startcap = True Then temp = SendMessage(hwdc, 1035, 0&, 0&) startcap = False End If End Sub Private Sub cmdVideoFormat_Click() Dim temp As Long If startcap = True Then temp = SendMessage(hwdc, 1065, 0&, 0&) End If End Sub
+ Reply to Thread
Results 1 to 8 of 8
-
-
Well SendMessage is simply defined as:
Code:Syntax LRESULT SendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); Parameters hWnd [in] Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows. Msg [in] Specifies the message to be sent. wParam [in] Specifies additional message-specific information. lParam [in] Specifies additional message-specific information.
So what are these user defined Msg constants for avicap32.dll? Well this is what i found:
Code:public const int WM_USER = 1024; public const int WM_CAP_CONNECT = 1034; public const int WM_CAP_DISCONNECT = 1035; public const int WM_CAP_GET_FRAME = 1084; public const int WM_CAP_COPY = 1054; public const int WM_CAP_START = WM_USER; public const int WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41; public const int WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42; public const int WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43; public const int WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44; public const int WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45; public const int WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46; public const int WM_CAP_SET_PREVIEW = WM_CAP_START + 50;
Hope that helps.SVCD2DVD v2.5, AVI/MPEG/HDTV/AviSynth/h264->DVD, PAL->NTSC conversion.
VOB2MPG PRO, Extract mpegs from your DVDs - with you in control! -
I see.. So, if I understand corectly, SendMessage is used to interface or to communicate between the current window and avicap32.dll rite..?
-
In short - yes.
SVCD2DVD v2.5, AVI/MPEG/HDTV/AviSynth/h264->DVD, PAL->NTSC conversion.
VOB2MPG PRO, Extract mpegs from your DVDs - with you in control! -
Not exactly.
MS Docs say, "The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message."
A message is never sent to a DLL. It's sent to a window. Now, the window may have been created by a function in the DLL, and the DLL may be responsible for controlling that window, but technically the message is sent to the window. Not the DLL. -
Quite true. I was keeping my second answer brief...
SVCD2DVD v2.5, AVI/MPEG/HDTV/AviSynth/h264->DVD, PAL->NTSC conversion.
VOB2MPG PRO, Extract mpegs from your DVDs - with you in control! -
Sorry to butt in but:
Shouldn't the code in the original post use WM_CAP_CONNECT instead of 1034? It makes the code more readable, and more importantly, should the actual value (1034) ever need to change, the code that uses it won't. Two big reason to use symbolic constants instead of their values
Similar Threads
-
Security api failed 60008
By paddychops in forum MacReplies: 1Last Post: 6th Dec 2011, 21:39 -
SDK/API compatibility for COMPRO E850F
By gonzalo.ferrando in forum ProgrammingReplies: 0Last Post: 27th Apr 2010, 07:00 -
Very Challenging Issue with API-557-EFS
By pcb-geek in forum Capturing and VCRReplies: 0Last Post: 10th Mar 2009, 11:46 -
How to read the resolution of video via API?
By jsdf in forum ProgrammingReplies: 2Last Post: 12th Mar 2008, 07:45 -
API "SetParent" in VB6: Function & Ctrl keys don't work
By gll99 in forum ProgrammingReplies: 4Last Post: 9th Mar 2008, 19:37