| |

VerySource

 Forgot password?
 Register
Search
View: 1907|Reply: 14

[Q] How to play video on desktop by API without covering icon?

[Copy link]

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-27 22:40:01
| Show all posts |Read mode
Reply

Use magic Report

0

Threads

46

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 Great Britain

Post time: 2020-2-23 11:00:01
| Show all posts
Translucent display
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-2-29 19:00:02
| Show all posts
Fainted, if you do n’t cover the icon, you can click the icon directly :)
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-8-2 14:15:01
| Show all posts
The other effect I want is:

The window is always at the forefront, is semi-transparent, and will not be minimized when you press the minimize all windows shortcut key.
But the mouse can go through it and click to other software behind the form (of course, this form is still at the top)
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 10:00:01
| Show all posts
Many players have a play mode, which is "desktop play", such as KMP,
He can directly play the video semi-transparently on the desktop, just below the icon and above the wallpaper.
Right-click on the video at this time, and what pops up is not the player's menu, but the desktop menu, (in fact, the player is not displayed at all at this time)
In fact, when playing, the drawing layer is drawn on the hdc of the desktop, not on the hdc of the player.
To achieve this function, the premise is not to use the existing controls to play the video, but to manually decode the video by yourself.
Then draw the video image that should be drawn on this form to the desktop,

The basic sequence of video playback is reading video files ==> decoding ==> drawing and expressing sound,
The windows media player control has encapsulated the entire process, so if you use the wmp control to play the video, the program itself does not decode, and the program itself does not know what picture is currently being played, and it cannot draw the picture on the desktop. .

To achieve what the host said, you should first try to decode the video file yourself, rather than relying on the player controls.
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 10:15:01
| Show all posts
Suddenly thought of another method, as the original poster said,
------------------
The window is always at the forefront and is semi-transparent. It will not be minimized when you press the minimize all windows shortcut key.
But the mouse can go through it and click to other software behind the form (of course, this form is still at the top)
------------------
There are many desktop beautification softwares that are like this. The mouse that is always in the front window can penetrate it to activate the content below it, but this ushered in another problem, that is, the video image is drawn directly by the hardware, and the translucent window is The effect can only make the window translucent, and the video playback area is still opaque or even if it is translucent, what appears is not the underlying content but black "or other solid colors". This test can be easily verified, for example, when you open it. The projection effect of the mouse, after moving the mouse over the video, you will find that the projection becomes ugly, because the translucent part of the projection has become completely black instead of the video image that should be revealed, so unless it is decoded and drawn by yourself Video, otherwise no matter what method can not achieve the translucent effect. In this way, it is back to the last reply.. Haha...

Don't blame me for being too long-winded...I also have nothing to do, I'm bored to write so much...
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

Post time: 2020-8-15 10:30:01
| Show all posts
Very simple, SetParent to the desktop.
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-15 10:45:01
| Show all posts
The one upstairs is too strong.............-_-b

Why didn't I expect it~~~
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-15 11:00:01
| Show all posts
Attribute VB_Name = "ModOnTop"
'************************************************* ************************
'**Module name: ModOnTop
'** Explanation: Place the form on the top layer of the Z axis, set the form transparency, whether the mouse can penetrate
'** Creator: Ma Daha
'** Date: December 17, 2003
'**Revised by:
'** Date: November 8, 2006
'**Description: http://www.m5home.com
'**Version: V1.4
'************************************************* ************************
Private Declare Function GetWindowLong Lib "user32" Alias ​​"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias ​​"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As

Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long,

ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const LWA_ALPHA =&H2
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED =&H80000
Private Const WS_EX_TRANSPARENT As Long =&H20&
Private Const SWP_NOSIZE&=&H1
Private Const SWP_NOMOVE&=&H2
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const HWND_BROADCAST =&HFFFF&
Private Const HWND_TOP = 0

Public Sub OnTop(ByVal tForm As Form, Optional ByVal Top As Boolean = True, Optional TouMing As Long = 255, Optional cMouse As Boolean = False)
'************************************************* ************************
'**Parameter name: Top
'**Description: Whether to put the form on the top of the Z axis
'**Parameter name: TouMing
'**Description: Window transparency (valid for WIN2000 and above)
'**Parameter name: cMouse
'**Description: whether the mouse can penetrate
'************************************************* ************************
    Dim Ret As Long
   
    Ret = GetWindowLong(tForm.hwnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
   
    If cMouse Then Ret = Ret Or WS_EX_TRANSPARENT
   
    SetWindowLong tForm.hwnd, GWL_EXSTYLE, Ret
   
    If TouMing <0 Then TouMing = 0
    If TouMing> 255 Then TouMing = 255
   
    SetLayeredWindowAttributes tForm.hwnd, 0, TouMing, LWA_ALPHA
   
    If Top = True Then
      SetWindowPos tForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
    Else
      SetWindowPos tForm.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
    End If
End Sub

**********************************************

This can only make the program translucent, the mouse penetrates, and does not respond to WIN+D

But it is impossible to realize that the playback video is also translucent. Once there is a translucent effect, the video cannot be displayed...
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-8-15 12:45:01
| Show all posts
Come on, comrades, take a look at how to achieve desktop playback:)
First of all, be sure that it must not affect the normal functions of the desktop.
(Absolutely no third-party control, can you use the second-party control (MS-WMP? hehe) is also best?)
There are many ways, how to play behind the icon? How to play translucent in front of the icon?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list