I am writing a C # application, which needs to be blocked by window messaging That other applications are sending. The company that monitors me has sent the application to me in some example code, although it is in C ++ which I do not really know.
C to ++ examples I've got to address that they use the following code:
Uaianti Yuemjiar = register Wando message (Soackak_mamsuaraaradsiasti); ON_REGISTERED_MESSAGE (WM_SHOCK_BROADCAST_MESSAGE, Onsokstats message) LRESULT OnShockStatusMessage (WPARAM wParam, LPARAM lParam); As I think it receives an ID from Windows for a specific message that we want to hear. Then when we are intercepted to match the ID that matches the ID, then asking C ++ to call OnShockStatusMessage .
After some research, I put together the following C # A
[DllImport ( "user32.dll", SetLastError = true)] public static extern IntPtr FindWindow (String lpClassName, string lpWindowName); [DllImport ("user32.dll", SetLastError = true, Charset = Charset.auto)] Fixed Exists UI Register Register (string LP string); Private intent _ hwd; // APS-50 class context personal list & lt; IntPtr & gt; _windowsMessages = New list & lt; IntPtr & gt; (); // aps-50 message private contact string _classname = "www.au.pix.com/SHOCK/MessageWindowClass"; // Windows Message Events Private Press Strand _messageBroadcast = "www.AuPix.com/SHOCK/BROADCAST"; Private constant strand _messageCallEvents = "www.AuPix.com/SHOCK/CallEvents"; Private press string _messageRegistrationEvents = "www.AuPix.com/SHOCK/RegistrationEvents"; Private constant strand _messageActions = "www.AuPix.com/SHOCK/Actions"; Private Zero DemoProble () {// Find the operation of hidden window _HWnd = FindWindow (_className, null); // register for the events _windows message. Add (new Aiteepitiar (Register Wando message (_messageActions)); _windowsMessages.Add (new IntPtr (Register WindowMessage (_messageBroadcast)); _windowsMessages.Add (new IntPtr (Register WindowMessage (_messageCallEvents))); _windowsMessages.Add (new IntPtr (Register WindowMessage (_messageRegistrationEvents)));} protected override void WndProc (Ref message) {base.WndProc (ref m); // what they IntPtr message registered Windows message to APS -50 application? Forex (_WindowsMessages) { If ((IntPtr) m.Msg == message) {Debug.WriteLine ("Message found for specified application!")}} // Are they coming from the APS-50 application? If (m.HWnd == shock.WindowsHandle) {Debug.WriteLine ("Message from specified application!");}} < P> As I understand that this should be the only basic thing, in this: - I want to monitor the application finds
- Entering window messages I
- Watches for all window messages - then I exclude those I need
However my o In the Verraide, I can block any message from the WndProc () method, neither from any specific message or any message I am monitoring in my check.
If I debug Rohit For everyone who comes through it, I can see that it is monitoring them. Although it never filters my messages
By running the example monitoring application written in C ++, I can see that window messages are being sent and are being raised - this does not just implement my C #.
To get me out of the other application PostMessage my message window The message is asking to send.
Post Message ((int) _hWnd, _windowsMessages [0], SHOCK_REQUEST_ACTIVE_CALLINFO, (int) _thisHandle); Post Message (_A) _HWnd, _WindowsMessages [0], SHOCK_REQUEST_ALL_REGISTRATIONINFO, (int) _thisHandle); Post a message ((ANT) _ Acdblud, _ Wainds message [0], Soacosiiisiacisiisiiisiielaiantians, (IANS) _thishandl); Post Message (ANT) _HWD, _Windows Message [0], SOHOCIEHEESERGIRTNEEEENS, (IND) _thishandal); is not a very good code, but it works enough to prove what I need now :)
Comments
Post a Comment