Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Send a message to mIRC

SNMSNM Member Posts: 5
Hi ;) ...

i'm trying to building an app that when you type in the app edit1.Text field and click a button it would send that message to Mirc's selected window...

i searched the web,help files on how to sendMessage() to Mirc;

in mirc/help/ "SendMessage" it says
"Applications can now use SendMessage() to communicate with the 32bit mIRC." with this code
[code]
SendMessage(mHwnd, WM_MCOMMAND, cMethod, 0L)

mHwnd - the handle of the main mIRC window, or the handle of a Channel, Query, etc. window.

WM_MCOMMAND - which should be defined as WM_USER + 200

cMethod - the way in which you want mIRC to process the message, where:
1 = As if typed in editbox
2 = As if typed in editbox, send as plain text
4 = Use flood protection if turned on, can be or'd with 1 or 2

Returns - 1 if success, 0 if fail
[/code]

i wish if you could take a little of your time to explan to me that line . and any extra info you could offer me.. :)

i read about "Hwnd" and it said that it selectes a window, but how do i select Mircs window?

thanke you in advance :)


Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi ;) ...
    :
    : i'm trying to building an app that when you type in the app edit1.Text field and click a button it would send that message to Mirc's selected window...
    :
    : i searched the web,help files on how to sendMessage() to Mirc;
    :
    : in mirc/help/ "SendMessage" it says
    : "Applications can now use SendMessage() to communicate with the 32bit mIRC." with this code
    : [code]
    : SendMessage(mHwnd, WM_MCOMMAND, cMethod, 0L)
    :
    : mHwnd - the handle of the main mIRC window, or the handle of a Channel, Query, etc. window.
    :
    : WM_MCOMMAND - which should be defined as WM_USER + 200
    :
    : cMethod - the way in which you want mIRC to process the message, where:
    : 1 = As if typed in editbox
    : 2 = As if typed in editbox, send as plain text
    : 4 = Use flood protection if turned on, can be or'd with 1 or 2
    :
    : Returns - 1 if success, 0 if fail
    : [/code]
    :
    : i wish if you could take a little of your time to explan to me that line . and any extra info you could offer me.. :)
    :
    : i read about "Hwnd" and it said that it selectes a window, but how do i select Mircs window?
    :
    : thanke you in advance :)
    :
    :
    :
    The SendMessage() routine is detailed in the Windows SDK. Just type the identifier in the editor and press F1 to open the help (while the text-cursor is somewhere in the word).
    The mIRC expects a certain message command with value of WM_USER+200.
    The cMethod should be parameter should be self explanatory. It just indicates what the mIRC window needs to do with the text.
    I think that OL parameter is a pointer, which points to the text to sent. If its not, then I cannot see, which text will be sent.
    The mHwnd is a handle to the window, which can be found using the FindWindow() or FindWindowEx() API routine. The easiest way is to use the FindWindow() and supply it with the title of the mIRC window. In code it will look something like this:
    [code]
    const
    WM_MCOMMAND = WM_USER + 200;
    begin
    ...
    Hmirc := FindWindow(nil, 'MIRC'); // Change the strings as necessary
    if Hmirc > 0 then begin // found the window
    if SendMessage(Hmirc, WM_MCOMMAND, 1, ???) = 0 then // perform send
    ShowMessage('Failed to send text!')
    else
    ShowMessage(Success!');
    end else
    ShowMessage(Unable to find window!');
    ...
    end;
    [/code]
    The dots indicate additional code, while the question marks need to be replaced by I hope the text type-cast as a PChar(). You should check it in the mirc help. This code is not tested.
  • SNMSNM Member Posts: 5
    : : Hi ;) ...
    : :
    : : i'm trying to building an app that when you type in the app edit1.Text field and click a button it would send that message to Mirc's selected window...
    : :
    : : i searched the web,help files on how to sendMessage() to Mirc;
    : :
    : : in mirc/help/ "SendMessage" it says
    : : "Applications can now use SendMessage() to communicate with the 32bit mIRC." with this code
    : : [code]
    : : SendMessage(mHwnd, WM_MCOMMAND, cMethod, 0L)
    : :
    : : mHwnd - the handle of the main mIRC window, or the handle of a Channel, Query, etc. window.
    : :
    : : WM_MCOMMAND - which should be defined as WM_USER + 200
    : :
    : : cMethod - the way in which you want mIRC to process the message, where:
    : : 1 = As if typed in editbox
    : : 2 = As if typed in editbox, send as plain text
    : : 4 = Use flood protection if turned on, can be or'd with 1 or 2
    : :
    : : Returns - 1 if success, 0 if fail
    : : [/code]
    : :
    : : i wish if you could take a little of your time to explan to me that line . and any extra info you could offer me.. :)
    : :
    : : i read about "Hwnd" and it said that it selectes a window, but how do i select Mircs window?
    : :
    : : thanke you in advance :)
    : :
    : :
    : :
    : The SendMessage() routine is detailed in the Windows SDK. Just type the identifier in the editor and press F1 to open the help (while the text-cursor is somewhere in the word).
    : The mIRC expects a certain message command with value of WM_USER+200.
    : The cMethod should be parameter should be self explanatory. It just indicates what the mIRC window needs to do with the text.
    : I think that OL parameter is a pointer, which points to the text to sent. If its not, then I cannot see, which text will be sent.
    : The mHwnd is a handle to the window, which can be found using the FindWindow() or FindWindowEx() API routine. The easiest way is to use the FindWindow() and supply it with the title of the mIRC window. In code it will look something like this:
    : [code]
    : const
    : WM_MCOMMAND = WM_USER + 200;
    : begin
    : ...
    : Hmirc := FindWindow(nil, 'MIRC'); // Change the strings as necessary
    : if Hmirc > 0 then begin // found the window
    : if SendMessage(Hmirc, WM_MCOMMAND, 1, ???) = 0 then // perform send
    : ShowMessage('Failed to send text!')
    : else
    : ShowMessage(Success!');
    : end else
    : ShowMessage(Unable to find window!');
    : ...
    : end;
    : [/code]
    : The dots indicate additional code, while the question marks need to be replaced by I hope the text type-cast as a PChar(). You should check it in the mirc help. This code is not tested.
    :



    Thanks ;) This gave me info on what i need to know....

    ill get back to u if im stuck ...
    thanks bro ;)

  • ryanc2k3ryanc2k3 Member Posts: 28
    any one here knows how to disable auto-join ads and other spam messaages??
Sign In or Register to comment.