2007-06-27

GETPICT() with thumbnails

I've seen in many forums people asking about the possibility to open the getpict() dialog showing thumbnails instead of picture file names.

Just for fun, I did some tests simulating some keystrokes, and it works ! Save the 3 lines below in a PRG and run under WinXP:


oShell = CREATEOBJECT("Wscript.Shell")
oShell.SendKeys("{TAB}{TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
GETPICT()



The SendKeys function from WSH was used - at this link you can find all key codes, if you want to use this technique for any other purpose: http://msdn2.microsoft.com/en-us/library/system.windows.forms.sendkeys(vs.71).aspx

This was tested only in my working machine, under winxp professional. it probably does not work this way in other OS's so be careful, and if you want to use this code, check this first.

I'm almost sure that there must be another way, probably safer to do that. Do you know any?

4 comments:

  1. Christophe ChenavierJune 27, 2007 at 5:49 AM

    Hi Cesar,

    Here is not another way, just a smaller path :
    oShell.SendKeys("+{TAB}+{F10}{DOWN}{ENTER}{ENTER}")
    Thanks Christophe !

    ReplyDelete
  2. Brilliant. In it is the simplicity.

    Thanks.

    Koen

    ReplyDelete
  3. Even Microsoft seems to recommend this kind of workaround to change some dialogs behavior, see this KB:


    The Insert Picture dialog box in Office XP programs always opens in Thumbnails view

    http://support.microsoft.com/kb/301459

    ReplyDelete
  4. Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2471

    GETPICT() con miniaturas

    ReplyDelete