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
148 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:





News »

Logitech Rally sets new standard for USB-connected video conference cameras
Posted 18-Jun-2018 09:27


Russell Stanners steps down as Vodafone NZ CEO
Posted 12-Jun-2018 09:13


Intergen recognised as 2018 Microsoft Country Partner of the Year for New Zealand
Posted 12-Jun-2018 08:00


Finalists Announced For Microsoft NZ Partner Awards
Posted 6-Jun-2018 15:12


Vocus Group and Vodafone announce joint venture to accelerate fibre innovation
Posted 5-Jun-2018 10:52


Kogan.com to launch Kogan Mobile in New Zealand
Posted 4-Jun-2018 14:34


Enable doubles fibre broadband speeds for its most popular wholesale service in Christchurch
Posted 2-Jun-2018 20:07


All or Nothing: New Zealand All Blacks arrives on Amazon Prime Video
Posted 2-Jun-2018 16:21


Innovation Grant, High Tech Awards and new USA office for Kiwi tech company SwipedOn
Posted 1-Jun-2018 20:54


Commerce Commission warns Apple for misleading consumers about their rights
Posted 30-May-2018 13:15


IBM leads Call for Code to use cloud, data, AI, blockchain for natural disaster relief
Posted 25-May-2018 14:12


New FUJIFILM X-T100 aims to do better job than smartphones
Posted 24-May-2018 20:17


Stuff takes 100% ownership of Stuff Fibre
Posted 24-May-2018 19:41


Exhibition to showcase digital artwork from across the globe
Posted 23-May-2018 16:44


Auckland tops list of most vulnerable cities in a zombie apocalypse
Posted 23-May-2018 12:52



Geekzone Live »

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



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.