mIRC Home    About    Download    Register    News    Help

Topic Options
#106937 - 05/01/05 12:26 PM Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Hello, I searched the forums for a DLL tutorial for Delphi 6 and I now have the following.

Code:
library andy;

uses
  Windows, SysUtils, Classes;

function test(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
  StrCopy(data,'/.msg Nick ...');
  Result := 2;
End;

exports
  test;

{$R *.RES}

begin
end.


The DLL works fine, it's basically a test DLL, when you type /dll andy.dll test it performs "/.msg $me ...".

Basically you type /dll andy.dll test.

And instead of
<Andy> ...

I get two messages
<Andy>...
<Andy>+++

Etc. It doesn't have to be "... " or even "+++" I just simply want it to send two /msg's to $me anyone any ideas?

Top
#106938 - 05/01/05 01:53 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
I haven't used delphi for a while, so there's probably a couple of errors in the syntax, but this should give you the idea...

Code:
function wsprintf(lpOut, lpFmt : PChar); cdecl; varargs;

function test(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall; begin  
  StrCopy(data,'$me');
  var me : string;
  me = SendMessage(mWnd,WM_USER + 101,0,0);
  wsprintf(data,'/.msg %s ...',me);  
  SendMessage(mWnd,WM_USER + 100,0,0);
  wsprintf(data,'/.msg %s ...',me);  
  SendMessage(mWnd,WM_USER + 100,0,0);
  Result := 2;
End;
_________________________
New username: hixxy

Top
#106939 - 05/01/05 02:07 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Nah dude this wont work, it dont compile.

Top
#106940 - 05/01/05 02:24 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Yeah you're right, I misread a tutorial about 'varargs', sorry.
_________________________
New username: hixxy

Top
#106941 - 05/01/05 02:30 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Hey dude it's cool, thanks. Any ideas or should I wait for someone else?

If you don't know it doesn't matter. Someone later may reply. grin

Top
#106942 - 05/01/05 04:45 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Nah sorry, I can't think of anything else.
_________________________
New username: hixxy

Top
#106943 - 05/01/05 04:54 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
No worried buddy. I did manage to find a way but it is so n00bish.
Code:
function msg(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
  StrCopy(data,'/.msg Nick ... | /.msg Nick ...');
  Result := 2;
End;


Is there any decent tutorials for SendMessage using Delphi and what not?

I've e-mailed the author of the the Delphi 6 DLL tutorial to work with mIRC so I will wait to see what he says and to see if he can shed any light on it.

Thanks for your help. grin

Top
#106944 - 05/01/05 05:03 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Actually, this might work:

Code:
function msg(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall; begin
  StrCopy(data,'//.msg $me ...');  
  SendMessage(mWnd,WM_USER + 100,0,0);
  StrCopy(data,'//.msg $me ...');  
  SendMessage(mWnd,WM_USER + 100,0,0);
  Result := 3;
End;
_________________________
New username: hixxy

Top
#106945 - 05/01/05 05:21 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
[Error] andy.dpr(9): Undeclared identifier: 'WM_USER'

Top
#106946 - 05/01/05 05:25 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Ah, I think you need to include "Windows" and "Messages" in your Uses clause.
_________________________
New username: hixxy

Top
#106947 - 05/01/05 05:35 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Well thankfully, I'm getting no compilation errors however when I type /dll andy.dll msg no messages are sent to $me. frown

Top
#106948 - 05/01/05 05:55 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
My mistake again, WM_USER + 100 should be WM_USER + 200 blush
_________________________
New username: hixxy

Top
#106949 - 05/01/05 06:17 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
You mean like this?
Code:
library andy;

uses
  Windows, SysUtils, Messages, Classes;

function msg(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
StrCopy(data,'//msg $me ...');
SendMessage(mWnd,WM_USER + 200,0,0);
StrCopy(data,'//msg $me ...');
SendMessage(mWnd,WM_USER + 200,0,0);
Result := 3;
End;

exports
  msg;

{$R *.RES}

begin
end.

Top
#106950 - 05/01/05 06:19 PM Re: Delphi 6 mIRC DLL.
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
Yes.
_________________________
New username: hixxy

Top
#106951 - 05/01/05 06:21 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
It's a no go I'm afraid dude, still wont work. frown

Top
#106952 - 05/01/05 07:44 PM Re: Delphi 6 mIRC DLL.
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
In order to use SendMessage you have to put the command to be sent in a mapped file, you can't just stick it in data.
_________________________
Spelling mistakes, grammatical errors, and stupid comments are intentional.

Top
#106953 - 05/01/05 07:53 PM Re: Delphi 6 mIRC DLL.
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Thanks for this info, is there any CreateFileMapping() tutorials?

Top