[SOLVED] Getting information from another program
-
Hello, I am using one program (bot for one game) which is developed with VS2010 and using Qt as GUI... I would like to create application that will take informations from this bot (as shown below on image) and show them in my application... How can I do that??? What functions to use??? I am newbie at programming...
Thanks
-
If the information you are giving above is the only information you have there is no possibility to do what you intend.
You need to know if the programmers of the game have taken precautions for such an information exchange. A special interface or something you can tap in.
Or, you need to have the source code of the game and can prepare the application for such an information exchange.
-
That depends entirely on how the bot is written.
-
No no... This is not game... This program communicate with game and taking informations, I would like to take informations from this program not game... So this program has already taken informations from game and wrote them in this tab above, and I would like to take this informations from program and use them in mine... This program would be opened when mine would taking informations ...
-
This bot is developed in C++ using Microsoft Visual Studio 2010 Ultimate and Qt Designer... Thats what I know so far... I can get some information from bot programmer, but not much...
EDIT: So, I asked him how can I access these informations and he said I can do it using ReadProcessMemory() ...
-
google brings up "this information":http://msdn.microsoft.com/en-us/library/windows/desktop/ms680553(v=vs.85).aspx
Frankly, if you are starting programming this is "a bit" beyond the point where one should start learning programming.
-
I am not really starting.... I have some basic knowledge...
-
[quote author="Anonymous" date="1375891071"] How can I do that??? What functions to use??? I am newbie at programming...
[/quote]No offence. Just wanted to make sure that you are aware what you are up to.
-
Yeah... So far I know only console ... Now moved to GUI and thats not even close to console... I have no idea how to connect buttons, textboxes with actual code...
So, I wrote function for getting informations from game (could not find bot pointer base... but thats cool as well)... I wrote it in C++ with VS2012... Now I would like to use that in Qt designer... Actually I decided to use Qt Creator instead of VS2012...
@
#include "stdafx.h"
#include <windows.h>
#include <iostream>using namespace std;
int main()
{
DWORD address = 0x0114EFCC;
int value = 0;
DWORD pid;
HWND hwnd;
hwnd = FindWindow(NULL,L"[Norma] Ice_Snow");
if(!hwnd)
{
cout <<"Window not found!\n";
cin.get();
}
else
{
GetWindowThreadProcessId(hwnd,&pid);
HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,pid);
if(!phandle)
{
cout <<"Could not get handle!\n";
cin.get();
}
else
{
while(1)
{
ReadProcessMemory(phandle,(void*)address,&value,sizeof(value),0);
cout << value << "\n";
Sleep(1000);
}
return 0;
}
}
}@So here is my function... Now I wanna know how to write it in Qt... What I want is to have a text box which will print out result of this function... Also I'd like to know how can I add functions to buttons... For example to have a button and want it to execute a function, if else statements...
I saw many tutorials but none of them really explain how to add function to button
-
[quote author="Anonymous" date="1375971635"]
So, I wrote function for getting informations from game (could not find bot pointer base... but thats cool as well)... I wrote it in C++ with VS2012... Now I would like to use that in Qt designer... Actually I decided to use Qt Creator instead of VS2012...
[/quote]Qt creator on its own is "only" an IDE. So you can substitute the VS2012 IDE with Qt creator. However, VS2012 has also a compiler and debugger acting the background.
Qt creator requires a tool chain. On windows to can use either MinGW tool chain or you can use the VS2012 compiler as tool chain.
You need to make up your mind what you like to use. Some people are both tool chains in parallel with creator.[quote author="Anonymous" date="1375971635"]
@
#include "stdafx.h"
#include <windows.h>
#include <iostream>using namespace std;
int main()
{
DWORD address = 0x0114EFCC;
int value = 0;
DWORD pid;
HWND hwnd;
hwnd = FindWindow(NULL,L"[Norma] Ice_Snow");
if(!hwnd)
{
cout <<"Window not found!\n";
cin.get();
}
else
{
GetWindowThreadProcessId(hwnd,&pid);
HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,pid);
if(!phandle)
{
cout <<"Could not get handle!\n";
cin.get();
}
else
{
while(1)
{
ReadProcessMemory(phandle,(void*)address,&value,sizeof(value),0);
cout << value << "\n";
Sleep(1000);
}
return 0;
}
}
}@So here is my function... Now I wanna know how to write it in Qt... What I want is to have a text box which will print out result of this function... Also I'd like to know how can I add functions to buttons... For example to have a button and want it to execute a function, if else statements...
I saw many tutorials but none of them really explain how to add function to button[/quote]
You have a couple of windows API calls above. Some of them you might have to keep. However, that is outside of my experience. So I am not sure what recommend here.
Within the GUI typically the signals and slots are used to connect buttons to functions (methods). Probably the best for you would be to check "some of examples.":http://qt-project.org/doc/qt-5.1/qtwidgets/examples-dialogs.html The key thing to watch out are the "signal and slots":http://qt-project.org/doc/qt-5.0/qtcore/signalsandslots.html
-
Hey... I think I will use Qt only for now... Mixing Qt and VS will bring me only headache at this moment... How can I get design in Qt like this one above ??? I can get it with MFC in VS, but how in Qt???
!http://i1-win.softpedia-static.com/screenshots/AVG-Free-Edition_1.png?1375191993(AVG)!
-
I have done a bit of MFC ages ago. When starting with Qt I found it more intuitive than MFC.
The best thing to start is installing an SDK from the download page. Since you like to push MS you should install through this "online installer":http://download.qt-project.org/official_releases/online_installers/qt-windows-opensource-1.4.0-x86-online.exe
Note, it will probably also recognize when you have MSVC installed and show it as a tool chain in Qt creator. However, you do not have to bother about this.
Using only Qt is not possible, since Qt does not have a compiler. However, it helps you to get MinGW, which is basically the Gnu-C++ compiler, installed. So you have to make sure to install this as tool chain and the Qt libs for MinGW.
The SDK delivers also quite a number of example ready to run respectively to compile and run. They assemble also the way together with the Qt tutorials for your starting point.
-
I have already installed MSVS2012 and Qt (I downloaded this one and installed Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB))...
bq. The SDK delivers also quite a number of example ready to run respectively to compile and run. They assemble also the way together with the Qt tutorials for your starting point.
Sorry, I don't really know what are you talking about here... I am new with Qt and I'd like to know how to make design like on picture above... So I told you what I have installed on my PC, now I need further steps... I tried all possible things with QtWidget, QtQuick but none of them actually change main windows look... It always run windows 8 style (I am using Windows 8)
-
If you do not want to use msvc at all you need to install Qt libs for MinGW. The link above is leading you to the installer which allows you install the MinGW version.
When you have already installed Qt libs for MSVC2012 you can use this as well. However, you need to install at least the express version of MSVC2012, because you need its compiler. If you have done that already, you should be suited to start.
In the setup of Qt libs something like <...>/5.1.0/<msvc2012 or similar> there are a couple of folders
@
09.08.2013 17:29 <DIR> bin
30.07.2013 17:26 <DIR> doc
30.07.2013 17:22 <DIR> examples
30.07.2013 17:20 <DIR> imports
30.07.2013 17:22 <DIR> include
30.07.2013 17:22 <DIR> lib
30.07.2013 17:20 <DIR> mkspecs
30.07.2013 17:20 <DIR> phrasebooks
30.07.2013 17:22 <DIR> plugins
30.07.2013 17:22 <DIR> qml
30.07.2013 17:22 <DIR> translations
@
The examples folder contains all examples. IIRC there are no compiled examples yet, but you compile them all or individually. The examples folder or any of its subfolders contain file <something>.pro. These are project files which you can load into creator. Compile them and try them out.[quote author="koahnig" date="1375980854"]
Within the GUI typically the signals and slots are used to connect buttons to functions (methods). Probably the best for you would be to check "some of examples.":http://qt-project.org/doc/qt-5.1/qtwidgets/examples-dialogs.html The key thing to watch out are the "signal and slots":http://qt-project.org/doc/qt-5.0/qtcore/signalsandslots.html[/quote]In this quote you have already the links to the documentation of the examples.
-
Hello again... I used code above and it's working fine... But my problem is it only execute when button is clicked (thats how I tested it)... So when button is clicked code execute and display result in label... But what I'd like to do is when I run program, execute code and show result in label (without pressing button)... I can't find onLoad function or something like that for label...
-
You might be able to solve the problem with "QTimer":http://qt-project.org/doc/qt-5.0/qtcore/qtimer.html and checking when information is available. At least this helps you get rid of pressing the button. At least that is the first coming to my mind. Other solutions might be possible as well.
-
Thank you. It's working with QTimer