AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[module, ahk & dotNet] IPC 2.6 
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
zoulou
Guest





PostPosted: Thu Jan 31, 2008 7:09 pm    Post subject: Reply with quote

Thanks majkinetor for this example. But I was very interested when you said :
majkinetor wrote:
He can also use CreateWindowEx to create hidden control and subclass it, in which case it will not receive large number of messages. Then it can receive IPC messages.
So I'd like to have an example of a script with no (at least visible) window which receive an IPC message from an other script with no (at least visible) window. Thanks by advance
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Thu Jan 31, 2008 8:15 pm    Post subject: Reply with quote

Just don't use Gui, Show then Exclamation
_________________
Back to top
View user's profile Send private message
zoulou
Guest





PostPosted: Thu Jan 31, 2008 8:43 pm    Post subject: Reply with quote

OK. Sorry I'm a noob. So there is no problem using IPC_OnMessage and IPC_Send without any window.
Thanks for all your marvelous work (IPC, MMenu, etc)
Back to top
infogulch



Joined: 27 Mar 2008
Posts: 378

PostPosted: Mon Mar 16, 2009 4:46 am    Post subject: Reply with quote

Cool!

Now that 1.0.48 is out, you could use IsFunc() and allow specifying a function instead of only a label. Or maybe both. I guess I personally just have issues with global variables. Razz

Btw, I noticed that the static id var isn't used in the receiving function.

Thanks, majkinetor!

Smile
_________________

Scripts
- License
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Mon Mar 16, 2009 3:12 pm    Post subject: Reply with quote

Thanks.

About your suggestion, yes, sure, most recent modules use functions regeardless of IsFunc, plus, there are other improvementes which makes them better candidates for APIs.

Ill do it if I return to AHK programming.
_________________
Back to top
View user's profile Send private message
hughman



Joined: 11 Feb 2007
Posts: 92

PostPosted: Mon Apr 06, 2009 3:36 pm    Post subject: Reply with quote

Is it possible to communicate between local process and remote?
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Thu Jul 09, 2009 10:44 am    Post subject: Reply with quote

version 2.0

- Removed all globals
- Label switched to function
- API changed a bit to support sending binary data.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4469
Location: Qld, Australia

PostPosted: Wed Aug 05, 2009 2:17 pm    Post subject: Reply with quote

majkinetor, currently the Hwnd parameter of the Handler function is always your "security ID" 951753, despite being documented as "Handle of the window passing data". I think it woud be best to either remove this parameter or discard the "security ID" feature (i.e. pass an actual hwnd and let the script rely on port numbers or some other mechnism for "security").
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Wed Aug 05, 2009 3:43 pm    Post subject: Reply with quote

*** version 2.01 ***

- Bugfixes.
- Security ID removed.
- Docs updated.


Ty Lex.

PS: The point of sec ID was for script to make less likely that other app will send COPYDATA (i.e. for module to know its own messages). I removed it nevertheless.
_________________
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 883

PostPosted: Wed Aug 05, 2009 11:48 pm    Post subject: Reply with quote

Can you post an example for say, shutting down a script from another?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4469
Location: Qld, Australia

PostPosted: Thu Aug 06, 2009 8:27 am    Post subject: Reply with quote

That would probably be a bad example since it can be done more easily by simply closing the 'ahk_class AutoHotkey' window. (It has been covered many times before on the forums.) There isn't much to the IPC module; the example included in the download should be sufficient.
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Thu Aug 06, 2009 10:27 am    Post subject: Reply with quote

I am constantly using IPC for situations in which I have some kind of console that sets up execution of some independent scripts that notify console about execution details.

For instance, my latest project was involving Task Scheduler in AHK that instantiates dozen of scripts as scheduled tasks. Tasks send execution details to log control kept by the scheduler script.
_________________
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Thu Aug 06, 2009 12:51 pm    Post subject: Reply with quote

*** version 2.5 ***

+ Added DotNet library in IPC.cs (classes IPC, IPCEventArgs). The API is the same as with IPC.ahk (minus obvious AHK vs C# differences)
+ IPC_Test.exe sample for DotNet <-> AHK communication.
_________________
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4114
Location: Belgrade

PostPosted: Sat Aug 08, 2009 2:09 pm    Post subject: Reply with quote

It seems that DotNet part doesnt work correctly on 64bit systems.

Ill see more about it, but If somebody can test on 32 and 64bit on their own, it could help.

Ty.
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4469
Location: Qld, Australia

PostPosted: Sat Aug 08, 2009 3:02 pm    Post subject: Reply with quote

majkinetor, the first and last fields of COPYDATASTRUCT are pointer-sized, i.e. 64-bit in 64-bit applications:
Code:
typedef struct tagCOPYDATASTRUCT {
    ULONG_PTR dwData;
    DWORD cbData;
    PVOID lpData;
} COPYDATASTRUCT, *PCOPYDATASTRUCT;

Code:
   [StructLayout(LayoutKind.Sequential)]
   struct COPYDATASTRUCT
   {
      public int dwData;
      public int cbData;
      public int lpData;
   }
I suppose IntPtr is the appropriate managed type to use for these two fields.

Edit: After correcting that, the rest is mostly straight-forward as long as you don't do this:
Code:
ea.Port = CD.dwData.ToInt32();
What we want to be -100 is treated as 0xFFFFFF9C. Since that's outside the range of an int, OverflowException is thrown and the WndProc silently fails. Very annoying and IMO rediculous, but the following works:
Code:
ea.Port = (int)CD.dwData.ToInt64();

(Also edit: "i.e. 64-bit on 64-bit Windows" was inaccurate.)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group