Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNeed help of how to execute SQL update query in VC++ Pin
John5025-Nov-09 0:01
John5025-Nov-09 0:01 
AnswerRe: Need help of how to execute SQL update query in VC++ Pin
Code-o-mat5-Nov-09 0:15
Code-o-mat5-Nov-09 0:15 
AnswerRe: Need help of how to execute SQL update query in VC++ Pin
Anil Kumar.Arvapalli5-Nov-09 1:33
Anil Kumar.Arvapalli5-Nov-09 1:33 
QuestionRe: Need help of how to execute SQL update query in VC++ Pin
David Crow5-Nov-09 3:52
David Crow5-Nov-09 3:52 
QuestionWCHAR and system() call? Pin
Souldrift4-Nov-09 23:57
Souldrift4-Nov-09 23:57 
AnswerRe: WCHAR and system() call? Pin
Souldrift5-Nov-09 0:06
Souldrift5-Nov-09 0:06 
QuestionArgument passing Pin
bhavik14864-Nov-09 23:46
bhavik14864-Nov-09 23:46 
AnswerRe: Argument passing Pin
Kushagra Tiwari5-Nov-09 0:02
Kushagra Tiwari5-Nov-09 0: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 0:49
mveCPallini5-Nov-09 0:49 
QuestionExe Initialization Pin
002comp4-Nov-09 22:34
002comp4-Nov-09 22:34 
AnswerRe: Exe Initialization Pin
Michael Schubert4-Nov-09 23:00
Michael Schubert4-Nov-09 23:00 
GeneralRe: Exe Initialization Pin
002comp4-Nov-09 23:51
002comp4-Nov-09 23:51 
AnswerRe: Exe Initialization Pin
Covean4-Nov-09 23:11
Covean4-Nov-09 23:11 
AnswerRe: Exe Initialization Pin
Rajesh R Subramanian4-Nov-09 23:26
professionalRajesh R Subramanian4-Nov-09 23:26 
AnswerRe: Exe Initialization Pin
Kushagra Tiwari4-Nov-09 23:34
Kushagra Tiwari4-Nov-09 23:34 
GeneralRe: Exe Initialization Pin
002comp4-Nov-09 23:50
002comp4-Nov-09 23:50 
GeneralRe: Exe Initialization Pin
Kushagra Tiwari4-Nov-09 23:54
Kushagra Tiwari4-Nov-09 23:54 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 0:13
002comp5-Nov-09 0:13 
AnswerRe: Exe Initialization Pin
Kushagra Tiwari5-Nov-09 0:29
Kushagra Tiwari5-Nov-09 0:29 
GeneralRe: Exe Initialization Pin
Michael Schubert5-Nov-09 5:34
Michael Schubert5-Nov-09 5:34 
AnswerRe: Exe Initialization Pin
Richard MacCutchan5-Nov-09 2:28
mveRichard MacCutchan5-Nov-09 2:28 
AnswerRe: Exe Initialization [modified] Pin
2249175-Nov-09 10:35
2249175-Nov-09 10:35 
GeneralRe: Exe Initialization Pin
002comp5-Nov-09 18:35
002comp5-Nov-09 18:35 
Questionvirtual member Pin
khomeyni4-Nov-09 21:01
khomeyni4-Nov-09 21:01 
AnswerRe: virtual member Pin
CPallini4-Nov-09 21:29
mveCPallini4-Nov-09 21: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.