Sign in to follow this  
Followers 0
trancexx

Problem with DllCall

12 posts in this topic

It's about "msvfw32.dll" and function "MCIWndCreate"

This is what I got:

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Dim $file = FileOpenDialog("Choose fle", @DesktopDir, "(*.wma;*.mid;*.wav;*.mp3;*.rmi;*.aif;*.au;*.snd)", 1) 
If @error Then Exit
$file = 0

    Dim $Button_1, $Button_2, $msg
    
    Dim $gui = GUICreate("Test", 270, 100) 
    
    $Button_1 = GUICtrlCreateButton("Play", 15, 30, 100)
    $Button_2 = GUICtrlCreateButton("Stop", 145, 30, 100)

    GUISetState()
    
    Dim $inst = DllCall("Kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    Dim $p = DllCall("msvfw32.dll", "hwnd", "MCIWndCreate", "hwnd", $gui, "hwnd", $inst[0], "int", $WS_CHILD, "str", $file)
      
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Play()
            Case $msg = $Button_2
                Stop()
        EndSelect
    WEnd

Func Play()
EndFunc 

Func Stop()
EndFunc

It's crashing and I don't know why. Actually, it's because I'm doing something wrong but don't know what (there are tears in my eyes... and pain too :P ).

"$file" is set to 0 to see that it's actually calling before crash (comment that line out)

msvfw32.dll is great. Can be used to play enormous types of files (videos included). This is something about it (exported functions are at the bottom):

CODE
+++++++++++++++++++ IMPORTED FUNCTIONS +++++++++++++++++++

Number of Imported Modules = 8 (decimal)

Import Module 001: ntdll.dll

Import Module 002: USER32.dll

Import Module 003: KERNEL32.dll

Import Module 004: GDI32.dll

Import Module 005: WINMM.dll

Import Module 006: ADVAPI32.dll

Import Module 007: SHELL32.dll

Import Module 008: COMCTL32.dll

+++++++++++++++++++ IMPORT MODULE DETAILS +++++++++++++++++

Import Module 001: ntdll.dll

Addr:7C90D960 hint(0104) Name: NtQueryVirtualMemory

Addr:7C92ABA5 hint(0352) Name: RtlUnwind

Addr:7C929F03 hint(0520) Name: wcstol

Addr:7C9701F9 hint(0521) Name: wcstombs

Addr:7C9020F5 hint(04F3) Name: memmove

Import Module 002: USER32.dll

Addr:7E4297FF hint(01A6) Name: IsIconic

Addr:7E428FFD hint(00C8) Name: EndPaint

Addr:7E42D312 hint(0096) Name: DestroyIcon

Addr:7E430A47 hint(008C) Name: DefMDIChildProcW

Addr:7E429B60 hint(0040) Name: ClientToScreen

Addr:7E46531E hint(02A4) Name: TrackPopupMenu

Addr:7E41929B hint(01FE) Name: PeekMessageW

Addr:7E429719 hint(020B) Name: PtInRect

Addr:7E429C8A hint(01B0) Name: IsZoomed

Addr:7E42974E hint(010B) Name: GetCursorPos

Addr:7E418EAB hint(015B) Name: GetSysColorBrush

Addr:7E42D1D2 hint(010E) Name: GetDesktopWindow

Addr:7E429ED9 hint(0121) Name: GetKeyState

Addr:7E42B19C hint(0099) Name: DestroyWindow

Addr:7E429655 hint(016A) Name: GetWindow

Addr:7E429D12 hint(00FD) Name: GetClassNameW

Addr:7E42E8BC hint(01BC) Name: LoadIconW

Addr:7E42D39D hint(0097) Name: DestroyMenu

Addr:7E4232BA hint(0009) Name: AppendMenuW

Addr:7E41F601 hint(005E) Name: CreatePopupMenu

Addr:7E431ABD hint(0039) Name: CheckMenuItem

Addr:7E42D0A3 hint(0061) Name: CreateWindowExW

Addr:7E41AF34 hint(021B) Name: RegisterClipboardFormatW

Addr:7E430277 hint(01F3) Name: OpenClipboard

Addr:7E430D96 hint(00C1) Name: EmptyClipboard

Addr:7E430F9E hint(024A) Name: SetClipboardData

Addr:7E430265 hint(0042) Name: CloseClipboard

Addr:7E43D06C hint(00B6) Name: DrawIcon

Addr:7E424305 hint(0114) Name: GetDlgItemTextW

Addr:7E4298D5 hint(018A) Name: InflateRect

Addr:7E418E78 hint(015A) Name: GetSysColor

Addr:7E42A01E hint(001C) Name: CallWindowProcW

Addr:7E41A8AD hint(02D8) Name: wsprintfA

Addr:7E41A610 hint(02DA) Name: wvsprintfA

Addr:7E427822 hint(0243) Name: SetActiveWindow

Addr:7E42960E hint(0287) Name: SetWindowTextW

Addr:7E42910F hint(0145) Name: GetParent

Addr:7E429F72 hint(01AE) Name: IsWindowUnicode

Addr:7E428FA6 hint(026C) Name: SetRect

Addr:7E4298FE hint(01A8) Name: IsRectEmpty

Addr:7E418CCB hint(0200) Name: PostMessageW

Addr:7E41A9D1 hint(02DB) Name: wvsprintfW

Addr:7E428FE9 hint(000D) Name: BeginPaint

Addr:7E4294B3 hint(014B) Name: GetPropW

Addr:7E418C42 hint(01B2) Name: KillTimer

Addr:7E4273CC hint(0237) Name: SendDlgItemMessageW

Addr:7E418C2E hint(027A) Name: SetTimer

Addr:7E42C076 hint(022D) Name: RemovePropW

Addr:7E429C2F hint(00E2) Name: FillRect

Addr:7E429CBA hint(026D) Name: SetRectEmpty

Addr:7E42D7E2 hint(00BF) Name: DrawTextW

Addr:7E429011 hint(01F2) Name: OffsetRect

Addr:7E42B1B0 hint(002C) Name: CharNextW

Addr:7E42D607 hint(002F) Name: CharPrevW

Addr:7E42B24C hint(0029) Name: CharLowerW

Addr:7E419216 hint(0036) Name: CharUpperBuffW

Addr:7E42C0B9 hint(026B) Name: SetPropW

Addr:7E419F06 hint(029A) Name: SystemParametersInfoW

Addr:7E42FA3E hint(02D4) Name: WindowFromDC

Addr:7E42C2E8 hint(00EB) Name: GetActiveWindow

Addr:7E418F9C hint(015D) Name: GetSystemMetrics

Addr:7E4247AB hint(009F) Name: DialogBoxParamW

Addr:7E428FD5 hint(0193) Name: InvalidateRect

Addr:7E45BC09 hint(0252) Name: SetDlgItemInt

Addr:7E42F750 hint(026F) Name: SetScrollPos

Addr:7E429849 hint(00C4) Name: EnableWindow

Addr:7E424DFA hint(01A3) Name: IsDlgButtonChecked

Addr:7E424A4E hint(00C6) Name: EndDialog

Addr:7E42AF56 hint(0292) Name: ShowWindow

Addr:7E42F99B hint(0270) Name: SetScrollRange

Addr:7E42C2BB hint(0281) Name: SetWindowLongW

Addr:7E42F56B hint(0286) Name: SetWindowTextA

Addr:7E41AE3F hint(0035) Name: CharUpperBuffA

Addr:7E42B29E hint(01E9) Name: MoveWindow

Addr:7E424DCA hint(0038) Name: CheckDlgButton

Addr:7E428D20 hint(008F) Name: DefWindowProcW

Addr:7E42AEAB hint(02BB) Name: UpdateWindow

Addr:7E419D69 hint(01BA) Name: LoadCursorW

Addr:7E429930 hint(024D) Name: SetCursor

Addr:7E45BC8B hint(0112) Name: GetDlgItemInt

Addr:7E42908E hint(00FF) Name: GetClientRect

Addr:7E42F704 hint(0156) Name: GetScrollPos

Addr:7E42736C hint(0254) Name: SetDlgItemTextW

Addr:7E42436E hint(0111) Name: GetDlgItem

Addr:7E4290B4 hint(0174) Name: GetWindowRect

Addr:7E41A39A hint(0219) Name: RegisterClassW

Addr:7E42E81E hint(00F9) Name: GetClassInfoW

Addr:7E466534 hint(01E3) Name: MessageBoxW

Addr:7E419E36 hint(01C9) Name: LoadStringW

Addr:7E41A9B6 hint(02D9) Name: wsprintfW

Addr:7E428845 hint(0027) Name: CharLowerBuffA

Addr:7E42929A hint(0240) Name: SendMessageW

Addr:7E429823 hint(0117) Name: GetForegroundWindow

Addr:7E4297A0 hint(0231) Name: ScreenToClient

Addr:7E4314BA hint(012C) Name: GetMenu

Addr:7E4188A6 hint(016F) Name: GetWindowLongW

Addr:7E431140 hint(0001) Name: AdjustWindowRect

Addr:7E4299F3 hint(0283) Name: SetWindowPos

Addr:7E4186C7 hint(010C) Name: GetDC

Addr:7E41869D hint(022A) Name: ReleaseDC

Addr:7E428717 hint(0026) Name: CharLowerA

Import Module 003: KERNEL32.dll

Addr:7C80B8E2 hint(0162) Name: GetFullPathNameW

Addr:7C8213E0 hint(01AA) Name: GetProfileStringW

Addr:7C80AEDB hint(0247) Name: LoadLibraryW

Addr:7C80F9ED hint(0195) Name: GetPrivateProfileStringW

Addr:7C809F09 hint(022A) Name: IsBadWritePtr

Addr:7C801D7B hint(0244) Name: LoadLibraryA

Addr:7C80AC6E hint(00F0) Name: FreeLibrary

Addr:7C80E4CD hint(0179) Name: GetModuleHandleW

Addr:7C8099BF hint(024E) Name: LocalFree

Addr:7C809A1D hint(024A) Name: LocalAlloc

Addr:7C80B731 hint(0176) Name: GetModuleHandleA

Addr:7C809856 hint(0266) Name: MulDiv

Addr:7C812449 hint(01FB) Name: GlobalReAlloc

Addr:7C80BA7F hint(03B5) Name: lstrcpynW

Addr:7C80BD5F hint(0224) Name: IsBadCodePtr

Addr:7C80B465 hint(0175) Name: GetModuleFileNameW

Addr:7C901000 hint(0096) Name: EnterCriticalSection

Addr:7C80FDBD hint(01ED) Name: GlobalAlloc

Addr:7C80FFA9 hint(01F8) Name: GlobalLock

Addr:7C9010E0 hint(0243) Name: LeaveCriticalSection

Addr:7C80BE46 hint(03B7) Name: lstrlenA

Addr:7C831DD3 hint(01BA) Name: GetSystemDirectoryW

Addr:7C802336 hint(0066) Name: CreateProcessW

Addr:7C802530 hint(037E) Name: WaitForSingleObject

Addr:7C809BD7 hint(0031) Name: CloseHandle

Addr:7C80AA26 hint(03AF) Name: lstrcmpiW

Addr:7C81EE34 hint(0395) Name: WritePrivateProfileStringW

Addr:7C80AE30 hint(0198) Name: GetProcAddress

Addr:7C809F81 hint(0218) Name: InitializeCriticalSection

Addr:7C80AC51 hint(019C) Name: GetProcessHeap

Addr:7C9100A4 hint(0205) Name: HeapAlloc

Addr:7C811326 hint(0089) Name: DisableThreadLibraryCalls

Addr:7C835505 hint(0001) Name: AddAtomA

Addr:7C834D59 hint(03A8) Name: lstrcatA

Addr:7C80BE91 hint(03B1) Name: lstrcpyA

Addr:7C830CEE hint(00CA) Name: FindAtomA

Addr:7C8326D9 hint(0002) Name: AddAtomW

Addr:7C810FC2 hint(03A9) Name: lstrcatW

Addr:7C80BAF4 hint(03B2) Name: lstrcpyW

Addr:7C82F817 hint(00CB) Name: FindAtomW

Addr:7C809A99 hint(03B8) Name: lstrlenW

Addr:7C809C88 hint(0267) Name: MultiByteToWideChar

Addr:7C8099A5 hint(00F6) Name: GetACP

Addr:7C80A164 hint(0382) Name: WideCharToMultiByte

Addr:7C8326AD hint(007E) Name: DeleteAtom

Addr:7C80A4B7 hint(0294) Name: QueryPerformanceCounter

Addr:7C80932E hint(01D4) Name: GetTickCount

Addr:7C8097B8 hint(013E) Name: GetCurrentThreadId

Addr:7C8099B0 hint(013C) Name: GetCurrentProcessId

Addr:7C8017E9 hint(01C0) Name: GetSystemTimeAsFileTime

Addr:7C801E1A hint(034A) Name: TerminateProcess

Addr:7C80DE85 hint(013B) Name: GetCurrentProcess

Addr:7C863E6A hint(035B) Name: UnhandledExceptionFilter

Addr:7C8449FD hint(0336) Name: SetUnhandledExceptionFilter

Addr:7C80FCBF hint(01F4) Name: GlobalFree

Addr:7C80FF12 hint(01FF) Name: GlobalUnlock

Addr:7C834CD1 hint(01F7) Name: GlobalHandle

Addr:7C91135A hint(007F) Name: DeleteCriticalSection

Import Module 004: GDI32.dll

Addr:77F18BDF hint(0208) Name: SaveDC

Addr:77F18B19 hint(0201) Name: RestoreDC

Addr:77F15D77 hint(023D) Name: SetTextColor

Addr:77F283FB hint(0044) Name: CreateMetaFileW

Addr:77F18E05 hint(0244) Name: SetWindowOrgEx

Addr:77F23A05 hint(0243) Name: SetWindowExtEx

Addr:77F28167 hint(001E) Name: CloseMetaFile

Addr:77F23DAC hint(008E) Name: DeleteMetaFile

Addr:77F1AFF9 hint(003E) Name: CreateFontW

Addr:77F16B0D hint(01B9) Name: GetTextExtentPointW

Addr:77F190DD hint(00D7) Name: ExcludeClipRect

Addr:77F1ACB8 hint(0046) Name: CreatePatternBrush

Addr:77F1AD13 hint(0033) Name: CreateDIBitmap

Addr:77F1938F hint(003D) Name: CreateFontIndirectW

Addr:77F161A5 hint(0050) Name: CreateSolidBrush

Addr:77F19F95 hint(016B) Name: GetDIBits

Addr:77F1AB87 hint(0220) Name: SetDIBits

Addr:77F1AAC3 hint(0194) Name: GetNearestColor

Addr:77F1AAE4 hint(014B) Name: GetBitmapBits

Addr:77F1869B hint(01DE) Name: PatBlt

Addr:77F1B73C hint(019D) Name: GetPixel

Addr:77F15E29 hint(0216) Name: SetBkColor

Addr:77F18086 hint(00DE) Name: ExtTextOutW

Addr:77F2777C hint(00D4) Name: Escape

Addr:77F16AA1 hint(0161) Name: GetClipBox

Addr:77F1D7F2 hint(0214) Name: SetBitmapBits

Addr:77F1B6C0 hint(024A) Name: StretchBlt

Addr:77F19BFB hint(0221) Name: SetDIBitsToDevice

Addr:77F1B09E hint(024B) Name: StretchDIBits

Addr:77F15985 hint(011B) Name: GdiFlush

Addr:77F18597 hint(0239) Name: SetStretchBltMode

Addr:77F1EA4B hint(01F4) Name: RealizePalette

Addr:77F161C1 hint(01A6) Name: GetStockObject

Addr:77F18632 hint(0210) Name: SelectPalette

Addr:77F15FE0 hint(002D) Name: CreateCompatibleDC

Addr:77F1700A hint(002C) Name: CreateCompatibleBitmap

Addr:77F19E09 hint(0032) Name: CreateDIBSection

Addr:77F1BA8E hint(01AA) Name: GetSystemPaletteEntries

Addr:77F1D827 hint(0253) Name: UnrealizeObject

Addr:77F44816 hint(0200) Name: ResizePalette

Addr:77F3CF18 hint(0231) Name: SetPaletteEntries

Addr:77F3CECE hint(0009) Name: AnimatePalette

Addr:77F2C703 hint(021F) Name: SetDIBColorTable

Addr:77F44806 hint(0195) Name: GetNearestPaletteIndex

Addr:77F183B3 hint(0198) Name: GetObjectW

Addr:77F1B60A hint(019B) Name: GetPaletteEntries

Addr:77F1B5DA hint(0045) Name: CreatePalette

Addr:77F16BFA hint(008F) Name: DeleteObject

Addr:77F15B70 hint(020F) Name: SelectObject

Addr:77F16E5F hint(008C) Name: DeleteDC

Addr:77F1D4B7 hint(01CC) Name: LPtoDP

Addr:77F1D9DF hint(0168) Name: GetDCOrgEx

Addr:77F16A56 hint(01C8) Name: IntersectClipRect

Addr:77F15A69 hint(016C) Name: GetDeviceCaps

Import Module 005: WINMM.dll

Addr:76B536C8 hint(003A) Name: mciGetErrorStringA

Addr:76B54911 hint(0040) Name: mciSendStringA

Addr:76B54265 hint(0041) Name: mciSendStringW

Addr:76B53B67 hint(003F) Name: mciSendCommandW

Addr:76B42DDE hint(0004) Name: GetDriverModuleHandle

Addr:76B43890 hint(0000) Name: CloseDriver

Addr:76B42E37 hint(0008) Name: OpenDriver

Addr:76B5375B hint(003B) Name: mciGetErrorStringW

Import Module 006: ADVAPI32.dll

Addr:77DD6A9F hint(01E5) Name: RegOpenKeyExW

Addr:77DDEFB8 hint(01E3) Name: RegOpenKeyA

Addr:77DFBA25 hint(01D0) Name: RegCreateKeyW

Addr:77DD7EDD hint(01DC) Name: RegEnumValueW

Addr:77DD775C hint(01CF) Name: RegCreateKeyExW

Addr:77DD7CB9 hint(001D) Name: AllocateAndInitializeSid

Addr:77DD7FBA hint(0038) Name: CheckTokenMembership

Addr:77DD7CA8 hint(00E1) Name: FreeSid

Addr:77DFBCC3 hint(01CD) Name: RegCreateKeyA

Addr:77DDD757 hint(01FC) Name: RegSetValueExW

Addr:77DDEDE1 hint(01D4) Name: RegDeleteValueW

Addr:77DD6FEF hint(01EF) Name: RegQueryValueExW

Addr:77DD7AAB hint(01EE) Name: RegQueryValueExA

Addr:77DD6C17 hint(01CA) Name: RegCloseKey

Addr:77DD7936 hint(01E6) Name: RegOpenKeyW

Import Module 007: SHELL32.dll

Addr:7CA77C18 hint(001F) Name: DragFinish

Addr:7CA2B1A9 hint(001E) Name: DragAcceptFiles

Addr:7CA118CE hint(0023) Name: DragQueryFileW

Import Module 008: COMCTL32.dll

Addr:7744B609 hint(0011) Name: COMCTL32:NoName0000

Addr:77444AFE hint(000A) Name: CreateToolbarEx

+++++++++++++++++++ EXPORTED FUNCTIONS +++++++++++++++++++

Number of Exported Functions = 47 (decimal)

Addr:75A74641 Ord: 2 (0002h) Name: VideoForWindowsVersion

Addr:75A72503 Ord: 3 (0003h) Name: DrawDibBegin

Addr:75A7949B Ord: 4 (0004h) Name: DrawDibChangePalette

Addr:75A79C61 Ord: 5 (0005h) Name: DrawDibClose

Addr:75A719AA Ord: 6 (0006h) Name: DrawDibDraw

Addr:75A79467 Ord: 7 (0007h) Name: DrawDibEnd

Addr:75A79759 Ord: 8 (0008h) Name: DrawDibGetBuffer

Addr:75A735EE Ord: 9 (0009h) Name: DrawDibGetPalette

Addr:75A7425A Ord: 10 (000Ah) Name: DrawDibOpen

Addr:75A74312 Ord: 11 (000Bh) Name: DrawDibProfileDisplay

Addr:75A7245A Ord: 12 (000Ch) Name: DrawDibRealize

Addr:75A7234C Ord: 13 (000Dh) Name: DrawDibSetPalette

Addr:75A7356F Ord: 14 (000Eh) Name: DrawDibStart

Addr:75A735AF Ord: 15 (000Fh) Name: DrawDibStop

Addr:75A79491 Ord: 16 (0010h) Name: DrawDibTime

Addr:75A7CCD4 Ord: 17 (0011h) Name: GetOpenFileNamePreview

Addr:75A7CCD4 Ord: 18 (0012h) Name: GetOpenFileNamePreviewA

Addr:75A7CCA0 Ord: 19 (0013h) Name: GetOpenFileNamePreviewW

Addr:75A7CCEE Ord: 20 (0014h) Name: GetSaveFileNamePreviewA

Addr:75A7CCBA Ord: 21 (0015h) Name: GetSaveFileNamePreviewW

Addr:75A73AF6 Ord: 22 (0016h) Name: ICClose

Addr:75A74D4D Ord: 23 (0017h) Name: ICCompress

Addr:75A77BF0 Ord: 24 (0018h) Name: ICCompressorChoose

Addr:75A75C1B Ord: 25 (0019h) Name: ICCompressorFree

Addr:75A74DB7 Ord: 26 (001Ah) Name: ICDecompress

Addr:75A7196A Ord: 27 (001Bh) Name: ICDraw

Addr:75A722D0 Ord: 28 (001Ch) Name: ICDrawBegin

Addr:75A75955 Ord: 29 (001Dh) Name: ICGetDisplayFormat

Addr:75A75624 Ord: 30 (001Eh) Name: ICGetInfo

Addr:75A760A1 Ord: 31 (001Fh) Name: ICImageCompress

Addr:75A76314 Ord: 32 (0020h) Name: ICImageDecompress

Addr:75A73632 Ord: 33 (0021h) Name: ICInfo

Addr:75A7572B Ord: 34 (0022h) Name: ICInstall

Addr:75A73BFB Ord: 35 (0023h) Name: ICLocate

Addr:75A78C02 Ord: 36 (0024h) Name: ICMThunk32

Addr:75A73938 Ord: 37 (0025h) Name: ICOpen

Addr:75A74036 Ord: 38 (0026h) Name: ICOpenFunction

Addr:75A75897 Ord: 39 (0027h) Name: ICRemove

Addr:75A7190D Ord: 40 (0028h) Name: ICSendMessage

Addr:75A75FBF Ord: 41 (0029h) Name: ICSeqCompressFrame

Addr:75A75F2A Ord: 42 (002Ah) Name: ICSeqCompressFrameEnd

Addr:75A75CD8 Ord: 43 (002Bh) Name: ICSeqCompressFrameStart

Addr:75A81F10 Ord: 44 (002Ch) Name: MCIWndCreate

Addr:75A81F10 Ord: 45 (002Dh) Name: MCIWndCreateA

Addr:75A81E5E Ord: 46 (002Eh) Name: MCIWndCreateW

Addr:75A81DD2 Ord: 47 (002Fh) Name: MCIWndRegisterClass

Addr:75A7AA5F Ord: 48 (0030h) Name: StretchDIB


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites



I don't think I have ever been so frustrated, I just can't see the error, I've tried everything, and the most irritating thing is that it works perfectly when I compile the exact same thing in C++.

The only interesting result I managed to achieve was if you create it as a parent window instead, the window shows up, but the script crashes anyway.

:P


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

:P:(:idea:

a little progress:

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#cs
Dim $file = FileOpenDialog("Choose fle", @DesktopDir, "(*.wma;*.mid;*.wav;*.mp3;*.rmi;*.aif;*.au;*.snd)", 1) 
If @error Then Exit
#ce
 $file = 0

    Dim $Button_1, $Button_2, $msg
    
    Dim $gui = GUICreate("Test", 270, 100) 
    
    $Button_1 = GUICtrlCreateButton("Play", 15, 30, 100)
    $Button_2 = GUICtrlCreateButton("Stop", 145, 30, 100)
;BitOR($WS_CHILD, $WS_POPUP)
    GUISetState()
    
    Dim $inst = DllCall("Kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)

    ;Dim $p = DllCall("msvfw32.dll", "hwnd:cdecl", "MCIWndCreate", "hwnd*", $gui, "hwnd", $inst[0], "int", $WS_CHILD, "str", $file )
    Dim $p = DllCall("msvfw32.dll", "hwnd:cdecl", 0x002C, "hwnd", $gui, "hwnd", $inst[0], "dword", 0x40000000, "str", $file )
    ConsoleWrite("@error --> " & @error & @CRLF)
    ConsoleWrite("$p[0] --> " & $p[0] & @CRLF)
    ConsoleWrite("$p[1] --> " & $p[1] & @CRLF)
    ConsoleWrite("$p[2] --> " & $p[2] & @CRLF)
    ConsoleWrite("$p[3] --> " & $p[3] & @CRLF)
    ConsoleWrite("$p[4] --> " & $p[4] & @CRLF)
    ConsoleWrite("3...2....1... crashhhhh!!!!!" & @CRLF)
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Play()
            Case $msg = $Button_2
                Stop()
        EndSelect
    WEnd

Func Play()
    ; SendMessage() 
EndFunc 

Func Stop()
    ; SendMessage() 
EndFunc

I feel totally incompetent, thank you.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Guess I'm a bit lost on exactly what's failing here... are the play etc not working?

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
;#cs
Dim $file = FileOpenDialog("Choose fle", @DesktopDir, "(*.wma;*.mid;*.wav;*.mp3;*.rmi;*.aif;*.au;*.snd)", 1)
If @error Then Exit
;#ce
 ;$file = 0

    Dim $Button_1, $Button_2, $msg
   
    Dim $gui = GUICreate("Test", 270, 100)
   
    $Button_1 = GUICtrlCreateButton("Play", 15, 30, 100)
    $Button_2 = GUICtrlCreateButton("Stop", 145, 30, 100)
;BitOR($WS_CHILD, $WS_POPUP)
    GUISetState()
   
    Dim $inst = DllCall("Kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    Dim $t_file = DllStructCreate("char text[" & StringLen($file) + 1 & "]")
    Dim $p_file = DllStructGetPtr($t_file)
    DllStructSetData($t_file, "text", $file)
    
    Dim $p = DllCall("msvfw32.dll", "hwnd:cdecl", "MCIWndCreate", "hwnd*", $gui, "hwnd", $inst[0], "int", $WS_CHILD, "ptr", $p_file )
    ;Dim $p = DllCall("msvfw32.dll", "hwnd:cdecl", 0x002C, "hwnd", $gui, "hwnd", $inst[0], "dword", 0x40000000, "str", $file )
    ConsoleWrite("@error --> " & @error & @CRLF)
    ConsoleWrite("$p[0] --> " & $p[0] & @CRLF)
    ConsoleWrite("$p[1] --> " & $p[1] & @CRLF)
    ConsoleWrite("$p[2] --> " & $p[2] & @CRLF)
    ConsoleWrite("$p[3] --> " & $p[3] & @CRLF)
    ConsoleWrite("$p[4] --> " & $p[4] & @CRLF)
    ConsoleWrite("3...2....1... crashhhhh!!!!!" & @CRLF)
   
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Play()
            Case $msg = $Button_2
                Stop()
        EndSelect
    WEnd

Func Play()
    ; SendMessage()
EndFunc 

Func Stop()
    ; SendMessage()
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Guess I'm a bit lost on exactly what's failing here... are the play etc not working

Script crashes before Play() - not defined in that script.

DllCall() is done, no error, returns just fine and then it crashes for some reason.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Jesus...

I didn't even see that SmOke_N posted a script (that's what tears do)

Will test it.

edit:

MSDN Library says (about the last parameter): "Null-terminated string indicating the name of an MCI device or data file to open."

Something else needs to be changed.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Jesus...

I didn't even see that SmOke_N posted a script (that's what tears do)

Will test it.

edit:

MSDN Library says (about the last parameter): "Null-terminated string indicating the name of an MCI device or data file to open."

Something else needs to be changed.

It also says that's a ptr LPCTSTR ...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

It also says that's a ptr LPCTSTR ...

But you are making a pointer to a buffer that receives the converted string and they say string. Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

But you are making a pointer to a buffer that receives the converted string.

A buffer?... yes I took space in memory to set the pointer (that parameter is not ByRef)... I guess I could have easily enough done "str*", $file) ... but it's a habit to create the structs/ptrs as they are requested.

LPCTSTR is a long pointer (a constant char pointer)...

Anyway, enough of the BS stuff, is it still crashing with either option (the struct/ptr or the "str*"?)

Edit:

NM, I see it doesn't return the hwnd.

Edit2:

Even more interesting... I can't even register the clas:

CODE
Global Const $MCIWNDOPENF_NEW = 0x000001 ;open a new file

Global Const $MCIWNDF_NOAUTOSIZEWINDOW = 0x000001 ;when movie size changes

Global Const $MCIWNDF_NOPLAYBAR = 0x000002 ;no toolbar Const

Global Const $MCIWNDF_NOAUTOSIZEMOVIE = 0x000004 ;when window size changes

Global Const $MCIWNDF_NOMENU = 0x000008 ;no popup menu from RBUTTONDOWN

Global Const $MCIWNDF_SHOWNAME = 0x000010 ;show name in caption

Global Const $MCIWNDF_SHOWPOS = 0x000020 ;show position in caption

Global Const $MCIWNDF_SHOWMODE = 0x000040 ;show mode in caption

Global Const $MCIWNDF_SHOWALL = 0x000070 ;show all

Global Const $MCIWNDF_NOTIFYMODE = 0x000100 ;tell parent of mode change

Global Const $MCIWNDF_NOTIFYPOS = 0x000200 ;tell parent of pos change

Global Const $MCIWNDF_NOTIFYSIZE = 0x000400 ;tell parent of size change

Global Const $MCIWNDF_NOTIFYERROR = 0x001000 ;tell parent of an error

Global Const $MCIWNDF_NOTIFYALL = 0x001F00 ;tell all

Global Const $MCIWNDF_NOTIFYANSI = 0x000080

Global Const $MCIWNDF_NOTIFYMEDIA = 0x000880 ;tell parent of media change

Global Const $MCIWNDF_NOTIFYMEDIAW = 0x000800 ;tell parent of media change

Global Const $MCIWNDF_RECORD = 0x002000 ;Give a record button

Global Const $MCIWNDF_NOERRORDLG = 0x004000 ;Show Error Dlgs for MCI cmds?

Global Const $MCIWNDF_NOOPEN = 0x008000 ;Don;t allow user to open things

Global $h_instance = _MCIWndRegisterClass()

Global $h_gui = GUICreate("Test", 270, 100)

Global $h_button_play = GUICtrlCreateButton("Play", 15, 30, 100)

Global $h_button_stop = GUICtrlCreateButton("Stop", 145, 30, 100)

If Not $h_instance Then

MsgBox(16, "Error", "Registering class failed.")

Exit

EndIf

Global $h_mci = _MCICreate($h_gui, $h_instance, BitOR(0x00800000, 0x40000000, 0x10000000, $MCIWNDF_NOPLAYBAR))

GUISetState()

While GUIGetMsg() <> -3

WEnd

Func _MCIWndRegisterClass()

Local $h_instance = DllCall("Kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)

Local $a_ret = DllCall("msvfw32.dll", "int:cdecl", "MCIWndRegisterClass", "hwnd", $h_instance[0])

If $a_ret[0] = 0 Then Return $h_instance[0]

Return SetError(1, 0, 0)

EndFunc

Func _MCICreate($h_wnd, $h_instance, $i_style, $s_file = "")

Local $h_mci = DllCall("msvfw32.dll", "hwnd:cdecl", "MCIWndCreate", "hwnd", $h_wnd, "hwnd", $h_instance, "dword", $i_style, "str*", $s_file)

If @error Then Return SetError(1, 0, 0)

Return $h_mci[0]

EndFunc

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

DllOpen("msvfw32.dll")

edit:

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Dim $file = FileOpenDialog("Choose fle", @DesktopDir, "(*.wma;*.mid;*.wav;*.mp3;*.rmi;*.aif;*.au;*.snd)", 1) 
If @error Then Exit


    Dim $Button_1, $Button_2, $msg
    
    Dim $gui = GUICreate("Test", 270, 100) 
    
    $Button_1 = GUICtrlCreateButton("Play", 15, 30, 100)
    $Button_2 = GUICtrlCreateButton("Stop", 145, 30, 100)

    GUISetState()
    
    Dim $inst = DllCall("Kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
DllOpen("msvfw32.dll")
    Dim $p = DllCall("msvfw32.dll", "hwnd:cdecl", "MCIWndCreate", "hwnd", $gui, "hwnd", $inst[0], "int", $WS_CHILD, "str", $file )
    ConsoleWrite("@error --> " & @error & @CRLF)
    ConsoleWrite("$p[0] --> " & $p[0] & @CRLF)
    ConsoleWrite("$p[1] --> " & $p[1] & @CRLF)
    ConsoleWrite("$p[2] --> " & $p[2] & @CRLF)
    ConsoleWrite("$p[3] --> " & $p[3] & @CRLF)
    ConsoleWrite("$p[4] --> " & $p[4] & @CRLF)
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Play()
            Case $msg = $Button_2
                Stop()
        EndSelect
    WEnd

Func Play()
    _SendMessage($p[0], 2054);0x0806
EndFunc 

Func Stop()
    _SendMessage($p[0], 2056) ;0x0808
EndFunc

I feel kind of stupid now and everything...

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I swear dllopen was the first thing I tried!!! lol...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0