コード例 #1
0
ファイル: autofish.cpp プロジェクト: NathanFeeser/Autofish
//Returns the window handle of the given process.
HWND AutoFish::getWindow(LPCSTR processName) {
    HWND hwnd = FindWindowA(0, processName);
    if(!hwnd) {
        std::cout << "Error: Cannot find window!" << std::endl;
        updatelabel("Error: Cannot find window.");
    }
    else {
        //Store the pid in our pid variable address
        GetWindowThreadProcessId(hwnd,&pid);
        std::cout << "Success! Window found!" << std::endl;
        updatelabel("Success! Window Found!");
    }
    return hwnd;
}
コード例 #2
0
ファイル: autofish.cpp プロジェクト: NathanFeeser/Autofish
void AutoFish::on_startButton_clicked()
{
    //The handle for the window.
    HWND window = getWindow("FINAL FANTASY XIV: A Realm Reborn");
    if (window)
    {
        //Set label
        updatelabel("Fishing!!");

        //Setup the static pointer and offsets:
        address = 0x1EB25D4;
        offset1 = 0x54;
        offset2 = 0xFC;
        memValue = 0;

        //Set the initial state
        state = AutoFish::Casting;
        //Start fishing.
        goneFishing(window);
    }
}
コード例 #3
0
ファイル: autofish.cpp プロジェクト: NathanFeeser/Autofish
//Function called when it is time to start fishing:
void AutoFish::goneFishing(HWND window) {

    //Get permission to read the process
    phandle = OpenProcess(PROCESS_VM_READ,0,pid);
    if (!phandle)
    {
        updatelabel("Error, unable to open process for reading.");
    }

    //Setup the input keys:
    INPUT ip;

    while (running && phandle)
    {
        switch (state)
        {
            case AutoFish::Casting:
            {
                // Bring specified window into focus
                SetForegroundWindow(window);
                // Set up a generic keyboard event.
                ip.type = INPUT_KEYBOARD;
                ip.ki.wScan = 0; // hardware scan code for key
                ip.ki.time = 0;
                ip.ki.dwExtraInfo = 0;
                //List of virtual key codes: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
                ip.ki.wVk = 0x32; // virtual-key code for the "2" key
                //Press the cast key
                ip.ki.dwFlags = 0; // 0 for key press
                SendInput(1, &ip, sizeof(INPUT));

                // Release the cast key
                ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
                SendInput(1, &ip, sizeof(INPUT));

                //if a fish has bitten...
                if (gotBite())
                {

                }

                //Make the state waiting for bite
                state = AutoFish::WaitingForBite;
                break;
            }
            case AutoFish::WaitingForBite:
            {

                //Make the state Hooked
                state = AutoFish::Hooked;
                break;
            }
            case AutoFish::Hooked:
            {

                //Make the state Casting again to recast our line
                state = AutoFish::Casting;
                break;
            }
            default:
            {
                break;
            }
        }
    }
}
コード例 #4
0
ファイル: labelit.c プロジェクト: AlainODea/illumos-gate
int
main(int argc, char **argv)
{
	int c;
	int openopt;

	strcpy(callname, argv[0]);
	for (c = 1; c < argc; c++) {
		string = argv[c];
		if (match("sysid=")) {
			sysid = string;
			continue;
		}
		if (match("volid=")) {
			volid = string;
			continue;
		}
		if (match("volsetid=")) {
			volsetid = string;
			continue;
		}
		if (match("pubid=")) {
			pubid = string;
			continue;
		}
		if (match("prepid=")) {
			prepid = string;
			continue;
		}
		if (match("applid=")) {
			applid = string;
			continue;
		}
		if (match("copyfile=")) {
			copyfile = string;
			continue;
		}
		if (match("absfile=")) {
			absfile = string;
			continue;
		}
		if (match("bibfile=")) {
			bibfile = string;
			continue;
		}
		break;
	}
	/* the last argument must be the cdrom iamge file */
	if (argc != c+1) {
		if (argc > 1)
			fprintf(stderr, "%s: Illegal option %s in input\n",
			    callname, string);
			usage();
	}

	/* open image file in read write only if necessary */
	if (argc == 2) openopt = O_RDONLY;
	else openopt = O_RDWR;

	if ((cdfd = open(argv[c], openopt)) < 0) {
		if (strchr(argv[c], '=') ||
		    strchr(argv[c], '-')) {
			usage();
		}
		sprintf(errstrng, "%s: main: open(): ", callname);
		perror(errstrng);
		exit(32);
	}

	/* check volume descriptor */
	(void) ckvoldesc();

	if (cd_type < 0) {
		fprintf(stderr, "%s: unknown cdrom format label\n", callname);
		exit(32);
	}

	/* update label, if needed */
	if (argc != 2) updatelabel();

	/* print the (updated) image label */
	prntlabel();

	close(cdfd);
	return (0);
}
コード例 #5
0
ファイル: dialog.cpp プロジェクト: njulimn/Qt
void Dialog::resizeEvent(QResizeEvent *)
{
    updatelabel();
}
コード例 #6
0
ファイル: dialog.cpp プロジェクト: njulimn/Qt
void Dialog::moveEvent(QMouseEvent *)
{
    updatelabel();
}