Code:
#include <windows.h> // Include windows API
#include "resource.h" // For the resource declarations.
HWND ZoneLobbyWindow, AtlAxWin, WindowManager, ChatControl, RichEditA, ZRolloverButton;
/*****************************************************************************
If you are like me, you do not want to make a bunch of declares for your
functions. So, if you add your functions right here, you can call them
from your dialog without needing them declared.This is open source and
I allow you to use my code as you wish. All I ask is that you learn
something from this tutorial.
*****************************************************************************/
void SendLobby(char *buff) // send to lobby,
{
ZoneLobbyWindow = FindWindow("ZoneLobbyWindow", NULL); // Get Zone Lobby Window
AtlAxWin = FindWindowEx(ZoneLobbyWindow, 0, "AtlAxWin", NULL); // Find AtlAxWin in Zone Lobby Window
WindowManager = FindWindowEx(AtlAxWin, 0, "WindowManager", NULL); // FInd WindowManager in AtlAxWin
AtlAxWin = FindWindowEx(WindowManager, 0, "AtlAxWin", NULL); // Find AtlAxWin in WindowManager
AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL); // Find AtlAxWin again to get next one
AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL); // Find AtlAxWin again to get next one
AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL); // Find AtlAxWin again to get next one
AtlAxWin = FindWindowEx(WindowManager, AtlAxWin, "AtlAxWin", NULL); // Find AtlAxWin again to get next one
/* Now that we have the right AtlAxWin we can get the next windows */
ChatControl = FindWindowEx(AtlAxWin, 0, "ChatControl", NULL); // Get ChatControl from AtlAxWin
RichEditA = FindWindowEx(ChatControl, 0, "RichEdit20A", NULL); // Get Rich Edit in Chat control
RichEditA = FindWindowEx(ChatControl, RichEditA, "RichEdit20A", NULL); // Get the other one
SendMessage(RichEditA, WM_SETTEXT, sizeof(buff), (LPARAM)buff); // Send Text to Rich Edit
ZRolloverButton = FindWindowEx(ChatControl, 0, "ZRolloverButton", NULL); // Move the Send Button on the Stack
SendMessage(ZRolloverButton, WM_KEYDOWN, VK_SPACE, 0); // Push the button
SendMessage(ZRolloverButton, WM_KEYUP, VK_SPACE, 0); // Release the button
}
/* Okay, there are many ways that you can send to lobby, some of the ways that I know are:
winsock - Can get you in-trouble if you don't know what you're doing
ZoneClient - Best method
Api - The way this tutorial does it. */
/* This is the process for the main dialog of the program. */
BOOL CALLBACK MainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) // This is like the case select in BASIC
{
case WM_INITDIALOG: // Initialization of the window
{ // Not needed, but good for clean code.
// Load code here, such as, SetWindowText.
} // Not needed, but good for clean code.
return TRUE;
case WM_COMMAND: // Window Manager Command
switch (LOWORD(wParam)) // Get dialog messages.
{
case IDC_BUTTON1: // What to do when Button1 is pressed.
{ // Once again, not needed, but looks good.
for (int x = 1; x <= 2; x++) { // Easy controlled loop method. Timers are better though.
SendLobby("TEXT HERE"); // Note that you can add GetDlgItemText
} // Ofcourse returns to {
} // Not needed, but good for clean code.
return TRUE;
}
return TRUE; // Remember, you're in the window manager, return good
case WM_DESTROY:
PostQuitMessage(0); // This is your simple exit command, Closes process.
return TRUE;
case WM_CLOSE:
PostQuitMessage(0); // This will close the process when close button is pressed.
return TRUE;
}
return FALSE;
}
/* Basic win32 initialization */
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
DialogBox (hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainProc); // Set the dialog to a proc
return 0x1337; // return as new system call
rc
Code:
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOGEX 0, 0, 186, 34
STYLE DS_SYSMODAL | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Flood Lobby",IDC_BUTTON1,7,7,172,20,0,
WS_EX_DLGMODALFRAME
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 27
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED