How can I create a GUI program to launch Maintenance Tools?

Discussion in 'C++' started by Panarchy, May 16, 2009.

  1. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    [​IMG]

    Any ideas on how I could create the above mockup, for real?

    I would like;

    RAM - Display shows in log (bottom) - Open display system properties
    Scheduled Tasks - Display shows in log - Open opens up the scheduled tasks control panel applet
    Backup Directory - Display show which it will go to - Open opens it up in explorer
    Check Raid - Checks if the Software RAID is healthy - Open opens up Disk Management

    I thought of the idea, then I prtscn'd the XAMPP Control Panel for the mockup.

    Please tell me if it is possible to do as shown in the mockup.

    Thanks in advance,

    Panarchy
     
    Last edited: May 16, 2009
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Its very much possible and there are API to be doing this.

    Opening Task manager can be done using just launching "taskmgr.exe"
     
  3. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Using the WinAPI?

    Alright. Well I did some research yesterday, pretty sure this includes all;

    Scheduled Tasks
    http://msdn.microsoft.com/en-us/library/aa394601(VS.85).aspx

    Disk Management
    http://support.microsoft.com/kb/300415 (CLI)
    http://msdn.microsoft.com/en-us/library/aa363986(VS.85).aspx
    OCTL_DISK_PERFORMANCE:
    http://msdn.microsoft.com/en-us/library/aa365183(VS.85).aspx

    RAM
    http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx

    My question is, how do I link all the above into a GUI program like the mockup I created before?

    Thanks in advance for any more help with this,

    Panarchy
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    What do you mean by linkup.

    All you have to do is when button is clicked launch the needed thing.
     
  5. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Sorry, I still don't understand how to do that.

    Please explain.

    Thanks in advance,

    Panarchy

    PS: Once this is finished and working perfectly, I'll put it on SourceForge or the microsoft one... codeplex?
     
  6. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    Hi Panarchy,
    --------------------------------------------------------------------------------------------------------------------------------------------
    Code:
    system("sysdm.cpl");
    --------------------------------------------------------------------------------------------------------------------------------------------
    Code:
    system("control schedtasks");
    --------------------------------------------------------------------------------------------------------------------------------------------
    Code:
    system("start \"C:\\MyBackup\"");
    (assuming your Backup dir is C:\MyBackup)
    --------------------------------------------------------------------------------------------------------------------------------------------
    Code:
    system("diskmgmt.msc");
    --------------------------------------------------------------------------------------------------------------------------------------------
    My pleasure :biggrin:
     
    Last edited: May 17, 2009
    shabbir likes this.
  7. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Thanks mate. However, here is what my current code looks like;

    Code:
    #include <windows.h>
    #include <tchar.h>
    #include <iostream>
    
    #ifdef UNICODE
    #define tcout wcout
    #else
    #define tcout cout
    #endif
    
    int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevious, LPSTR cmdline, int cmdshow) {
    
        STARTUPINFO si = {0};
        PROCESS_INFORMATION pi = {0};
        TCHAR lpCmdLine[MAX_PATH] = {0};
        ::ExpandEnvironmentStrings(_T("\"%ProgramFiles%\\Symantec\\LiveUpdate\\LUALL.exe\""),
                                  lpCmdLine, MAX_PATH);
    
        std::tcout << _T("Command line : ") << lpCmdLine << std::endl;
    
        BOOL bRet = ::CreateProcess(NULL, lpCmdLine, NULL, NULL, FALSE,
                                   CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
    
        ShellExecute(NULL, TEXT("open"), TEXT("control"), TEXT("schedtasks\0"), NULL, SW_HIDE);
        ShellExecute(NULL, TEXT("open"), TEXT("control"), TEXT("sysdm.cpl"), NULL, SW_HIDE);
        ShellExecute(NULL, TEXT("open"), TEXT("diskmgmt.msc"), NULL, NULL, SW_HIDE);
    
        {
            if( reinterpret_cast<int>(ShellExecute(NULL, "explore", "\\\\panarchy\\share", NULL, NULL, SW_SHOWNORMAL)) <= 32)
                if( reinterpret_cast<int>(ShellExecute(NULL, "explore", "D:\\BackYouUp\\", NULL, NULL, SW_SHOWNORMAL)) <= 32)
                {
                    ShellExecute(NULL, "explore", "C:\\Backups\\bac\\", NULL, NULL, SW_SHOWNORMAL);
                }
        }
    
        return 0;
    }
    Does the trick, however it could be much better. If I could programmically see if the partitions/drives are Healthy, then print whether or not it is within the textbox, that would save some time. Also, having the option to open Disk Management instead/as well as, would be very useful. Same goes for the others. For scheduled tasks, the last result field would be the one I'd be looking at. For System Properties, it would be RAM.

    Would it be possible to implement the aforementioned code within a GUI program, like the one I first mentioned?

    Even if you could just help me by getting the Open button working, I'd really appreciate it.

    Thanks in advance,

    Panarchy
     
  8. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    So, if I could please have some help with getting this to work, I'd really appreciate it.

    Thanks in advance,

    Panarchy
     
  9. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Greetings,

    I've worked out a ⅓ of the problem, to be specific, I've worked out the 'Open' button;

    Code:
    System::Diagnostics::Process::Start("diskmgmt.msc");
    Still to work out;

    - How to use System::Diagnostics::Process::Start with if & else command
    - Programming the Display button

    Please help me work those out!

    Thanks in advance,

    Panarchy
     
  10. Panarchy

    Panarchy New Member

    Joined:
    Nov 29, 2007
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice