Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Go Back  Xtreme Visual Basic Talk > > > Save Image in AxWindowsMediaPlayer Control


Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2015, 07:49 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default Save Image in AxWindowsMediaPlayer Control


I'm trying to save an image from the
AxWindowsMediaPlayer control but
i'm saving the desktop image instead.

I know where i'm going wrong but i
don't know what else to try.

In my code, i'm using Graphics.CopyFromScreen
and i know it's grabbing the desktop instead
of the wmp control surface.

Is there a way to reference the wmp control
when grabbing an image?
Reply With Quote
  #2  
Old 07-29-2015, 11:48 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

I've made a little headway om this but it
still isn't what i'm looking for.

Code:
Private Function TakeImage(ByVal Width As Integer, ByVal Height As Integer) As Bitmap
        Dim Img As New Bitmap(Width, Height)
        Dim g As Graphics = Graphics.FromImage(Img)

        g.CopyFromScreen(Mp1.PointToScreen(Mp1.ClientRectangle.Location), Point.Empty, Mp1.ClientSize)

        g.Dispose()
        Return Img
    End Function
I'm still using CopyFromScreen but i'm also using the points
and location of the media player to get my image from.

Now i get an image of the whole media player control, complete
with button controls but i also get the image in the player.

Also, i have a save file dialog box coming up when i attempt to save
an image, so that i can save it where i want it. After i click the save,
my code saves the image of the save dialog box, instead of the media
player image, unless i first move the save dialog box off to the side
somewhere.

So it looks like my code is not the way to go to get an image
from the media player. Does anyone know of a better way to
capture and save and image from the media player control or
is it even possible?
Reply With Quote
  #3  
Old 07-29-2015, 01:12 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

I just found out that windows media player stopped
doing screen captures since version 11, so there
definitely isn't any functions in that player that will
capture and save screen shots.

On that note, i'm giving up. No sense beating a
dead horse.

I'll check into possibly using a different media player
that supports screen captures.
Reply With Quote
  #4  
Old 07-30-2015, 11:04 AM
alp0001's Avatar
alp0001Save Image in AxWindowsMediaPlayer Control alp0001 is offline
Ultimate Contributor

Retired Moderator
* Expert *
 
Join Date: Jan 2002
Location: Lakemoor, IL
Posts: 2,826
Default

Howdy VB_Alien,

Not familiar with .net capabilities nor what the intent is for, but I will suggest an approach on capturing screen shots on whatever window you want to use:
1) Make sure you have focus on the window/program you want to capture.
2) Simulate the Alt + Print Screen key presses. This should capture just the contents of the entire program/window you are interested in and not the entire desktop.
3) Now that the image is in memory, save it to disk to do further manipulation as needed.
__________________
Avatar by the very talented member: lebb
Reply With Quote
  #5  
Old 07-31-2015, 11:07 AM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Thanks for replying alp0001. This way captures the whole
window and i was hoping to just capture the image in the
player.

I was wanting to capture the image and then save it in jpeg
format to my hd.

I have a player that i created a while back that uses mciSendString
to play video files and i think i was able to save the image in the
player window (a picturebox) to the hd using bitblt. Maybe i'll try
using that to see what happens.

Anyway, thanks for replying. I appreciate it.
Reply With Quote
  #6  
Old 08-14-2015, 02:37 PM
boops boops's Avatar
boops boops boops boops is offline
Centurion
 
Join Date: Dec 2006
Location: Holland and France
Posts: 146
Default

Graphics.CopyFromScreen has always been unable to capture DirectX and other "non standard" screen renders. BitBlt is more capable. Maybe this code is worth trying:
Code:
	'based on code posted by NoBugz MVP at:
	'http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/474450b9-e260-4369-9efb-0d57a5b2e06d

	Public Shared Function CopyFromScreen(ByVal screenRect As Rectangle) As Bitmap
		Dim hDesk As IntPtr = GetDesktopWindow()
		Dim hSrce As IntPtr = GetWindowDC(hDesk)
		Dim hDest As IntPtr = CreateCompatibleDC(hSrce)
		Dim hBmp As IntPtr = CreateCompatibleBitmap(hSrce, screenRect.Width, screenRect.Height)
		Dim hOldBmp As IntPtr = SelectObject(hDest, hBmp)
		BitBlt(hDest, 0, 0, screenRect.Width, screenRect.Height, hSrce, screenRect.Left, screenRect.Top, _
		  CopyPixelOperation.SourceCopy Or CopyPixelOperation.CaptureBlt)
		Dim bmp As Bitmap = Bitmap.FromHbitmap(hBmp)
		SelectObject(hDest, hOldBmp)
		DeleteObject(hBmp)
		DeleteDC(hDest)
		ReleaseDC(hDesk, hSrce)
		Return bmp
	End Function
Can I assume that you know how to declare all those Win32 APIs (GetDesktopWindow, GetWindowDC etc.)? If not, I have a Win32 class somewhere: I'll see if I can dig it out for you tomorrow.

BB
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
 
Save Image in AxWindowsMediaPlayer Control
Save Image in AxWindowsMediaPlayer Control
 
-->