Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




8 posts

Wannabe Geek


Topic # 193457 11-Mar-2016 17:46
Send private message

Hello,

 

So I planed a program in C# which works as a prank the point of it is that whatever key the user types it will make a random sound and play it. That is all done however in Console Program, so now after some research I found out that I need to make it an empty windows forms program with Visual Studio then add some C# lines to make it hide from the taskbar. Could someone plz help me. I'm stuck, If you could plz explain where to put the lines of code and everything. Thank you in advance. Also if u have a different more efficient way than to make it hide from the taskbar go ahead and let me know that would be awesome.


Filter this topic showing only the reply marked as answer Create new topic
152 posts

Master Geek
+1 received by user: 49


  Reply # 1511515 11-Mar-2016 18:03
One person supports this post
Send private message

Just create a service :)


483 posts

Ultimate Geek
+1 received by user: 286

Trusted

  Reply # 1511520 11-Mar-2016 18:26
Send private message

You may have trouble getting access to the desktop to install the keyboard hook.

 

http://stackoverflow.com/questions/5815424/global-keyboard-hook-from-windows-service

 

You could try linking the application with /SUBSYSTEM:WINDOWS instead of /SUBSYSTEM:CONSOLE

 

This is also an excellent example of why Tim Sweeney is wrong and we need UWP.

 

 

 

 


 
 
 
 




8 posts

Wannabe Geek


  Reply # 1511947 12-Mar-2016 13:08
Send private message

slingynz:

 

Just create a service :)

 

 

 

 

Tried that already but didn't go as planed




8 posts

Wannabe Geek


  Reply # 1511948 12-Mar-2016 13:08
Send private message

roobarb:

 

You may have trouble getting access to the desktop to install the keyboard hook.

 

http://stackoverflow.com/questions/5815424/global-keyboard-hook-from-windows-service

 

You could try linking the application with /SUBSYSTEM:WINDOWS instead of /SUBSYSTEM:CONSOLE

 

This is also an excellent example of why Tim Sweeney is wrong and we need UWP.

 

 

 

 

 

 

 

 

Will get back to you after trying it :D might work




8 posts

Wannabe Geek


  Reply # 1514373 16-Mar-2016 12:46
Send private message

Progress,

 

SO I have made it windows forms application and managed to hide it. Now I need to hook the program to the system to tell the program that the user have pressed a keyboard key and play a sound.

 

Anyone got any ideas plz?

 

Kind Regards.

 

 




8 posts

Wannabe Geek


  Reply # 1514771 16-Mar-2016 22:34
Send private message

Ok it is done here is the solution for you guys!

 

For making it run in the background even though it wasn't focused I used what is known as "keyboard interrupt" more on this link: "http://www.codeproject.com/Articles/14485/Low-level-Windows-API-hooks-from-C-to-stop-unwante"

 

 

 

Then at:
public Form1()
{
InitializeComponent();
}

 

added two lines to make it hidden which are as followed:
public Form1()
{
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}

 

P.S because it will run in the background just make sure u comment out the section which adds the drawing. Will make sense when you try it.

 

If you have any questions let me know! This program was made to prank a teacher at my school, and I did get the OK from another teacher and it is finally done. I'm uploading the video on my YouTube channel OptonTech, if you are interested, http://www.goo.gl/bBucnd. stay tuned!


Filter this topic showing only the reply marked as answer Create new topic



Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Geekzone Live »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.