MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

Obrigado

Administração do MaximoAccess

Dicas Ms Access, Exemplos Ms Access, Codigos VBA Ms Access, SQL Ms Access

    Converter Módulo VBA projetado em 32bits para 64Bits

    Compartilhe

    daygdson
    Novato
    Novato

    Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 42
    Registrado : 20/04/2017

    Converter Módulo VBA projetado em 32bits para 64Bits

    Mensagem  daygdson em Seg 28 Ago 2017, 23:54

    Boa Noite caros colegas, estou com um problema de conversão de sistema projetado inicialmente em Access 2010 32bits e adaptado para 2016 64bits, funciona quase tudo, somente um módulo que chama a webcam não está funcionando no 64bits, no 32bits funciona perfeitamente. Ja tentei colocar as declarações com PtrSafe, funcões com LongPtr mas não obtive resultado.
    Código:
    Public Const WM_USER = &H400
    Type POINTAPI
            X As LongPtr
            Y As LongPtr
    End Type
    #If VBA7 Then
       'Área comum do Access 2010 de 32 bits e 64 bits
       Declare PtrSafe Function GetActiveWindow Lib "user32" () As LongPtr
       #If Win64 Then
          'Área exclusiva do Access 2010 de 64 bits
          Declare PtrSafe Function GetTickCount64 Lib "Kernel32" () As LongPtr
          Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As LongPtr, ByVal wParam As Integer, ByVal lParam As String) As LongPtr

       #Else
          'Área exclusiva do Access 2010 de 32 bits
          Declare PtrSafe Function GetTickCount Lib "Kernel32" () As Long
          Declare PtrSafe Function SendMessageS Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As LongPtr, ByVal wParam As Integer, ByVal lParam As LongPtr) As LongPtr

       #End If

    #End If

    Public Const WM_CAP_START = WM_USER
    Public Const WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1
    Public Const WM_CAP_SET_CALLBACK_ERROR = WM_CAP_START + 2
    Public Const WM_CAP_SET_CALLBACK_STATUS = WM_CAP_START + 3
    Public Const WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4
    Public Const WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5
    Public Const WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6
    Public Const WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7
    Public Const WM_CAP_GET_USER_DATA = WM_CAP_START + 8
    Public Const WM_CAP_SET_USER_DATA = WM_CAP_START + 9
    Public Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
    Public Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
    Public Const WM_CAP_DRIVER_GET_NAME = WM_CAP_START + 12
    Public Const WM_CAP_DRIVER_GET_VERSION = WM_CAP_START + 13
    Public Const WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14
    Public Const WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_START + 20
    Public Const WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_START + 21
    Public Const WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22
    Public Const WM_CAP_FILE_SAVEAS = WM_CAP_START + 23
    Public Const WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24
    Public Const WM_CAP_FILE_SAVEDIB = WM_CAP_START + 25
    Public Const WM_CAP_EDIT_COPY = WM_CAP_START + 30
    Public Const WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35
    Public Const WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36
    Public Const WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41
    Public Const WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42
    Public Const WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43
    Public Const WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44
    Public Const WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45
    Public Const WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46
    Public Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50
    Public Const WM_CAP_SET_OVERLAY = WM_CAP_START + 51
    Public Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
    Public Const WM_CAP_SET_SCALE = WM_CAP_START + 53
    Public Const WM_CAP_GET_STATUS = WM_CAP_START + 54
    Public Const WM_CAP_SET_SCROLL = WM_CAP_START + 55
    Public Const WM_CAP_GRAB_FRAME = WM_CAP_START + 60
    Public Const WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61
    Public Const WM_CAP_SEQUENCE = WM_CAP_START + 62
    Public Const WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63
    Public Const WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64
    Public Const WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65
    Public Const WM_CAP_SET_MCI_DEVICE = WM_CAP_START + 66
    Public Const WM_CAP_GET_MCI_DEVICE = WM_CAP_START + 67
    Public Const WM_CAP_STOP = WM_CAP_START + 68
    Public Const WM_CAP_ABORT = WM_CAP_START + 69
    Public Const WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70
    Public Const WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71
    Public Const WM_CAP_SINGLE_FRAME = WM_CAP_START + 72
    Public Const WM_CAP_PAL_OPEN = WM_CAP_START + 80
    Public Const WM_CAP_PAL_SAVE = WM_CAP_START + 81
    Public Const WM_CAP_PAL_PASTE = WM_CAP_START + 82
    Public Const WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83
    Public Const WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84
    Public Const WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85
    Public Const WM_CAP_END = WM_CAP_SET_CALLBACK_CAPCONTROL
    Type CAPDRIVERCAPS
        wDeviceIndex As LongPtr
        fHasOverlay As LongPtr
        fHasDlgVideoSource As LongPtr
        fHasDlgVideoFormat As LongPtr
        fHasDlgVideoDisplay As LongPtr
        fCaptureInitialized As LongPtr
        fDriverSuppliesPalettes As LongPtr
        hVideoIn As LongPtr
        hVideoOut As LongPtr
        hVideoExtIn As LongPtr
        hVideoExtOut As LongPtr
    End Type
    Type CAPSTATUS
        uiImageWidth As LongPtr
        uiImageHeight As LongPtr
        fLiveWindow As LongPtr
        fOverlayWindow As LongPtr
        fScale As LongPtr
        ptScroll As POINTAPI
        fUsingDefaultPalette As LongPtr
        fAudioHardware As LongPtr
        fCapFileExists As LongPtr
        dwCurrentVideoFrame As LongPtr
        dwCurrentVideoFramesDropped As LongPtr
        dwCurrentWaveSamples As LongPtr
        dwCurrentTimeElapsedMS As LongPtr
        hPalCurrent As LongPtr
        fCapturingNow As LongPtr
        dwReturn As LongPtr
        wNumVideoAllocated As LongPtr
        wNumAudioAllocated As LongPtr
    End Type
    Type CAPTUREPARMS
        dwRequestMicroSecPerFrame As LongPtr
        fMakeUserHitOKToCapture As LongPtr
        wPercentDropForError As LongPtr
        fYield As LongPtr
        dwIndexSize As LongPtr
        wChunkGranularity As LongPtr
        fUsingDOSMemory As LongPtr
        wNumVideoRequested As LongPtr
        fCaptureAudio As LongPtr
        wNumAudioRequested As LongPtr
        vKeyAbort As LongPtr
        fAbortLeftMouse As LongPtr
        fAbortRightMouse As LongPtr
        fLimitEnabled As LongPtr
        wTimeLimit As LongPtr
        fMCIControl As LongPtr
        fStepMCIDevice As LongPtr
        dwMCIStartTime As LongPtr
        dwMCIStopTime As LongPtr
        fStepCaptureAt2x As LongPtr
        wStepCaptureAverageFrames As LongPtr
        dwAudioBufferSize As LongPtr
        fDisableWriteCache As LongPtr
    End Type
    Type CAPINFOCHUNK
        fccInfoID As LongPtr
        lpData As LongPtr
        cbData As LongPtr
    End Type
    Type VIDEOHDR
        lpData As LongPtr
        dwBufferLength As LongPtr
        dwBytesUsed As LongPtr
        dwTimeCaptured As LongPtr
        dwUser As LongPtr
        dwFlags As LongPtr
        dwReserved(3) As LongPtr
    End Type
    Declare PtrSafe Function capCreateCaptureWindowA Lib "avicap32.dll" ( _
        ByVal lpszWindowName As String, _
        ByVal dwStyle As LongPtr, _
        ByVal X As LongPtr, ByVal Y As LongPtr, ByVal nWidth As LongPtr, ByVal nHeight As Integer, _
        ByVal hWndParent As LongPtr, ByVal nID As LongPtr) As LongPtr
    Declare PtrSafe Function capGetDriverDescriptionA Lib "avicap32.dll" ( _
        ByVal wDriver As Integer, _
        ByVal lpszName As String, _
        ByVal cbName As LongPtr, _
        ByVal lpszVer As String, _
        ByVal cbVer As LongPtr) As Boolean
    Public Const IDS_CAP_BEGIN = 300
    Public Const IDS_CAP_END = 301
    Public Const IDS_CAP_INFO = 401
    Public Const IDS_CAP_OUTOFMEM = 402
    Public Const IDS_CAP_FILEEXISTS = 403
    Public Const IDS_CAP_ERRORPALOPEN = 404
    Public Const IDS_CAP_ERRORPALSAVE = 405
    Public Const IDS_CAP_ERRORDIBSAVE = 406
    Public Const IDS_CAP_DEFAVIEXT = 407
    Public Const IDS_CAP_DEFPALEXT = 408
    Public Const IDS_CAP_CANTOPEN = 409
    Public Const IDS_CAP_SEQ_MSGSTART = 410
    Public Const IDS_CAP_SEQ_MSGSTOP = 411
    Public Const IDS_CAP_VIDEDITERR = 412
    Public Const IDS_CAP_READONLYFILE = 413
    Public Const IDS_CAP_WRITEERROR = 414
    Public Const IDS_CAP_NODISKSPACE = 415
    Public Const IDS_CAP_SETFILESIZE = 416
    Public Const IDS_CAP_SAVEASPERCENT = 417
    Public Const IDS_CAP_DRIVER_ERROR = 418
    Public Const IDS_CAP_WAVE_OPEN_ERROR = 419
    Public Const IDS_CAP_WAVE_ALLOC_ERROR = 420
    Public Const IDS_CAP_WAVE_PREPARE_ERROR = 421
    Public Const IDS_CAP_WAVE_ADD_ERROR = 422
    Public Const IDS_CAP_WAVE_SIZE_ERROR = 423
    Public Const IDS_CAP_VIDEO_OPEN_ERROR = 424
    Public Const IDS_CAP_VIDEO_ALLOC_ERROR = 425
    Public Const IDS_CAP_VIDEO_PREPARE_ERROR = 426
    Public Const IDS_CAP_VIDEO_ADD_ERROR = 427
    Public Const IDS_CAP_VIDEO_SIZE_ERROR = 428
    Public Const IDS_CAP_FILE_OPEN_ERROR = 429
    Public Const IDS_CAP_FILE_WRITE_ERROR = 430
    Public Const IDS_CAP_RECORDING_ERROR = 431
    Public Const IDS_CAP_RECORDING_ERROR2 = 432
    Public Const IDS_CAP_AVI_INIT_ERROR = 433
    Public Const IDS_CAP_NO_FRAME_CAP_ERROR = 434
    Public Const IDS_CAP_NO_PALETTE_WARN = 435
    Public Const IDS_CAP_MCI_CONTROL_ERROR = 436
    Public Const IDS_CAP_MCI_CANT_STEP_ERROR = 437
    Public Const IDS_CAP_NO_AUDIO_CAP_ERROR = 438
    Public Const IDS_CAP_AVI_DRAWDIB_ERROR = 439
    Public Const IDS_CAP_COMPRESSOR_ERROR = 440
    Public Const IDS_CAP_AUDIO_DROP_ERROR = 441
    Public Const IDS_CAP_STAT_LIVE_MODE = 500
    Public Const IDS_CAP_STAT_OVERLAY_MODE = 501
    Public Const IDS_CAP_STAT_CAP_INIT = 502
    Public Const IDS_CAP_STAT_CAP_FINI = 503
    Public Const IDS_CAP_STAT_PALETTE_BUILD = 504
    Public Const IDS_CAP_STAT_OPTPAL_BUILD = 505
    Public Const IDS_CAP_STAT_I_FRAMES = 506
    Public Const IDS_CAP_STAT_L_FRAMES = 507
    Public Const IDS_CAP_STAT_CAP_L_FRAMES = 508
    Public Const IDS_CAP_STAT_CAP_AUDIO = 509
    Public Const IDS_CAP_STAT_VIDEOCURRENT = 510
    Public Const IDS_CAP_STAT_VIDEOAUDIO = 511
    Public Const IDS_CAP_STAT_VIDEOONLY = 512
    Public Const WS_BORDER = &H800000
    Public Const WS_CAPTION = &HC00000
    Public Const WS_SYSMENU = &H80000
    Public Const WS_CHILD = &H40000000
    Public Const WS_VISIBLE = &H10000000
    Public Const WS_OVERLAPPED = &H0&
    Public Const WS_MINIMIZEBOX = &H20000
    Public Const WS_MAXIMIZEBOX = &H10000
    Public Const WS_THICKFRAME = &H40000
    Public Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOSIZE = 1
    Public Const SWP_NOZORDER = &H4
    Public Const HWND_BOTTOM = 1
    Public Const HWND_TOPMOST = -1
    Public Const HWND_NOTOPMOST = -2
    Public Const SM_CYCAPTION = 4
    Public Const SM_CXFRAME = 32
    Public Const SM_CYFRAME = 33
    Public Const WS_EX_TRANSPARENT = &H20&
    Public Const GWL_STYLE = (-16)
    Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As LongPtr, ByVal dwNewLongPtr As LongPtr) As LongPtr
    Declare PtrSafe Function lStrCpy Lib "Kernel32" Alias "lstrcpyA" (ByVal lpString1 As LongPtr, ByVal lpString2 As LongPtr) As LongPtr
    Declare PtrSafe Function lStrCpyn Lib "Kernel32" Alias "lstrcpynA" (ByVal lpString1 As Any, ByVal lpString2 As LongPtr, ByVal iMaxLength As LongPtr) As LongPtr
    Declare PtrSafe Sub RtlMoveMemory Lib "Kernel32" (ByVal hpvDest As LongPtr, ByVal hpvSource As LongPtr, ByVal cbCopy As LongPtr)
    Declare PtrSafe Sub hmemcpy Lib "Kernel32" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As LongPtr)
    Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hwnd As LongPtr, ByVal hWndInsertAfter As LongPtr, ByVal X As LongPtr, ByVal Y As LongPtr, ByVal cx As LongPtr, ByVal cy As LongPtr, ByVal wFlags As LongPtr) As LongPtr
    Declare PtrSafe Function DestroyWindow Lib "user32" (ByVal hndw As LongPtr) As Boolean
    Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As LongPtr) As LongPtr
    Declare PtrSafe Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As LongPtr, ByVal lpString As String) As LongPtr
    Public lwndC As LongPtr

    Function capSetCallbackOnError(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnError = SendMessage(lwnd, WM_CAP_SET_CALLBACK_ERROR, 0, lpProc)
    End Function
    Function capSetCallbackOnStatus(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnStatus = SendMessage(lwnd, WM_CAP_SET_CALLBACK_STATUS, 0, lpProc)
    End Function
    Function capSetCallbackOnYield(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnYield = SendMessage(lwnd, WM_CAP_SET_CALLBACK_YIELD, 0, lpProc)
    End Function
    Function capSetCallbackOnFrame(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnFrame = SendMessage(lwnd, WM_CAP_SET_CALLBACK_FRAME, 0, lpProc)
    End Function
    Function capSetCallbackOnVideoStream(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnVideoStream = SendMessage(lwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, lpProc)
    End Function
    Function capSetCallbackOnWaveStream(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnWaveStream = SendMessage(lwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, lpProc)
    End Function
    Function capSetCallbackOnCapControl(ByVal lwnd As LongPtr, ByVal lpProc As LongPtr) As Boolean
       capSetCallbackOnCapControl = SendMessage(lwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, lpProc)
    End Function
    Function capSetUserData(ByVal lwnd As LongPtr, ByVal lUser As LongPtr) As Boolean
       capSetUserData = SendMessage(lwnd, WM_CAP_SET_USER_DATA, 0, lUser)
    End Function
    Function capGetUserData(ByVal lwnd As LongPtr) As LongPtr
       capGetUserData = SendMessage(lwnd, WM_CAP_GET_USER_DATA, 0, 0)
    End Function
    Function capDriverConnect(ByVal lwnd As LongPtr, ByVal i As Integer) As Boolean
       capDriverConnect = SendMessage(lwnd, WM_CAP_DRIVER_CONNECT, i, 0)
    End Function
    Function capDriverDisconnect(ByVal lwnd As LongPtr) As Boolean
       capDriverDisconnect = SendMessage(lwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0)
    End Function
    Function capDriverGetName(ByVal lwnd As LongPtr, ByVal szName As LongPtr, ByVal wSize As Integer) As Boolean
       capDriverGetName = SendMessage(lwnd, YOURCONSTANTMESSAGE, wSize, szName)
    End Function
    Function capDriverGetVersion(ByVal lwnd As LongPtr, ByVal szVer As LongPtr, ByVal wSize As Integer) As Boolean
       capDriverGetVersion = SendMessage(lwnd, WM_CAP_DRIVER_GET_VERSION, wSize, szVer)
    End Function
    Function capDriverGetCaps(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capDriverGetCaps = SendMessage(lwnd, WM_CAP_DRIVER_GET_CAPS, wSize, s)
    End Function
    Function capFileSetCaptureFile(ByVal lwnd As LongPtr, szName As String) As Boolean
       capFileSetCaptureFile = SendMessageS(lwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, szName)
    End Function
    Function capFileGetCaptureFile(ByVal lwnd As LongPtr, ByVal szName As LongPtr, wSize As String) As Boolean
       capFileGetCaptureFile = SendMessageS(lwnd, WM_CAP_FILE_SET_CAPTURE_FILE, wSize, szName)
    End Function
    Function capFileAlloc(ByVal lwnd As LongPtr, ByVal dwSize As LongPtr) As Boolean
       capFileAlloc = SendMessage(lwnd, WM_CAP_FILE_ALLOCATE, 0, dwSize)
    End Function
    Function capFileSaveAs(ByVal lwnd As LongPtr, szName As String) As Boolean
       capFileSaveAs = SendMessageS(lwnd, WM_CAP_FILE_SAVEAS, 0, szName)
    End Function
    Function capFileSetInfoChunk(ByVal lwnd As LongPtr, ByVal lpInfoChunk As LongPtr) As Boolean
       capFileSetInfoChunk = SendMessage(lwnd, WM_CAP_FILE_SET_INFOCHUNK, 0, lpInfoChunk)
    End Function
    Function capFileSaveDIB(ByVal lwnd As LongPtr, ByVal szName As LongPtr) As Boolean
       capFileSaveDIB = SendMessage(lwnd, WM_CAP_FILE_SAVEDIB, 0, szName)
    End Function
    Function capEditCopy(ByVal lwnd As LongPtr) As Boolean
       capEditCopy = SendMessage(lwnd, WM_CAP_EDIT_COPY, 0, 0)
    End Function
    Function capSetAudioFormat(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capSetAudioFormat = SendMessage(lwnd, WM_CAP_SET_AUDIOFORMAT, wSize, s)
    End Function
    Function capGetAudioFormat(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As LongPtr
       capGetAudioFormat = SendMessage(lwnd, WM_CAP_GET_AUDIOFORMAT, wSize, s)
    End Function
    Function capGetAudioFormatSize(ByVal lwnd As LongPtr) As LongPtr
       capGetAudioFormatSize = SendMessage(lwnd, WM_CAP_GET_AUDIOFORMAT, 0, 0)
    End Function
    Function capDlgVideoFormat(ByVal lwnd As LongPtr) As Boolean
       capDlgVideoFormat = SendMessage(lwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0)
    End Function
    Function capDlgVideoSource(ByVal lwnd As LongPtr) As Boolean
       capDlgVideoSource = SendMessage(lwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0)
    End Function
    Function capDlgVideoDisplay(ByVal lwnd As LongPtr) As Boolean
       capDlgVideoDisplay = SendMessage(lwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0)
    End Function
    Function capDlgVideoCompression(ByVal lwnd As LongPtr) As Boolean
       capDlgVideoCompression = SendMessage(lwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0)
    End Function
    Function capGetVideoFormat(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As LongPtr
       capGetVideoFormat = SendMessage(lwnd, WM_CAP_GET_VIDEOFORMAT, wSize, s)
    End Function
    Function capGetVideoFormatSize(ByVal lwnd As LongPtr) As LongPtr
       capGetVideoFormatSize = SendMessage(lwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0)
    End Function
    Function capSetVideoFormat(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capSetVideoFormat = SendMessage(lwnd, WM_CAP_SET_VIDEOFORMAT, wSize, s)
    End Function
    Function capPreview(ByVal lwnd As LongPtr, ByVal f As Boolean) As Boolean
       capPreview = SendMessage(lwnd, WM_CAP_SET_PREVIEW, f, 0)
    End Function
    Function capPreviewRate(ByVal lwnd As LongPtr, ByVal wMS As Integer) As Boolean
       capPreviewRate = SendMessage(lwnd, WM_CAP_SET_PREVIEWRATE, wMS, 0)
    End Function
    Function capOverlay(ByVal lwnd As LongPtr, ByVal f As Boolean) As Boolean
       capOverlay = SendMessage(lwnd, WM_CAP_SET_OVERLAY, f, 0)
    End Function
    Function capPreviewScale(ByVal lwnd As LongPtr, ByVal f As Boolean) As Boolean
       capPreviewScale = SendMessage(lwnd, WM_CAP_SET_SCALE, f, 0)
    End Function
    Function capGetStatus(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capGetStatus = SendMessage(lwnd, WM_CAP_GET_STATUS, wSize, s)
    End Function
    Function capSetScrollPos(ByVal lwnd As LongPtr, ByVal lpP As LongPtr) As Boolean
       capSetScrollPos = SendMessage(lwnd, WM_CAP_SET_SCROLL, 0, lpP)
    End Function
    Function capGrabFrame(ByVal lwnd As LongPtr) As Boolean
       capGrabFrame = SendMessage(lwnd, WM_CAP_GRAB_FRAME, 0, 0)
    End Function
    Function capGrabFrameNoStop(ByVal lwnd As LongPtr) As Boolean
       capGrabFrameNoStop = SendMessage(lwnd, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0)
    End Function
    Function capCaptureSequence(ByVal lwnd As LongPtr) As Boolean
       capCaptureSequence = SendMessage(lwnd, WM_CAP_SEQUENCE, 0, 0)
    End Function
    Function capCaptureSequenceNoFile(ByVal lwnd As LongPtr) As Boolean
       capCaptureSequenceNoFile = SendMessage(lwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0)
    End Function
    Function capCaptureStop(ByVal lwnd As LongPtr) As Boolean
       capCaptureStop = SendMessage(lwnd, WM_CAP_STOP, 0, 0)
    End Function
    Function capCaptureAbort(ByVal lwnd As LongPtr) As Boolean
       capCaptureAbort = SendMessage(lwnd, WM_CAP_ABORT, 0, 0)
    End Function
    Function capCaptureSingleFrameOpen(ByVal lwnd As LongPtr) As Boolean
       capCaptureSingleFrameOpen = SendMessage(lwnd, WM_CAP_SINGLE_FRAME_OPEN, 0, 0)
    End Function
    Function capCaptureSingleFrameClose(ByVal lwnd As LongPtr) As Boolean
       capCaptureSingleFrameClose = SendMessage(lwnd, WM_CAP_SINGLE_FRAME_CLOSE, 0, 0)
    End Function
    Function capCaptureSingleFrame(ByVal lwnd As LongPtr) As Boolean
       capCaptureSingleFrame = SendMessage(lwnd, WM_CAP_SINGLE_FRAME, 0, 0)
    End Function
    Function capCaptureGetSetup(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capCaptureGetSetup = SendMessage(lwnd, WM_CAP_GET_SEQUENCE_SETUP, wSize, s)
    End Function
    Function capCaptureSetSetup(ByVal lwnd As LongPtr, ByVal s As LongPtr, ByVal wSize As Integer) As Boolean
       capCaptureSetSetup = SendMessage(lwnd, WM_CAP_SET_SEQUENCE_SETUP, wSize, s)
    End Function
    Function capSetMCIDeviceName(ByVal lwnd As LongPtr, ByVal szName As LongPtr) As Boolean
       capSetMCIDeviceName = SendMessage(lwnd, WM_CAP_SET_MCI_DEVICE, 0, szName)
    End Function
    Function capGetMCIDeviceName(ByVal lwnd As LongPtr, ByVal szName As LongPtr, ByVal wSize As Integer) As Boolean
       capGetMCIDeviceName = SendMessage(lwnd, WM_CAP_GET_MCI_DEVICE, wSize, szName)
    End Function
    Function capPaletteOpen(ByVal lwnd As LongPtr, ByVal szName As LongPtr) As Boolean
       capPaletteOpen = SendMessage(lwnd, WM_CAP_PAL_OPEN, 0, szName)
    End Function
    Function capPaletteSave(ByVal lwnd As LongPtr, ByVal szName As LongPtr) As Boolean
       capPaletteSave = SendMessage(lwnd, WM_CAP_PAL_SAVE, 0, szName)
    End Function
    Function capPalettePaste(ByVal lwnd As LongPtr) As Boolean
       capPalettePaste = SendMessage(lwnd, WM_CAP_PAL_PASTE, 0, 0)
    End Function
    Function capPaletteAuto(ByVal lwnd As LongPtr, ByVal iFrames As Integer, ByVal iColor As LongPtr) As Boolean
       capPaletteAuto = SendMessage(lwnd, WM_CAP_PAL_AUTOCREATE, iFrames, iColors)
    End Function
    Function capPaletteManual(ByVal lwnd As LongPtr, ByVal fGrab As Boolean, ByVal iColors As LongPtr) As Boolean
       capPaletteManual = SendMessage(lwnd, WM_CAP_PAL_MANUALCREATE, fGrab, iColors)
    End Function
    Function MyFrameCallback(ByVal lwnd As LongPtr, ByVal lpVHdr As LongPtr) As LongPtr
        Debug.Print "FrameCallBack"
        Dim VideoHeader As VIDEOHDR
        Dim VideoData() As Byte
        RtlMoveMemory VarPtr(VideoHeader), lpVHdr, Len(VideoHeader)
        ReDim VideoData(VideoHeader.dwBytesUsed)
        RtlMoveMemory VarPtr(VideoData(0)), VideoHeader.lpData, VideoHeader.dwBytesUsed
        Debug.Print VideoHeader.dwBytesUsed
        Debug.Print VideoData
    End Function
    Function MyYieldCallback(lwnd As LongPtr) As LongPtr
        Debug.Print "Yield"
    End Function
    Function MyErrorCallback(ByVal lwnd As LongPtr, ByVal iID As LongPtr, ByVal ipstrStatusText As LongPtr) As LongPtr
        If iID = 0 Then Exit Function
        Dim sStatusText As String
        Dim usStatusText As String
        lStrCpy StrPtr(sStatusText), ipstrStatusText
        LogError usStatusText, iID
    End Function
    Function MyStatusCallback(ByVal lwnd As LongPtr, ByVal iID As LongPtr, ByVal ipstrStatusText As LongPtr) As LongPtr
        If iID = 0 Then Exit Function
        Dim sStatusText As String
        Dim usStatusText As String
        lStrCpy StrPtr(sStatusText), ipstrStatusText
        Debug.Print "Status: ", usStatusText, iID
        Select Case iID '
        End Select
    End Function
    Sub ResizeCaptureWindow(ByVal lwnd As LongPtr)
        Dim CAPSTATUS As CAPSTATUS
        Dim lCaptionHeight As LongPtr
        Dim lX_Border As LongPtr
        Dim lY_Border As LongPtr
        lCaptionHeight = GetSystemMetrics(SM_CYCAPTION)
        lX_Border = GetSystemMetrics(SM_CXFRAME)
        lY_Border = GetSystemMetrics(SM_CYFRAME)
        If capGetStatus(lwnd, VarPtr(CAPSTATUS), Len(CAPSTATUS)) Then
            SetWindowPos lwnd, HWND_BOTTOM, 0, 0, _
                     CAPSTATUS.uiImageWidth + (lX_Border * 3), _
                     CAPSTATUS.uiImageHeight + lCaptionHeight + (lY_Border * 3), _
                     SWP_NOMOVE Or SWP_NOZORDER
        End If
        Debug.Print "Resize Window."
    End Sub
    Function MyVideoStreamCallback(lwnd As LongPtr, lpVHdr As LongPtr) As LongPtr
        Beep
    End Function
    Function MyWaveStreamCallback(lwnd As LongPtr, lpVHdr As LongPtr) As LongPtr
        Debug.Print "WaveStream"
    End Function
    Sub LogError(txtError As String, lID As LongPtr)
     MsgBox "Se ha producido un error: " & txtError & "-> " & lID, vbCritical, "AVISO"
    End Sub





    O crédito para este código de captura da webcam é do colega Carlos Malagon Gachuz e utilizo no meu cadastro de clientes com adaptações que fiz para meu projeto.
    Relembrando tudo funciona no 32bits,  no 64bits só quando chamo câmera no formulário trava o Banco e reinicia. Se alguém puder me dar uma força agradeço muito, só falta este trem pra finalizar meu projeto...rsr.

    daygdson
    Novato
    Novato

    Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 42
    Registrado : 20/04/2017

    Re: Converter Módulo VBA projetado em 32bits para 64Bits

    Mensagem  daygdson em Seg 04 Set 2017, 22:24

    Olá pessoal, até agora não consegui fazer funcionar a webcam em formulário access 64bits, no 32Bits funciona perfeitamente, alguém tem uma idéia.

      Data/hora atual: Qui 21 Set 2017, 02:30