Thread: doing stuff with mspaint

  1. #1
    Registered User
    Join Date
    Jun 2004

    doing stuff with mspaint

    i am trying to get mspaint to show the 'open' dialog..

    	HWND hpaint = FindWindow("MSPaintApp",0);
    what is wrong? it works fine when i use "notepad" as the cmd line, "Notepad" as the class and 2 as the menu option id.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    It is unlikely that Paint has enough time to load before you call FindWindow(). You probably just got "lucky" with Notepad due to its small size and simplicity.

    The proper way to go would be to use CreateProcess() (Search board for examples) followed by WaitForInputIdle(). If you want a very quick and dirty solution for testing, you could just add a Sleep(500); after the call to WinExec().

  3. #3
    Registered User
    Join Date
    Jun 2004
    aha, you are correct. thanks.
    i also got "lucky" with calculator then..
    and CreateProcess() is such a behemoth of a function.
    Last edited by ZeroG; 10-03-2004 at 08:01 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tab key stuff. C+WinAPI is killing me. Please help.
    By Templario in forum Windows Programming
    Replies: 5
    Last Post: 11-21-2002, 03:35 PM
  2. arguments, directories and stuff...
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 06-26-2002, 05:46 PM
  3. Your stuff
    By smog890 in forum C Programming
    Replies: 6
    Last Post: 06-13-2002, 11:50 PM
  4. Linked lists and file i/o, and some other stuff
    By ninja in forum C++ Programming
    Replies: 9
    Last Post: 05-19-2002, 07:15 PM
  5. Stocks 'n' stuff...
    By Cheeze-It in forum A Brief History of
    Replies: 2
    Last Post: 09-20-2001, 05:36 PM