How to Search Windows Media Player Window?

0

I need to return the IntPtr of the windows windows media player, but only that when it goes through the IntPtr line it returns 0x00000000 ie IntPtr.Zero. This should not be happening because it is the Windows Media Player itself.

I've already left the Windows Media Player window open while debugging this code, but it still returns IntPtr.Zero. What do I need to do to change this?

At the time of giving the command below, returns 0x00000000

IntPtr hWnd = FindWindow("wmplayer", null);

Here is the code

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

public IntPtr ScreenHandle() {
    IntPtr hWnd = FindWindow("wmplayer", null); // here is the problem   
    return hWnd;         
}
c#
handle
windows-media-player
intptr
asked on Stack Overflow Mar 10, 2019 by Park

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0