Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So, i want to try this program. I wrote this if statement and the user is given the option of entering either 1 or 0. Before i run the program, i open a video or an audio. Now, when i run my program, it will ask me enter either 1 or 0. If i enter 1 then the audio/video pauses(basically hit the space bar) and if i enter 0 then the audio/video plays(hits the space bar again). How do i do this part?

I tried the following code:

C++
if(c==1)
{
    keybd_event(VK_SPACE, 0X45, KEYEVENTF_EXTENDEDKEY|0, 0);
}
else
{
    keybd_event(VK_SPACE, 0X45, KEYEVENTF_EXTENDEDKEY|0, 0);
}


I got this code online in a blog and tried it but it doesnt work.
Posted
Comments
[no name] 15-Aug-14 21:34pm    
http://stackoverflow.com/questions/25336002/how-can-i-play-a-video
Surajit Das 15-Aug-14 21:37pm    
@wes aday:- its me who posted the question there but i dint get any convincing answer. So, thought of trying here.
[no name] 15-Aug-14 23:12pm    
And you think that we can give you a "convincing" answer based on "doesnt work"? Do you also call your mechanic on the phone and say "car broke" and expect that he know exactly what your problem is? The answer is go back to the place where you got this code and ask whomever wrote it why it doesn't work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900