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


#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
154 posts

Master Geek


  #1511515 11-Mar-2016 18:03
Send private message

Just create a service :)


485 posts

Ultimate Geek

Trusted

  #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


  #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


  #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


  #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


  #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 and LinkedIn »



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:





News »

Soul Machines joins forces with the World Health Organization
Posted 13-Jul-2020 18:00


Chorus completes the build and commissioning of two new core Ethernet switches
Posted 8-Jul-2020 09:48


National Institute for Health Innovation develops treatment app for gambling
Posted 6-Jul-2020 16:25


Nokia 2.3 to be available in New Zealand
Posted 6-Jul-2020 12:30


Menulog change colours as parent company merges with Dutch food delivery service
Posted 2-Jul-2020 07:53


Techweek2020 goes digital to make it easier for Kiwis to connect and learn
Posted 2-Jul-2020 07:48


Catalyst Cloud launches new Solutions Hub to support their kiwi Partners and Customers
Posted 2-Jul-2020 07:44


Microsoft to help New Zealand job seekers acquire new digital skills needed for the COVID-19 economy
Posted 2-Jul-2020 07:41


Hewlett Packard Enterprise introduces new HPE GreenLake cloud services
Posted 24-Jun-2020 08:07


New cloud data protection services from Hewlett Packard Enterprise
Posted 24-Jun-2020 07:58


Hewlett Packard Enterprise unveils HPE Ezmeral, new software portfolio and brand
Posted 24-Jun-2020 07:10


Apple reveals new developer technologies to foster the next generation of apps
Posted 23-Jun-2020 15:30


Poly introduces solutions for Microsoft Teams Rooms
Posted 23-Jun-2020 15:14


Lenovo launches new ThinkPad P Series mobile workstations
Posted 23-Jun-2020 09:17


Lenovo brings Linux certification to ThinkPad and ThinkStation Workstation portfolio
Posted 23-Jun-2020 08:56



Geekzone Live »

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


Support Geekzone »

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.