I have a game called Mahjongg, basically it a game that have tiles and you have to match them.So I want to try to make a bot that will match the tiles himself.I need to hook the location of the tiles on the screen and make a loop for the matching thing.The game for windows and probably doesn't use directX just the windows API but I'm not sure about it.How do I hook it? is there build function in windows?

The easiest methods to hook into an application like a game (in Windows) include COM, OLE, and Windows API functions. However since it's a graphical matching game, you'll likely need to build a screen reader as well in order to match the graphics. Though these are the easiest methods for doing this, in many cases they are far from easy, and if you don't already have the API memorized, you're going to need to look up a lot of info and digest it, as well as play around until you find a solution. One tool I might suggest you try is called AutoHotKey. It is basically an automation tool, though it also hooks into Windows as a hot-key device. Read the documentation and use the object spy that comes with it. You can use it to write scripts. The source code is also available on the site for free so you could look into that as well.

However since it's a graphical matching game, you'll likely need to build a screen reader as well in order to match the graphics.

I think you don't need to match by the graphics.Now what about the memory the maps files set only the location of the tiles, the tiles themselves are random. Shouldn't the exist somewhere in the memory?Can you give me some information about those three (include COM, OLE, and Windows API functions)

I can't answer you COM, OLE, Windows API question just yet, but I can answer your question about code. When you are using the iostream functions cin and cout (which are actually C++ objects), that code must be statically compiled, because iostream is a special library that is part of C++, not the operating system. With your Windows program, that code uses external DLL files for the Windows API calls to create the window, so naturally because it dynamically links to a part of the operating system, it is smaller in size, ultimately just a few API calls. Now you can compile with optimizations either for size or speed. With g++ and gcc (C only compiler) you can use the -Ox switch where x is an optional number 1 to 4, where you can optimize for speed or size, but they don't give you much. In general you will always see that object-oriented code is larger than structured code once compiled, but also you should always see that dynamically linked code is smaller than statically linked code.

With -O2 I was able to reduce your compiled code from 488,653 b to 488,000 b.

The reason of the size difference is because when you #include <iostream> you link your .exe to the iostream library, making its bigger.the <windows.h> is much smaller because of its adaptation to the windows OS.btw, C is much better

This is a matter of opinion, which should be construed as such. Some languages are better for individual purposes more so than the idea that one language is better overall. C does not provide some of the constructs that enable programmers to more quickly solve a problem. Also the creator of C++, Bjarne Stroustrup, stated that "C++ is a better C". Chapter and verse my friend. I've never heard any source to the idea that C is overall better. This kind of thing should be viewed as very subjective in any case, i.e. Java/Python/Ruby/etc. is better is not fact, unless it is qualified by in what ways and when. It's simply not helpful.

I tried art-money, and i was able to change the score.In the game you have pearls with them you can get hint and undo and and mix, I tried to find it and change it, but I wasn't sure that it was the right one because when i changed it, it just return the previous value. then I tried another game track-mania, this time I found the value of the km that i drove but i couldn't change it(it change to value, but a second later the previous value was reloaded ). what could be the problem maybe i found the pointer or something like that