❔ media key press
I want to press media key (music) using c# (next track, previous track, pause resume)A
23 Replies
that is probably done with a windows api
Manual control of the System Media Transport Controls - UWP applica...
The SystemMediaTransportControls class enables your app to use the system media transport controls that are built into Windows and to update the metadata that the controls display about the media your app is currently playing.
I Already tried them but it doesnt work can u show me example??
no i dont develop windowd
you could use
SendInput
and send virtual media keysSendInput function (winuser.h) - Win32 apps
Synthesizes keystrokes, mouse motions, and button clicks.
Virtual-Key Codes (Winuser.h) - Win32 apps
The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.
Thanks for helping me 🙂
How can i use this code? I looked your link and i found one "keybd_event( VK_NUMLOCK, 0x45, " like this??
Ah ok 😦 thanks for helping me
no use SendInput, docs say to use it over keybd_input
Im sorry but, could you show me example? I cant find one in here
you pinvoke it
have you ever done interop?
ill write an example when i get to my pc
Ok thanks for helping me 😉
@어부지망생 i used CsWin32 to source gen the pinvoke definitions and stuff
I dont know pinvoke and interop 😦 what is it??
I'll search for it
red line in here
i have to install package?
i used CsWin32that's a package
GitHub
GitHub - microsoft/CsWin32: A source generator to add a user-define...
A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project. - GitHub - microsoft/CsWin32: A source generator to add a user-defined set of Win32 P/In...
i installed cswin32 but still red line so i created navtivemethods.txt but noting changed
you need to put the names of the methods you want to use in it
in this case
SendInput
this one doesn't work
i installed package and no error but why 😦
sry for bothering you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.