想请微软专家回答,MediaPlayer的问题!

roc_fu 2002-10-03 11:50:08
我用截取MediaPlayer显示区的方法截取图像,可以另存为文件,但是图像质量太差如果将WindowlessVideo属性设成法FALSE后播放器中质量可以,但又无法截图了,截到的图像都是黑乎乎的,请问各位高手有没有好的办法?或者MediaPlayer有自己的方法截图?,另外,怎么才能知道打开的视频文件的格式,比如是NTSC还是PAL的?
这个问题好像为人能解决,我看这里解答问题的微软专家比较多,所以就来了
...全文
34 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sean918 2002-10-31
  • 打赏
  • 举报
回复
给你一个函数,看懂了就行

#If Win32 Then

Public Function CaptureWindow(ByVal hWndSrc As Long, _
ByVal Client As Boolean, ByVal LeftSrc As Long, _
ByVal TopSrc As Long, ByVal WidthSrc As Long, _
ByVal HeightSrc As Long) As Picture

Dim hDCMemory As Long

Dim hBmp As Long

Dim hBmpPrev As Long

Dim r As Long

Dim hDCSrc As Long

Dim hPal As Long

Dim hPalPrev As Long

Dim RasterCapsScrn As Long

Dim HasPaletteScrn As Long

Dim PaletteSizeScrn As Long

#ElseIf Win16 Then

Public Function CaptureWindow(ByVal hWndSrc As Integer, _
ByVal Client As Boolean, ByVal LeftSrc As Integer, _
ByVal TopSrc As Integer, ByVal WidthSrc As Long, _
ByVal HeightSrc As Long) As Picture

Dim hDCMemory As Integer

Dim hBmp As Integer

Dim hBmpPrev As Integer

Dim r As Integer

Dim hDCSrc As Integer

Dim hPal As Integer

Dim hPalPrev As Integer

Dim RasterCapsScrn As Integer

Dim HasPaletteScrn As Integer

Dim PaletteSizeScrn As Integer

#End If

Dim LogPal As LOGPALETTE

' Depending on the value of Client get the proper device context

If Client Then

hDCSrc = GetDC(hWndSrc) ' Get device context for Client area

Else

hDCSrc = GetWindowDC(hWndSrc) ' Get device context for entire window

End If

' Create a memory device context for the copy process

hDCMemory = CreateCompatibleDC(hDCSrc)

' Create a bitmap and place it in the memory DC

hBmp = CreateCompatibleBitmap(hDCSrc, WidthSrc, HeightSrc)

hBmpPrev = SelectObject(hDCMemory, hBmp)

' Get screen properties

RasterCapsScrn = GetDeviceCaps(hDCSrc, RASTERCAPS) 'Raster capabilities

HasPaletteScrn = RasterCapsScrn And RC_PALETTE 'Palette support

PaletteSizeScrn = GetDeviceCaps(hDCSrc, SIZEPALETTE) 'Size of palette

' If the screen has a palette make a copy and realize it

If HasPaletteScrn And (PaletteSizeScrn = 256) Then

' Create a copy of the system palette

LogPal.palVersion = &H300

LogPal.palNumEntries = 256

r = GetSystemPaletteEntries(hDCSrc, 0, 256, LogPal.palPalEntry(0))

hPal = CreatePalette(LogPal)

' Select the new palette into the memory DC and realize it

hPalPrev = SelectPalette(hDCMemory, hPal, 0)

r = RealizePalette(hDCMemory)

End If

' Copy the on-screen image into the memory DC

r = BitBlt(hDCMemory, 0, 0, WidthSrc, HeightSrc, hDCSrc, _
LeftSrc, TopSrc, vbSrcCopy)

' Remove the new copy of the the on-screen image

hBmp = SelectObject(hDCMemory, hBmpPrev)

' If the screen has a palette get back the palette that was selected

' in previously

If HasPaletteScrn And (PaletteSizeScrn = 256) Then

hPal = SelectPalette(hDCMemory, hPalPrev, 0)

End If

' Release the device context resources back to the system

r = DeleteDC(hDCMemory)

r = ReleaseDC(hWndSrc, hDCSrc)

' Call CreateBitmapPicture to create a picture object from the bitmap

' and palette handles. Then return the resulting picture object.

Set CaptureWindow = CreateBitmapPicture(hBmp, hPal)

End Function
jxf_yx 2002-10-22
  • 打赏
  • 举报
回复
不能用
eithur 2002-10-03
  • 打赏
  • 举报
回复
你看看你的MediaPlayer(我指windows自带的播放器程序),有截图功能吗?
当然,没有,如果该控件有这种方法,那么MSDN应该说了。所以,你不用在控件上想办法了。
不过在C里面可以。呵呵
shortppsy 2002-10-03
  • 打赏
  • 举报
回复
用其他的工具吧~
roc_fu 2002-10-03
  • 打赏
  • 举报
回复
eithur(阿恺) 在C里有,你就说出来啊。
huangjw 2002-10-03
  • 打赏
  • 举报
回复
MediaPlayer好象不能截图,如果能的话请赐教.

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧