Click here to Skip to main content
15,914,481 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threaded library design Pin
Ed.Poore17-Jan-08 11:41
Ed.Poore17-Jan-08 11:41 
JokeRe: Threaded library design Pin
Luc Pattyn17-Jan-08 11:52
sitebuilderLuc Pattyn17-Jan-08 11:52 
GeneralRe: Threaded library design Pin
invictus317-Jan-08 20:54
invictus317-Jan-08 20:54 
GeneralRe: Threaded library design Pin
Luc Pattyn18-Jan-08 1:52
sitebuilderLuc Pattyn18-Jan-08 1:52 
GeneralRe: Threaded library design Pin
invictus320-Jan-08 7:01
invictus320-Jan-08 7:01 
GeneralRe: Threaded library design Pin
Luc Pattyn20-Jan-08 10:21
sitebuilderLuc Pattyn20-Jan-08 10:21 
GeneralRe: Threaded library design Pin
invictus320-Jan-08 10:38
invictus320-Jan-08 10:38 
GeneralRe: Threaded library design Pin
GuyThiebaut17-Jan-08 11:42
professionalGuyThiebaut17-Jan-08 11:42 
I have a solution that is not particularly elegant but I use it in a speech recognition application I am writing.

My scenario is that I have a keyhook class that listens for a button being pressed.

In the KeyHook class I declare the following at the top of the class.
private static TestApp.MainForm m_InstanceRef = null;
public static TestApp.MainForm InstanceRef
  {
  get
    {
    return m_InstanceRef;
    }
  set
    {
     m_InstanceRef = value;
    }
  }
Within the main form I call the KeyHook class using the following syntax:
KeyHook.InstanceRef = this;
KeyHook.Listen();

Within the KeyHook class I then run a method when the key that I want is pressed, called EnableCheck(), in the main form thus:
InstanceRef.EnableCheck();

Like you I am a learner with C#, and hopefully will always be one, and feel a more elegant solution would be to throw an event that could be picked up by the main form.
This way of doing things breaks the rules of OOP but it works.

Regards

Guy

You always pass failure on the way to success.


QuestionExcel Chart from Office 2002 Pin
springtime5417-Jan-08 10:39
springtime5417-Jan-08 10:39 
GeneralRe: Excel Chart from Office 2002 Pin
Paul Conrad17-Jan-08 13:30
professionalPaul Conrad17-Jan-08 13:30 
QuestionProblem with .Net-Remoting Pin
Opa Knack17-Jan-08 9:48
Opa Knack17-Jan-08 9:48 
GeneralDate Pin
simworld17-Jan-08 8:20
simworld17-Jan-08 8:20 
GeneralRe: Date Pin
Luc Pattyn17-Jan-08 8:53
sitebuilderLuc Pattyn17-Jan-08 8:53 
GeneralRe: Date Pin
PIEBALDconsult17-Jan-08 12:21
mvePIEBALDconsult17-Jan-08 12:21 
GeneralBitBlt Problem Pin
Richard Blythe17-Jan-08 7:56
Richard Blythe17-Jan-08 7:56 
GeneralRe: BitBlt Problem Pin
Guffa17-Jan-08 8:58
Guffa17-Jan-08 8:58 
GeneralRe: BitBlt Problem Pin
Skippums17-Jan-08 10:31
Skippums17-Jan-08 10:31 
GeneralConfiguration framework Pin
hansipet17-Jan-08 7:34
hansipet17-Jan-08 7:34 
GeneralRe: Configuration framework Pin
Gareth H17-Jan-08 10:24
Gareth H17-Jan-08 10:24 
GeneralRe: Configuration framework Pin
hansipet17-Jan-08 22:50
hansipet17-Jan-08 22:50 
GeneralCan't get 24 bit audio to play with directsound Pin
kshet2617-Jan-08 7:19
kshet2617-Jan-08 7:19 
GeneralRe: Can't get 24 bit audio to play with directsound Pin
martin_hughes17-Jan-08 9:15
martin_hughes17-Jan-08 9:15 
GeneralRe: Can't get 24 bit audio to play with directsound Pin
kshet2617-Jan-08 9:19
kshet2617-Jan-08 9:19 
GeneralRe: Can't get 24 bit audio to play with directsound Pin
martin_hughes17-Jan-08 9:27
martin_hughes17-Jan-08 9:27 
GeneralRe: Can't get 24 bit audio to play with directsound Pin
kshet2617-Jan-08 12:06
kshet2617-Jan-08 12:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.