Announcement

Collapse
No announcement yet.

Multiple embedded applications on one screen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple embedded applications on one screen

    Is there a way to have multiple application areas (Axx) on one screen AND indicate which embedded application shows in which area?

    Actually, any technique to cause this to happen would be helpful.

    Regards,
    Jim

  • #3
    Since my intent was to have multiple video cameras sending "thumbnails" while towing a trailer, I looked into such applications so I could simply embed the application screen showing multiple video feeds.

    I found the simplest to be an AutoIt script that used the WDM interface for video cameras and I modified it to show four video feeds each in a quadrant of the main window and I embed that.

    Its about 30 lines of code and works great.

    Comment


    • #4
      I would love to see a copy of that script if you do not mind sharing....
      Front End of Choice: Ride Runner (Is there anything else??? ) & Powered by the DFX5.1 Skin Available in the Mobile App Mart

      My Fiero Build Thread

      Comment


      • #5
        JohnWPB,

        This is "testbed" code. You will notice some routines that are not used. They are there as "repositories" on how to do something. This code will be enhanced along with additional code/buttons/other things in RR so that when displayed I can touch a capture area and have it go fullscreen and reverse that process by touching fullscreen.

        My ultimate intent is to have this display a rear camera (on my trailer), two side cameras, and a front camera. This will be used to give me full coverage when towing my trailer. Right now the project is waiting for the funds to purchase 3 more cheap WDM compliant cameras which I am having trouble finding.

        The code is based on a script contributed by a number of folks on the AutoIt forums and further reworked by me.

        I apologize if I have violated any forum rules by including the code as I did.

        Please notice the horizontal scroll bar at the bottom of the code insert.

        Regards,
        Jim

        Code:
        $WM_CAP_START = 0x400
        $WM_CAP_UNICODE_START = $WM_CAP_START + 100
        $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
        $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
        $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
        $WM_CAP_ABORT = $WM_CAP_START + 69
        $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
        $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
        $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
        $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
        $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
        $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
        $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14
        $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12
        $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
        $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
        $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
        $WM_CAP_EDIT_COPY = $WM_CAP_START + 30
        $WM_CAP_END = $WM_CAP_UNICODE_END
        $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
        $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
        $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
        $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
        $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
        $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
        $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
        $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
        $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
        $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
        $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
        $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
        $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
        $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
        $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
        $WM_CAP_GET_STATUS = $WM_CAP_START + 54
        $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
        $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
        $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
        $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
        $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
        $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
        $WM_CAP_PAL_OPENA = $WM_CAP_START + 80
        $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
        $WM_CAP_PAL_PASTE = $WM_CAP_START + 82
        $WM_CAP_SEQUENCE = $WM_CAP_START + 62
        $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
        $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
        $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
        $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
        $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
        $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
        $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
        $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
        $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
        $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
        $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
        $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
        $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
        $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
        $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
        $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
        $WM_CAP_SET_SCALE = $WM_CAP_START + 53
        $WM_CAP_SET_SCROLL = $WM_CAP_START + 55
        $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
        $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
        $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
        $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
        $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
        $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
        $WM_CAP_STOP = $WM_CAP_START + 68
        
        
        #include <WindowsConstants.au3>
        #include <GUIConstants.au3>
        
        ;===============================================================================
        ;
        ; Description:      Main program
        ;
        ;===============================================================================
        
        ; Prepare the required Windows DLLs
        $avi = DllOpen("avicap32.dll")
        $user = DllOpen("user32.dll")
        
        ; Build the main window with the window title "RRMulti" to be used for embedding
        $Main = GUICreate("RRMulti", 800, 600, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
        
        ;===============================================================================
        ; Create 4 capture windows, one for each camera
        ; Notes: 1. Windows can be added or removed as needed.
        ;        2. The WDM Capture Device is indicated in the $WM_CAP_DRIVER_CONNECT message for each capture window
        ;        3. The size and location of the capture area is set in the "capCreateCaptureWindow" DLL call
        ;        4. The script will run without cameras connected and will show 4 black capture areas
        ;===============================================================================
        
        $cap0 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 1, "int", 1, "int", 400, "int", 300, "hwnd", $Main, "int", 1)
        DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
        
        $cap1 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 402, "int", 1, "int", 400, "int", 300, "hwnd", $Main, "int", 1)
        DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
        
        $cap2 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 1, "int", 302, "int", 400, "int", 300, "hwnd", $Main, "int", 1)
        DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 2, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
        
        $cap3 = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 402, "int", 302, "int", 400, "int", 300, "hwnd", $Main, "int", 1)
        DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 3, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
        DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
        
        ; Start the display
        GUISetState(@SW_SHOW)
        ;HotKeySet("{INSERT}", "SnapShot"); Press 'Insert' to make a SnapShot !
        
        ; Process Windows messages, we only look at the Close event so the cameras can be disconnected
        ; Note:  This routine can also handle messsages sent by other RR programs
        While 1
        	$msg = GUIGetMsg()
        	If $msg = $GUI_EVENT_CLOSE Then
        		DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_END, "int", 0, "int", 0)
        		DllCall($user, "int", "SendMessage", "hWnd", $cap0[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
        		
        		DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_END, "int", 0, "int", 0)
        		DllCall($user, "int", "SendMessage", "hWnd", $cap1[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
        		
        		DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_END, "int", 0, "int", 0)
        		DllCall($user, "int", "SendMessage", "hWnd", $cap2[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
        		
        		DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_END, "int", 0, "int", 0)
        		DllCall($user, "int", "SendMessage", "hWnd", $cap3[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
        		
        		DllClose($user)
        		Exit
        	EndIf
        	Sleep(1)
        WEnd
        
        
        ;===============================================================================
        ;
        ; Description:      Takes a snapshot
        ; Syntax:           Snapshot($sFile, $sId)
        ; Parameter(s):     $sId       - Id  ($cap{0-3}[0])
        ;                   $sFile     - File to save the picture to (*.avi)
        ; Requirement(s):   A webcam
        ; Return Value(s):  On Success - Returns 1
        ;                   On Failure - Returns 0
        ; Author(s):        Ludocus
        ; Note(s):
        ;
        ;===============================================================================
        Func SnapShot($sFile, $sId)
        	DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
        	DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $sFile)
        EndFunc   
        
        
        ;===============================================================================
        ;
        ; Description:      Starts recording the webcam to a file
        ; Syntax:           RecordStart($sFile, $sId)
        ; Parameter(s):     $sId       - Id  ($cap{0-3}[0])
        ;                   $sFile     - File to save the movie to (*.avi)
        ; Requirement(s):   A webcam
        ; Return Value(s):  On Success - Returns 1
        ;                   On Failure - Returns 0
        ; Author(s):        Ludocus
        ; Note(s):          Stop recording by: RecordStop($Id)
        ;
        ;===============================================================================
        Func RecordStart($sFile, $sId)
        	DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $sFile)
        	DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0)
        	If @error Then
        		Return 0
        	Else
        		Return 1
        	EndIf
        
        EndFunc   
        
        ;===============================================================================
        ;
        ; Description:      Stops recording.
        ; Syntax:           RecordStop($sId)
        ; Parameter(s):     $sId       - Id ($cap{0-3}[0])
        ; Requirement(s):   A webcam
        ; Return Value(s):  On Success - Returns 1
        ;                   On Failure - Returns 0
        ; Author(s):        Ludocus
        ; Note(s):          None
        ;
        ;===============================================================================
        Func RecordStop($sId)
        	DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_STOP, "int", 0, "int", 0)
        	If @error Then
        		Return 0
        	Else
        		Return 1
        	EndIf
        EndFunc

        Comment

        Working...
        X