Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SendMessage WM_APP, send and receive string (using QM & .js)
#1
Sorry again, but I just can't get the following to work.
I am writing a semi-plugin for the text-editor AkelPad.

I am 99% done, the final hurdle is the SendMessage command that initiates my created AkelPad "plugin" (exe).
I do not know how to send string data and output in QM.

The sendmessage is done from AkelPad in the .js (javascript) language.

The first question: how do I modify the following .js code (if you can help me with the .js code)
I want to send the string "test". This code works, QM receives the message but I need to send the var "x" with it (and output it).

[Image: sendmessage_question_2.jpg]

var x="test\r\n"
AkelPad.SendMessage(460628,32768+177,x,0)

The "32768" is WM_APP
[Image: sendmessage_question_3.jpg]


The second question: how do I output "test"? By modifying the below QM code.
I Succeeded into sending a message and confirming the message arrival, with a static notifier: "MESSAGE RECIEVED"
But now I need to add some parameters that include the sent string "test"
The below code is placed above the "WM_COMMAND goto messages2" line:

Function akelpad_notes_dlg
Code:
Copy      Help
,case WM_APP+177        
,,out "MESSAGE RECIEVED"


I tried many combinations from the forum and Archive and searched the MSDN about this.

From the manual, but I think you don't need this. I capped a screenshot just in case.

[Image: sendmessage_question_1.jpg]
#2
Try WM_COPYDATA. With WM_APP you cannot send strings to other process, unless using some kind of shared memory or allocate process memory.
#3
Ok thanks, I will look at that!
#4
Sorry I got an example for AkelPad using FileMapping:

Code:
Copy      Help
var hMainWnd=AkelPad.GetMainWnd();
var hMem;
var szName;
var szMem;
var dwMemSize=1000;

if (szName=AkelPad.MemAlloc(16))
{
  AkelPad.MemCopy(szName, "Global\\AkelPad", 0 /*DT_ANSI*/);

  //Create named memory object.
  if (hMem=AkelPad.SendMessage(hMainWnd, 1305 /*AKD_MEMCREATE*/, szName, dwMemSize))
  {
    if (szMem=AkelPad.SendMessage(hMainWnd, 1306 /*AKD_MEMMAP*/, hMem, dwMemSize))
    {
      AkelPad.MemCopy(szMem, "Test", 0 /*DT_ANSI*/);
      AkelPad.SendMessage(hMainWnd, 1307 /*AKD_MEMUNMAP*/, szMem, 0);
    }

    //Call external application. This application should call:
    //hMem=OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Global\\AkelPad");
    //szMem=MapViewOfFile(hMem, FILE_MAP_ALL_ACCESS, 0, 0, 1000);
    //Read szMem.
    //UnmapViewOfFile(szMem);

    AkelPad.SendMessage(hMainWnd, 1308 /*AKD_MEMCLOSE*/, hMem, 0);
  }
  AkelPad.MemFree(szName);
}

How does syntax look like in QM if I want to receive the data?
#5
Macro Macro2333
Code:
Copy      Help
;;;;//hMem=OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Global\\AkelPad");
;;;;//szMem=MapViewOfFile(hMem, FILE_MAP_ALL_ACCESS, 0, 0, 1000);
;;;;//Read szMem.
;;;;//UnmapViewOfFile(szMem);

;read the sent string from the shared memory
__SharedMemory sm
lpstr m=sm.Open("Global\AkelPad")
out m

;write a string to the shared memory, let js read it
str r="TEST"
int dwMemSize=1000
lstrcpyn m r dwMemSize
#6
BEUATIFUL IT WORKS, THANKS!!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)