Thread: about windows

  1. #1
    Registered User
    Join Date
    Aug 2013

    about windows

    i have 2 questions about a Windows.
    1 - when i use the ShellExecute() for execute a program, how can i wait until the window\program is ready for i use the menu shortcuts with SendInput()?
    2 - when we change a window, maybe the window is hided and then is showed, how i can wait until the window\program is ready for change window position?

  2. #2
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Tijuana, BC, México
    For the #1, I think you need CreateProcess for monitoring the external app.
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  3. #3
    Registered User
    Join Date
    Aug 2013
    i did something like that without sucess
        lpExecInfo.cbSize  = sizeof(SHELLEXECUTEINFO);
        lpExecInfo.lpFile = strFile2.c_str(); // name of file that you want to execute/ print/ or open/ in your case Adobe Acrobat.
        lpExecInfo.hwnd = NULL;
        lpExecInfo.lpVerb = "open"; // to open  program
        lpExecInfo.lpParameters = ""; //  file name as an argument
        lpExecInfo.lpDirectory = NULL;
        lpExecInfo.nShow = SW_SHOW ;  // show command prompt with normal window size
        lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL ;   //WINSHELLAPI BOOL WINAPI result;
          //wait until a file executed
        ::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);
    when i use the GetForegroundWindow(), i get wrong HWND value

  4. #4
    Join Date
    Oct 2007
    Inside my computer
    The handle lpExecInfo.hProcess will be signalled until the application you just launched terminates.

    The short answer to your questions is that there is no solution. You can either try to wait X minutes or try to monitor the window's message queue to try to figure out when it's ready. There's just no API for this. The best way would, of course, be for the application you start to notify your program when it's ready.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Access Windows directory with OPENFILENAME in Windows mobile
    By nikhilesh1987 in forum Windows Programming
    Replies: 2
    Last Post: 05-31-2011, 02:49 AM
  2. GetDiskFreeSpace Windows API fails on windows 2000
    By dnyampawar in forum Windows Programming
    Replies: 7
    Last Post: 07-09-2009, 03:39 AM
  3. Differences between Windows XP and Windows Vista programming
    By nathan3011 in forum Windows Programming
    Replies: 3
    Last Post: 01-15-2009, 10:05 AM
  4. Open an excel file from a windows service under Windows Vista
    By AdrianaLuby in forum C# Programming
    Replies: 1
    Last Post: 06-05-2007, 03:55 AM
  5. Replies: 6
    Last Post: 01-07-2002, 02:46 AM