|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Hello, I searched the forums for a DLL tutorial for Delphi 6 and I now have the following.
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?
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
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...
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
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Nah dude this wont work, it dont compile.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Yeah you're right, I misread a tutorial about 'varargs', sorry.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
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.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Nah sorry, I can't think of anything else.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
No worried buddy. I did manage to find a way but it is so n00bish.
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.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Actually, this might work: 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
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
[Error] andy.dpr(9): Undeclared identifier: 'WM_USER'
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Ah, I think you need to include "Windows" and "Messages" in your Uses clause.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Well thankfully, I'm getting no compilation errors however when I type /dll andy.dll msg no messages are sent to $me.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
My mistake again, WM_USER + 100 should be WM_USER + 200
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You mean like this?
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.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
It's a no go I'm afraid dude, still wont work.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Thanks for this info, is there any CreateFileMapping() tutorials?
|
|
|
|
|