Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Getting information from another program
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Getting information from another program

Scheduled Pinned Locked Moved General and Desktop
17 Posts 3 Posters 5.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #8

    [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.

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #9

      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

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #10

        [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

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #11

          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)!

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #12

            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.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #13

              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)

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #14

                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.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #15

                  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...

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #16

                    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.

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #17

                      Thank you. It's working with QTimer

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved