Hello Everyone.

Thanks for all your help over the topics.

Here's an update;

I fixed the command-prompt window from appearing by installing Code::Blocks on an XP virtual machine, creating a new project (Win32 GUI) with Dialogue Based (or something).
As far as I can tell, all this added was a #include "resource.h" line.

I have also gotten the %programfiles% thing fixed up as well.

#include <windows.h>
#include <tchar.h>
#include <iostream>

#ifdef UNICODE
#define tcout wcout
#define tcout cout

int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevious, LPSTR cmdline, int cmdshow) {

    STARTUPINFO si = {0};
    TCHAR lpCmdLine[MAX_PATH] = {0};
                              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("explorer"), TEXT("\\Panarchy\\share"), NULL, SW_HIDE);
    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);

    return 0;

Works perfectly now.

One final question, how do I give the program an icon within Code::Blocks?

Please reply.

Thanks in advance,


Last edited by Panarchy; 22Apr2009 at 18:22..