News:

 

Topic: Samardac Bridges.  (Read 21803 times)

0 Members and 3 Guests are viewing this topic.

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
January 19, 2015, 06:05:36 am
Is it possible for your plugin to send message to the process where NVil is runging?

The message will be an integer: 41251
« Last Edit: January 19, 2015, 06:18:12 am by IStonia »

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 08:14:33 am
What kind of message?
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
January 19, 2015, 09:28:54 am
Here is a sample code for c#

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern int SendMessage(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int Msg, IntPtr wParam, IntPtr lParam);

It is actually a window API execution. AHK should have similar stuff. "hwnd" is the window handle of the process. "Msg" is the message which is an integer.
« Last Edit: January 19, 2015, 09:36:50 am by IStonia »

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 09:36:54 am
I just try to figure it out...
What is going on here?:
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]

As I understand here:
SendMessage(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int Msg, IntPtr wParam, IntPtr lParam);
you send Windows message?
And what is it? - [MarshalAs(UnmanagedType.U4)] int Msg

Also I can not see here 41251.

Let me know, and looks like I can reproduce it because I can send Windows Messages and can call DLL and I can define Process ID and window ID(HWND).
« Last Edit: January 19, 2015, 09:47:12 am by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
January 19, 2015, 09:48:12 am
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)] is used to specify that the defined function is going to use window API which is inside "user32.dll".

I can use this function to send message(like "123", "4398" or what ever) to any running app if I know its process and its window handle.

If you can send NVil a window message after you've written the .txt file. NVil will be able to read it without using timer checking.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 09:52:34 am
Give me NVil and I'll try.
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
January 19, 2015, 10:29:35 am
http://www.digitalfossils.com/Download/NVil-Jan-18-15.rar

Make sure the msg is 41251. This is to avoid conflicting with other window messages.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 11:01:02 am
Can not make it to work.
Look, In AHK you send message with this command:
SendMessage, Msg [, wParam, lParam, Control, WinTitle]

Msg - is message number
WParam - Some parametr
lParam - Some parametr
Control - Name of control if you sen message to Windows conrtrol
WinTitle - Title of window or HWND e.t.c of window to what you sen message.


So, my command now looks like this(send to Win Title not HWND fore simplicity of test):
SendMessage, 41251,0,0,,NVil
It does not work, as you can see WParam and LParam is 0 may be I have to set it to something?
Also I see that Windows messages have number paterns like this: 0x000.
So may be you can figure out what is wrong.

May be you can show me working code in C# that send message to NVIl and make NVil get that .txt? And I will try to reproduce it?
« Last Edit: January 19, 2015, 11:08:03 am by samardac »
Portfolio: www.samardac.com

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 11:18:28 am
Sorry everything is working!!
Here was mistake in name of .txt file I just notice it.
Looks like it works good without problems, thanks!
Portfolio: www.samardac.com

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 19, 2015, 11:25:36 am
Just and Idea, may be you can associate some of WParam or lParam with name of command?
To run them without .txt only with Messages?
Portfolio: www.samardac.com

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
January 20, 2015, 06:51:49 pm
hay IStonia,
Is it possible for you to warp command name into WParam or lParam? To send them with message.
Portfolio: www.samardac.com

  • No avatar
  • Posts: 289
  • Triangle
    • Portfolio
January 22, 2015, 07:33:19 am
I hope to see you share this Sarmadac!

At the moment I am creating Radial Menus for Moi and would love to have integration with Nvil.

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
January 23, 2015, 09:07:48 am
hay IStonia,
Is it possible for you to warp command name into WParam or lParam? To send them with message.

WParam and LParam are just integer values. LParam may point to an address where the data is stored. But AHK and .net may store data in different patterns, even if its the same today, it may be different in the future when things get changed.

  • Posts: 1697
  • Administrator
  • Polygon
    • http://samardac.com/
February 02, 2015, 03:34:34 pm
Hi IStonia,
Have some question,
My plugin have function - New project, it means that MoI sends to NVil obj, but before it past in NVil, plugin creates new project using command - New. So it looks like this:

TID Common Modeling Shortcut Tools >> New Scene
TID Common Modeling Shortcut Tools >> Clipboard Paste

The problem is that when Save As dialog appears and you press cancel it does not cancel Clipboard Paste.
Could you make command Clipboard Paste (New project)? So it will have command - New and Clipboard Paste, but if you press Cancel it will cancel everything.
« Last Edit: February 02, 2015, 03:37:19 pm by samardac »
Portfolio: www.samardac.com

  • No avatar
  • Posts: 3760
  • Developer
  • Administrator
  • Polygon
February 03, 2015, 07:53:33 am
Try this
http://www.digitalfossils.com/Download/NVil-Feb-03-15.rar

I didn't add any new command. But if new scene is canceled, clipboard paste won't go.