Results 1 to 4 of 4

Thread: Interacting with other open windows

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    9

    Resolved Interacting with other open windows

    [Background] I have created a report in Access which I need to create PDF's for each individual record that feed the report (about 5,000). I have Acrobat Distiller which I can assign as the default printer. This will create a PDF file of the report when the report is sent to be printed.

    [Problem] When I run my code (in a Module) to print, Distiller pops up a dialogue box asking for the path and filename to save the PDF file. Unfortunately, Distiller won't allow me to disable the dialogue box. So I have to sit there and hit the OK button 5,000 times.

    [Question] I need code that can: a) detect open windows, including dialogue boxes, b)feed it an event (such as filling in the path and filename in the "save as" text box), and c) "hit" the "OK" or "submit" button.

    Is this possible? Any insight will be greatly appreciated.
    Last edited by Afshin; Dec 4th, 2004 at 12:57 AM. Reason: Resolved

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Interacting with other open windows

    Welcome to the Forums.

    Do you have MS Spy++? If so you can use it to get the Window Class names
    for the distiller print dialog box. Then you could use some APIs to click the
    button for you.

    You will need FindWindow, FindWindowEx, and SendMessage APIs.

    Basically you will FindWindow for the Print dialog form window handle. Then
    you FindWindowEx to get the handles for the cbo filepath/name, and handle
    for the Ok button.

    The class name for most dialog windows is "#32770" but verify with Spy++.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    9

    Re: Interacting with other open windows

    Thanks for the reply Rob.

    I don't have SPY++ on this machine, but have access to it and will install it and give it a try next week. Will post back results then.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Interacting with other open windows

    Ok, you can find the declarations/constants at allapi.net. Download their
    API Viewer and API Guide. Search the Forums for more examples. Post if you
    run into any issues.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width