Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ memory and graphics

Status
Not open for further replies.

Yoshistr

Programmer
Jan 20, 2006
1
0
0
US
I have just started in C++ .net and need to know if it is the best programming language for building software applications with high graphic needs. I have build some nice c# programs but heard that c++ is harder to manage due to memory handling. I plan on reading memory of the graphics displayed on the desktop to automate tasks which the user preforms. For example when I visit a java applet game online I would like the program to notice the window's title and start to read what is being show on the screen using the memory access I believe c++ has, then simulate clicks and mouse movement. I can achieve two of these tasks in C# but I need access to memory which displays graphics. I was wondering if you have come across this type of problem and know any resources which can be useful. Sorry if this post is rudamentary or redundant. I know nothing about memory updating since C# has a garbage collector, and I don't know what pointers(*) are.
 
If you want automatic garbage collection in C++, use managed code. I find it a painful, non-standard M$ invention but others think differently. Some love it, but I believe that you should clear up your own garbage instead of littering the floor assuming the local council will do it for you.

You can't access the screen memory because every graphics card is different. Try copying from screen to bitmap and then analyze the bitmap.

Is reading the screen the correct way to go about it? You can't just assume that a certain font of a specified size is used. The user can use any font in any size or colour. Your program is going to have a hard time just reading the title. Some don't even have titles.
 
Also, if you don't want to use managed code, you can use the next best thing by using STL auto_ptr's or BOOST smart pointers. They will work more or less like regular pointers, but when they go out of scope, they automatically delete themselves.
 
> I can achieve two of these tasks in C# but I need access to memory which displays graphics
Can't you just get a graphics (or device) context for the desktop / screen / window and then use something like read pixels in that context.

These are standard windows API calls, and I'd be somewhat surprised if that API wasn't also in C#

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top