Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
GeneralRe: nullrefererence exception Pin
Luc Pattyn9-Nov-09 16:05
sitebuilderLuc Pattyn9-Nov-09 16:05 
GeneralRe: nullrefererence exception Pin
N a v a n e e t h9-Nov-09 15:59
N a v a n e e t h9-Nov-09 15:59 
GeneralRe: nullrefererence exception Pin
hobbsjas10-Nov-09 9:25
hobbsjas10-Nov-09 9:25 
QuestionInconsistent accessibility: property type is less accessible than property Pin
Kevin Marois9-Nov-09 13:28
professionalKevin Marois9-Nov-09 13:28 
AnswerRe: Inconsistent accessibility: property type is less accessible than property Pin
J$9-Nov-09 13:36
J$9-Nov-09 13:36 
GeneralRe: Inconsistent accessibility: property type is less accessible than property Pin
Kevin Marois9-Nov-09 13:49
professionalKevin Marois9-Nov-09 13:49 
GeneralRe: Inconsistent accessibility: property type is less accessible than property Pin
Luc Pattyn9-Nov-09 13:56
sitebuilderLuc Pattyn9-Nov-09 13:56 
QuestionWin32 Message Hooks and/or Legitimate Code Injection Pin
cymblicity9-Nov-09 12:54
cymblicity9-Nov-09 12:54 
Background
I have an old program that I wrote a few years ago in C#. I no longer have the source code. I have a dialog box in the program that I want to add a button to. All the button will do is launch a program. I've used Resource Hacker to add the button, but how would I go about basically adding a listener to it?

There are two ways I can think to do this:

1. Intercept Win32 messages using a separate program and wait for the WM_COMMAND for that specific button to come up. The program with this is that I don't know enough about API calls to do this on my own in a reasonable amount of time (and I'm guessing I'd have to dive into some C++).

2. Inject code into the existing executable. I've seen examples of how to inject code at the starting point of an executable, but nothing that comes close to being a 'listener' for a button.

I'm thinking unless someone has an easy way of accomplishing number 2, intercepting the messages will be the way to go. So... How on earth would I accomplish this? Using Spy++, I have found the call that I would like to intercept:
004103C8 S WM_COMMAND wNotifyCode:BN_CLICKED wID:12345 hwndCtl:00450346 [wParam:00003039 lParam:00450346]

I've seen code samples for all kinds of hooks, but I can't seem to find one that will grab this.

The question:
Does anyone know of some code that demonstrates how to catch a WM_COMMAND from an external application? If not, how should I go about implementing this strategy?
AnswerRe: Win32 Message Hooks and/or Legitimate Code Injection Pin
Luc Pattyn9-Nov-09 15:28
sitebuilderLuc Pattyn9-Nov-09 15:28 
Questionhow can i calculate shortest path between neurons in artifical neural network graph? Pin
karayel_kara9-Nov-09 12:32
karayel_kara9-Nov-09 12:32 
QuestionC# subject not correct form because of shift+enter Pin
Jacob Dixon9-Nov-09 10:45
Jacob Dixon9-Nov-09 10:45 
AnswerRe: C# subject not correct form because of shift+enter Pin
Abhishek Sur9-Nov-09 10:48
professionalAbhishek Sur9-Nov-09 10:48 
GeneralRe: C# subject not correct form because of shift+enter Pin
Jacob Dixon9-Nov-09 10:55
Jacob Dixon9-Nov-09 10:55 
GeneralRe: C# subject not correct form because of shift+enter Pin
Abhishek Sur9-Nov-09 21:37
professionalAbhishek Sur9-Nov-09 21:37 
Questionthreading access to toolstripmenuitem Pin
ToeKing9-Nov-09 10:41
ToeKing9-Nov-09 10:41 
AnswerRe: threading access to toolstripmenuitem Pin
Luc Pattyn9-Nov-09 11:37
sitebuilderLuc Pattyn9-Nov-09 11:37 
QuestionMp3 or Wav Stream and Parse Pin
Greg Mort9-Nov-09 9:56
Greg Mort9-Nov-09 9:56 
Questionhow to start a form in a specific location Pin
BDJones9-Nov-09 8:51
BDJones9-Nov-09 8:51 
AnswerRe: how to start a form in a specific location Pin
Christian Graus9-Nov-09 9:15
protectorChristian Graus9-Nov-09 9:15 
GeneralRe: how to start a form in a specific location Pin
BDJones9-Nov-09 9:20
BDJones9-Nov-09 9:20 
GeneralRe: how to start a form in a specific location Pin
hotthoughtguy9-Nov-09 9:21
hotthoughtguy9-Nov-09 9:21 
AnswerRe: how to start a form in a specific location Pin
Luc Pattyn9-Nov-09 9:38
sitebuilderLuc Pattyn9-Nov-09 9:38 
GeneralRe: how to start a form in a specific location Pin
BDJones9-Nov-09 12:56
BDJones9-Nov-09 12:56 
GeneralRe: how to start a form in a specific location Pin
Luc Pattyn9-Nov-09 13:17
sitebuilderLuc Pattyn9-Nov-09 13:17 
QuestionHow to change the color text in datagridview cells Pin
Ejrr10859-Nov-09 8:22
Ejrr10859-Nov-09 8:22 

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.