| View previous topic :: View next topic |
| Author |
Message |
zoulou Guest
|
Posted: Thu Jan 31, 2008 7:09 pm Post subject: |
|
|
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
|
Posted: Thu Jan 31, 2008 8:15 pm Post subject: |
|
|
Just don't use Gui, Show then  _________________
 |
|
| Back to top |
|
 |
zoulou Guest
|
Posted: Thu Jan 31, 2008 8:43 pm Post subject: |
|
|
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
|
Posted: Mon Mar 16, 2009 4:46 am Post subject: |
|
|
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.
Btw, I noticed that the static id var isn't used in the receiving function.
Thanks, majkinetor!
 _________________
Scripts - License |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Mon Mar 16, 2009 3:12 pm Post subject: |
|
|
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 |
|
 |
hughman
Joined: 11 Feb 2007 Posts: 92
|
Posted: Mon Apr 06, 2009 3:36 pm Post subject: |
|
|
| Is it possible to communicate between local process and remote? |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Thu Jul 09, 2009 10:44 am Post subject: |
|
|
version 2.0
- Removed all globals
- Label switched to function
- API changed a bit to support sending binary data. _________________
 |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4469 Location: Qld, Australia
|
Posted: Wed Aug 05, 2009 2:17 pm Post subject: |
|
|
| 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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Wed Aug 05, 2009 3:43 pm Post subject: |
|
|
*** 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 |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 883
|
Posted: Wed Aug 05, 2009 11:48 pm Post subject: |
|
|
| Can you post an example for say, shutting down a script from another? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4469 Location: Qld, Australia
|
Posted: Thu Aug 06, 2009 8:27 am Post subject: |
|
|
| 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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Thu Aug 06, 2009 10:27 am Post subject: |
|
|
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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Thu Aug 06, 2009 12:51 pm Post subject: |
|
|
*** 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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4114 Location: Belgrade
|
Posted: Sat Aug 08, 2009 2:09 pm Post subject: |
|
|
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 |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4469 Location: Qld, Australia
|
Posted: Sat Aug 08, 2009 3:02 pm Post subject: |
|
|
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 |
|
 |
|