Click here to Skip to main content
15,845,598 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNeed help of how to execute SQL update query in VC++ Pin
John5025-Nov-09 1:01
John5025-Nov-09 1:01 
AnswerRe: Need help of how to execute SQL update query in VC++ Pin
Code-o-mat5-Nov-09 1:15
Code-o-mat5-Nov-09 1:15 
AnswerRe: Need help of how to execute SQL update query in VC++ Pin
Anil Kumar.Arvapalli5-Nov-09 2:33
Anil Kumar.Arvapalli5-Nov-09 2:33 
QuestionRe: Need help of how to execute SQL update query in VC++ Pin
David Crow5-Nov-09 4:52
David Crow5-Nov-09 4:52 
QuestionWCHAR and system() call? Pin
Souldrift5-Nov-09 0:57
Souldrift5-Nov-09 0:57 
AnswerRe: WCHAR and system() call? Pin
Souldrift5-Nov-09 1:06
Souldrift5-Nov-09 1:06 
QuestionArgument passing Pin
bhavik14865-Nov-09 0:46
bhavik14865-Nov-09 0:46 
AnswerRe: Argument passing Pin
Kushagra Tiwari5-Nov-09 1:02
Kushagra Tiwari5-Nov-09 1:02 
Use this function which does CreateProcess with the parameter u want
size_t ExecuteProcess(std::wstring FullPathToExe, std::wstring Parameters, size_t SecondsToWait)
{
    size_t iMyCounter = 0, iReturnVal = 0, iPos = 0;
    DWORD dwExitCode = 0;
    std::wstring sTempStr = L"";

    /* - NOTE - You should check here to see if the exe even exists */

    /* Add a space to the beginning of the Parameters */
    if (Parameters.size() != 0)
    {
        if (Parameters[0] != L' ')
        {
            Parameters.insert(0,L" ");
        }
    }

    /* The first parameter needs to be the exe itself */
    sTempStr = FullPathToExe;
    iPos = sTempStr.find_last_of(L"\\");
    sTempStr.erase(0, iPos +1);
    Parameters = sTempStr.append(Parameters);

     /* CreateProcessW can modify Parameters thus we allocate needed memory */
    wchar_t * pwszParam = new wchar_t[Parameters.size() + 1];
    if (pwszParam == 0)
    {
        return 1;
    }
    const wchar_t* pchrTemp = Parameters.c_str();
    wcscpy_s(pwszParam, Parameters.size() + 1, pchrTemp);

    /* CreateProcess API initialization */
    STARTUPINFOW siStartupInfo;
    PROCESS_INFORMATION piProcessInfo;
    memset(&siStartupInfo, 0, sizeof(siStartupInfo));
    memset(&piProcessInfo, 0, sizeof(piProcessInfo));
    siStartupInfo.cb = sizeof(siStartupInfo);

    if (CreateProcessW(const_cast<LPCWSTR>(FullPathToExe.c_str()),
                            pwszParam, 0, 0, false,
                            CREATE_DEFAULT_ERROR_MODE, 0, 0,
                            &siStartupInfo, &piProcessInfo) != false)
    {
         /* Watch the process. */
        dwExitCode = WaitForSingleObject(piProcessInfo.hProcess, (SecondsToWait * 1000));
    }
    else
    {
        /* CreateProcess failed */
        iReturnVal = GetLastError();
    }

    /* Free memory */
    delete[]pwszParam;
    pwszParam = 0;

    /* Release handles */
    CloseHandle(piProcessInfo.hProcess);
    CloseHandle(piProcessInfo.hThread);

    return iReturnVal;
} 

AnswerRe: Argument passing Pin
CPallini5-Nov-09 1:49
mveCPallini5-Nov-09 1:49 
QuestionExe Initialization Pin
002comp4-Nov-09 23:34
002comp4-Nov-09 23:34 
AnswerRe: Exe Initialization Pin
Michael Schubert5-Nov-09 0:00
Michael Schubert5-Nov-09 0:00 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 0:51
002comp5-Nov-09 0:51 
AnswerRe: Exe Initialization Pin
Covean5-Nov-09 0:11
Covean5-Nov-09 0:11 
AnswerRe: Exe Initialization Pin
Rajesh R Subramanian5-Nov-09 0:26
professionalRajesh R Subramanian5-Nov-09 0:26 
AnswerRe: Exe Initialization Pin
Kushagra Tiwari5-Nov-09 0:34
Kushagra Tiwari5-Nov-09 0:34 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 0:50
002comp5-Nov-09 0:50 
GeneralRe: Exe Initialization Pin
Kushagra Tiwari5-Nov-09 0:54
Kushagra Tiwari5-Nov-09 0:54 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 1:13
002comp5-Nov-09 1:13 
AnswerRe: Exe Initialization Pin
Kushagra Tiwari5-Nov-09 1:29
Kushagra Tiwari5-Nov-09 1:29 
GeneralRe: Exe Initialization Pin
Michael Schubert5-Nov-09 6:34
Michael Schubert5-Nov-09 6:34 
AnswerRe: Exe Initialization Pin
Richard MacCutchan5-Nov-09 3:28
mveRichard MacCutchan5-Nov-09 3:28 
AnswerRe: Exe Initialization [modified] Pin
2249175-Nov-09 11:35
2249175-Nov-09 11:35 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 19:35
002comp5-Nov-09 19:35 
Questionvirtual member Pin
khomeyni4-Nov-09 22:01
khomeyni4-Nov-09 22:01 
AnswerRe: virtual member Pin
CPallini4-Nov-09 22:29
mveCPallini4-Nov-09 22:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.