Страница: 1 |
|
Вопрос: MMPlayer LITE
|
Добавлено: 05.06.05 02:54
|
|
Автор вопроса: ZagZag | ICQ: 295002202
|
Торкнуло както меня оптимизировать и ужать сэмпловый медиаплеер с wasm.ru
Ужал. Если както еще можно ужать, то подскажите.
А так плеер сам по себе рульный, хоть половину авишек не играет, но размер =
3 584 байт!
Я оставил меню только открытия файла и полноэкранного просмотра.
.386
.model Flat, StdCall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include comdlg32.inc
includelib kernel32.lib
includelib user32.lib
includelib comdlg32.lib
WndProc PROTO :dword, :dword, :dword, :dword
.const
MENU_FILE equ 1000h
MENU_FULLSCREEN equ 1001h
MCIWNDM_OPEN equ 1177
MCIWNDM_SENDSTRING equ 1125
.const
Library_Name db "msvfw32.dll",0
f_MCIWndCreate db "MCIWndCreate",0
szSplitter db "-",0
szFile db "Открыть...",0
szFullScreen db "Полный экран",0
LoadFileFilte db "Все файлы (*.*)",0,"*.*",0,0
LoadFileTitle db "Выберите файл",0
szPlay db "PLAY",0
szStop db "STOP",0
szClose db "CLOSE",0
szPlayfullscreen db "PLAY FULLSCREEN NOTIFY",0
.data
ofn OPENFILENAME <sizeof OPENFILENAME,,,offset
LoadFileFilte,0,0,0,offset LoadFileBuffer, 260, 0, 0, 0, offset
LoadFileTitle, OFN_LONGNAMES or OFN_EXPLORER or OFN_FILEMUSTEXIST or
OFN_PATHMUSTEXIST or OFN_HIDEREADONLY, 0, 0, 0, 0, 0, 0>
.data?
hInstance HINSTANCE ?
hLibrary dd ?
p_MCIWndCreate dd ?
mcihWnd dd ?
handleMenu dd ?
handleFile dd ?
pFName dd ?
prevWindow dd ?
LoadFileBuffer db 260 dup(?)
msg MSG <>
.code
Start:
xor ebx, ebx
invoke GetModuleHandle, ebx
mov hInstance,eax
invoke LoadLibrary, ADDR Library_Name
mov hLibrary, eax
invoke GetProcAddress, eax, ADDR f_MCIWndCreate
jz Exit
mov p_MCIWndCreate, eax
push pFName
push 14CFE7F0h
push hInstance
push ebx
call p_MCIWndCreate
mov mcihWnd, eax
pop eax
pop eax
pop eax
pop eax
invoke GetSystemMenu, mcihWnd, ebx
mov handleMenu, eax
invoke AppendMenu, handleMenu, MF_SEPARATOR, ebx, ADDR szSplitter
invoke AppendMenu, handleMenu, ebx, MENU_FILE, ADDR szFile ; ebx =
MF_STRING
invoke AppendMenu, handleMenu, ebx, MENU_FULLSCREEN, ADDR szFullScreen
invoke SetWindowLong, mcihWnd, GWL_EXSTYLE, WS_EX_WINDOWEDGE
invoke SetWindowLong, mcihWnd, GWL_WNDPROC, ADDR WndProc
mov prevWindow, eax
.While TRUE
invoke GetMessage, ADDR msg, ebx, ebx, ebx
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
invoke FreeLibrary, hLibrary
mov eax, msg.wParam
Exit:
invoke ExitProcess, eax
WndProc proc uses esi, hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
xor ebx,ebx
mov eax, uMsg
.IF eax==WM_DESTROY
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szStop
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szClose
invoke PostQuitMessage, ebx
.ELSEIF eax==WM_CLOSE
invoke SendMessage, hWnd, WM_DESTROY, ebx, ebx
.ELSEIF eax==WM_SYSCOMMAND
mov eax, wParam
.IF ax==MENU_FILE
push hWnd
pop ofn.hWndOwner
push hInstance
pop ofn.hInstance
invoke GetOpenFileName, ADDR ofn
mov handleFile, eax
movzx esi, ofn.nFileExtension
add esi, ofn.lpstrFile
lodsd
or eax, 020202020h
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szStop
invoke SendMessage, hWnd, MCIWNDM_OPEN, ebx, ADDR LoadFileBuffer
.if eax == ebx
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlay
.endif
.ELSEIF ax==MENU_FULLSCREEN
invoke SendMessage,hWnd, WM_SHOWWINDOW, SW_SHOWMAXIMIZED, ebx
invoke SendMessage,hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlayfullscreen
.endif
.ELSEIF eax==MM_MCINOTIFY
invoke ShowWindow, hWnd, SW_SHOWNORMAL
invoke SendMessage, hWnd, MCIWNDM_CHANGESTYLES, MCIWNDF_NOMENU, ebx
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlay
.endif
invoke CallWindowProc, prevWindow, hWnd, uMsg, wParam, lParam
ret
WndProc endp
end Start
Копирайт остается wasm.ru - я делал только для себя... ну ежели не пару
компашек с фильмами записать :)
Ответить
|
Номер ответа: 5 Автор ответа: ZagZag
ICQ: 295002202
Вопросов: 87 Ответов: 1684
|
Профиль | | #5
|
Добавлено: 22.06.05 05:13
|
В плеером-фильмом идея неплоха, но EXE размером мегов в 700 - Любой
антивирус загнется
Сжатый код?
.386
.model Flat, StdCall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include comdlg32.inc
includelib kernel32.lib
includelib user32.lib
includelib comdlg32.lib
WndProc PROTO :dword, :dword, :dword, :dword
.const
MENU_FILE equ 1000h
MENU_FULLSCREEN equ 1001h
MCIWNDM_OPEN equ 1177
MCIWNDM_SENDSTRING equ 1125
.const
Library_Name db "msvfw32.dll",0
f_MCIWndCreate db "MCIWndCreate",0
szSplitter db "-",0
szFile db "?в?алвм...",0
szFullScreen db "?R<-л© н?а -",0
LoadFileFilte db "'б? д ©<л (*.*)",0,"*.*",0,0
LoadFileTitle db "'л??аЁв? д ©<",0
szPlay db "PLAY",0
szStop db "STOP",0
szClose db "CLOSE",0
szPlayfullscreen db "PLAY FULLSCREEN NOTIFY",0
.data
ofn OPENFILENAME <sizeof OPENFILENAME,,,offset
LoadFileFilte,0,0,0,offset LoadFileBuffer, 260, 0, 0, 0, offset
LoadFileTitle, OFN_LONGNAMES or OFN_EXPLORER or OFN_FILEMUSTEXIST or
OFN_PATHMUSTEXIST or OFN_HIDEREADONLY, 0, 0, 0, 0, 0, 0>
.data?
hInstance HINSTANCE ?
hLibrary dd ?
p_MCIWndCreate dd ?
mcihWnd dd ?
handleMenu dd ?
handleFile dd ?
pFName dd ?
prevWindow dd ?
LoadFileBuffer db 260 dup(?)
msg MSG <>
.code
Start:
xor ebx, ebx
invoke GetModuleHandle, ebx
mov hInstance,eax
invoke LoadLibrary, ADDR Library_Name
mov hLibrary, eax
invoke GetProcAddress, eax, ADDR f_MCIWndCreate
jz Exit
mov p_MCIWndCreate, eax
push pFName
push 14CFE7F0h
push hInstance
push ebx
call p_MCIWndCreate
mov mcihWnd, eax
pop eax
pop eax
pop eax
pop eax
invoke GetSystemMenu, mcihWnd, ebx
mov handleMenu, eax
invoke AppendMenu, handleMenu, MF_SEPARATOR, ebx, ADDR szSplitter
invoke AppendMenu, handleMenu, ebx, MENU_FILE, ADDR szFile ; ebx =
MF_STRING
invoke AppendMenu, handleMenu, ebx, MENU_FULLSCREEN, ADDR szFullScreen
invoke SetWindowLong, mcihWnd, GWL_EXSTYLE, WS_EX_WINDOWEDGE
invoke SetWindowLong, mcihWnd, GWL_WNDPROC, ADDR WndProc
mov prevWindow, eax
.While TRUE
invoke GetMessage, ADDR msg, ebx, ebx, ebx
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
invoke FreeLibrary, hLibrary
mov eax, msg.wParam
Exit:
invoke ExitProcess, eax
WndProc proc uses esi, hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
xor ebx,ebx
mov eax, uMsg
.IF eax==WM_DESTROY
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szStop
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szClose
invoke PostQuitMessage, ebx
.ELSEIF eax==WM_CLOSE
invoke SendMessage, hWnd, WM_DESTROY, ebx, ebx
.ELSEIF eax==WM_SYSCOMMAND
mov eax, wParam
.IF ax==MENU_FILE
push hWnd
pop ofn.hWndOwner
push hInstance
pop ofn.hInstance
invoke GetOpenFileName, ADDR ofn
mov handleFile, eax
movzx esi, ofn.nFileExtension
add esi, ofn.lpstrFile
lodsd
or eax, 020202020h
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szStop
invoke SendMessage, hWnd, MCIWNDM_OPEN, ebx, ADDR LoadFileBuffer
.if eax == ebx
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlay
.endif
.ELSEIF ax==MENU_FULLSCREEN
invoke SendMessage,hWnd, WM_SHOWWINDOW, SW_SHOWMAXIMIZED, ebx
invoke SendMessage,hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlayfullscreen
.endif
.ELSEIF eax==MM_MCINOTIFY
invoke ShowWindow, hWnd, SW_SHOWNORMAL
invoke SendMessage, hWnd, MCIWNDM_CHANGESTYLES, MCIWNDF_NOMENU, ebx
invoke SendMessage, hWnd, MCIWNDM_SENDSTRING, ebx, ADDR szPlay
.endif
invoke CallWindowProc, prevWindow, hWnd, uMsg, wParam, lParam
ret
WndProc endp
end Start
Ги-ги! Я его скоро еще на полкилобайта сократю!
Ответить
|
Страница: 1 |
Поиск по форуму