mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2004
Posts: 2
A
Amotea Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Dec 2004
Posts: 2
Hi,

I've created a DLL for mIRC and it works great. But it takes some time to execute so I'd rather use it multithreaded so my mIRC won't freeze.
I know calling is done like this: $dllcall(filename, alias, procname, data)
But I don't know how to use the the data that is returned in the 'data' variable in an alias. I just want to /msg it to $chan...

How do I do this?

Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
//say $dllcall(filename, alias, procname, data)

Joined: Dec 2004
Posts: 2
A
Amotea Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Dec 2004
Posts: 2
I don't think I get it. The DLL call is made through a remote script, but since it is called multithreaded, the only thing I can do is execute an alias after the DLL has completed execution.
What I want to do is /msg the data in 'data' to a channel.

//saying it doesn't work because nothing is returned directly. This will just call the specified alias.

Joined: Aug 2004
Posts: 7
M
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
M
Joined: Aug 2004
Posts: 7
Quote:
//saying it doesn't work because nothing is returned directly. This will just call the specified alias.


Forget making the dll multithreaded, make the "thread" earlier by using a zero seconds /timer to call the /say command.

That'll let you carry on doing whatever while the dll is running and while the /say command says whatever it returns


Yesterday it worked
Today it doesn't work
Windows is like that.
Joined: Dec 2002
Posts: 25
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Dec 2002
Posts: 25
You could use the memory mapped file feature in mIRC to send the text.

Declaration:
Code:
#include <windows.h>
#include <pcrt32.h>

long	WM_MCOMMAND = WM_USER + 200;

typedef struct {
	DWORD  mVersion;
	HWND   mHwnd;
	BOOL   mKeep;
} LOADINFO;


class mIRC {
public:
	int mSendMessage(char *);
	HWND hWnd;
};

int mIRC::mSendMessage(char *sText)
{
	if (!hWnd) return 0;
	
	void *hFile;
	void *pData;

	hFile = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,1024,"mIRC");

	if (!hFile)
		MessageBox(hWnd,(char *)"Can't create a file mapping object.",(char *)"Error...",MB_OK);

	pData = MapViewOfFile(hFile,FILE_MAP_ALL_ACCESS,0,0,0);

	if (!pData)
		MessageBox(hWnd,(char *)"Can't map view of the file.",(char *)"Error...",MB_OK);
	
	if (pData) {
		_fstrcpy((char *)pData,sText);

		SendMessage(hWnd,WM_MCOMMAND,1,0);

		UnmapViewOfFile(pData);
		CloseHandle(hFile);
		
		return 0;
	}
	return 1;
}



Code:
int __stdcall SampleFunction(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL print, BOOL nopause)
{	
	mIRC mObject;
	mObject.hWnd = mWnd;
	mObject.mSendMessage("/msg #chan This is a string");
	return 0;
}


Link Copied to Clipboard