I am hoping someone familiar with the window manipulation abilites of MQ2 can help with this.
The goal is simple, click the damn reward selection button in the task reward window.
Sounds easy doesn't it
The goal is simple, click the damn reward selection button in the task reward window.
Sounds easy doesn't it
Rich (BB code):
// MQ2Test.cpp : Defines the entry point for the DLL application.
//
#include "../MQ2Plugin.h"
PreSetup("MQ2Test");
CHAR buff[512];
BOOL IsWindowOpen(PCHAR WindowName)
{
WriteChatColor("IsWindowOpen",111111);
PCSIDLWND pWnd=(PCSIDLWND)FindMQ2Window(WindowName);
if (!pWnd) return false;
return (BOOL)pWnd->Show;
}
bool ClickIt(CXWnd *pWnd)
{
if (!pWnd) {
WriteChatColor("ClickIt Fail (null pointer)",111111);
return false;
}
WriteChatColor("ClickIt",111111);
DebugTry(CXRect rect=pWnd->GetScreenRect());
sprintf(buff, "ClickIt - Control \"%s\" being used",pWnd->WindowText->Text);
WriteChatColor(buff,111111);
DebugTry(CXPoint pt=rect.CenterPoint());
sprintf(buff, "ClickIt - Rectangle center point a:%d b:%d",pt.A, pt.B);
WriteChatColor(buff,111111);
DebugTry(pWnd->HandleLButtonDown(&pt,0));
DebugTry(pWnd->HandleLButtonUp(&pt,0));
WriteChatColor("ClickIt - Click attempted",111111);
return true;
}
void WinClick(CXWnd *ParentWnd, PCHAR ScreenID, DWORD KeyState) {
WriteChatColor("WinClick",111111);
if(ParentWnd){
if(CXWnd *ChildWnd=ParentWnd->GetChildItem(ScreenID)) {
sprintf(buff, "WinClick - Child %s found under window %s",ChildWnd->GetXMLData()->ScreenID, ParentWnd->GetXMLData()->ScreenID);
WriteChatColor(buff,111111);
ClickIt(ChildWnd);
}
}
}
VOID AutoReward(PSPAWNINFO pChar, PCHAR szLine) {
WriteChatColor("Command - AutoReward",111111);
if (IsWindowOpen("RewardSelectionWnd")) WriteChatColor("Window is open",111111);
WinClick(FindMQ2Window("RewardSelectionWnd"),"RewardSelectionChooseButton",1);
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/reward",AutoReward);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/reward");
}