mIRC Home    About    Download    Register    News    Help

Print Thread
#110079 04/02/05 06:11 AM
Joined: Feb 2005
Posts: 4
B
bradtm Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Feb 2005
Posts: 4
I'm having trouble figuring out SendMessage with VB .Net. I have successfully found the Channel Window I want. Now I want to send a command to it. Here is what I'm trying to send mIRC:

For Each chrMessage In strMessage
SendMessage(intPtrChannelHandle, &H102 + 200, 1, chrMessage.ToString)
Next
SendMessage(intPtrChannelHandle, &H102 + 200, 13, vbNullString)

Anyone have an example or know what I'm doing wrong?

brad

#110080 04/02/05 11:45 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
I don't know (or like) VB, but I know how to do it in C, and considering its mostly API calls, this should be easily translatable:

Usage is SendCommand(mIRC_window, "/command string");

Code:
#define WM_MCOMMAND	(WM_USER+200)
#define WM_MEVALUATE	(WM_USER+201)

BOOL SendCommand(HWND hwnd, char *command)
{
	HANDLE hMapFile;
	LPSTR mData;
	BOOL result = FALSE;

	hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 4096, "mIRC");
	mData = (LPSTR)MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
	wsprintf(mData, command);
	SendMessage(hwnd, WM_MCOMMAND, NULL, NULL);
	if (strcmp(mData, "1") == 0) result = TRUE;
	UnmapViewOfFile(mData);
	CloseHandle(hMapFile);
	return result;
}


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
#110081 05/02/05 02:46 AM
Joined: Feb 2005
Posts: 4
B
bradtm Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Feb 2005
Posts: 4
Thanks, trying to convert it now.

Last edited by bradtm; 05/02/05 03:02 AM.

Link Copied to Clipboard