3 Replies Latest reply on May 21, 2018 9:05 PM by Hares Fakoor

    VB Event Handler for DWG 'skip file' dialog box

    Hares Fakoor

      I'm trying to create a batch tiffer for dwgs in VS, using .NET

       

      The drawings will be opened with a edrawings API ~

       

       

      that being said I don't need to combine anything (assemblies etc..) I just need to print each individual document ~

       

      However since this is a batch printing thing I'm trying to do, I'm wondering if there is an event handler for the dwg 'skip file' dialog box that sometimes pops up ~ otherwise it hangs here and the program basically freezes ~ any ideas to get around this? Is there a .NET/VB event handler part of CAD VB libraries that can pick up on this dialog box?

        • Re: VB Event Handler for DWG 'skip file' dialog box
          Hares Fakoor

          Any ideas are welcome ~ currently I'm thinking of a clockout time on the doc, to where if it doesn't print in x minutes to skip the file

          • Re: VB Event Handler for DWG 'skip file' dialog box
            Ulf Stockburger

            Hi Hares

             

            I have no experience with the eDrawings API, so I can't answer your question about the event handler. However, with WinAPI you can search for windows and send messages to them. If the dialog you are looking for has a unique name or is not opened by any other application, I would use this approach.

            // C#
            using System;
            using System.Runtime.InteropServices;
            using System.Threading;
            namespace Test
            {
                class Program
                {
                    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
                    private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
                    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
                    private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
                    static void Main(string[] args)
                    {
                        IntPtr hWnd = IntPtr.Zero;
                        while (hWnd == IntPtr.Zero)
                        {
                            hWnd = FindWindow(null, "dialog name");
                            if (hWnd != IntPtr.Zero)
                            {
                                SendMessage(hWnd, 0x0010, 0, 0);
                                //hWnd = IntPtr.Zero;
                            }
                            Thread.Sleep(250);
                        }
                      }
                }
            }
            

            If not, you need to verify that the dialog you want to close has been opened by the eDrawings instance. This will become more complicated. Further information about WinAPI can be found on PInvoke.net.

             

            BiI SAP-PDM

              • Re: VB Event Handler for DWG 'skip file' dialog box
                Hares Fakoor

                Hi Ulf,

                 

                Thanks for the reply.

                 

                I will certainly try this out.


                As for the skip file dialogue box, I don't think it's created by Windows, for sure it's created by EDrawings.

                 

                Basically I want to sent a large chunk of dwg files for printing to be outputted somewhere on the system, so my code will call for opening the dwg files with EDrawings, unless someone has a better idea of printing these drawings. Assemblies don't matter, I need them printed on a document level, not in any specific order, as the output will be named by document name.

                 

                That being said would anyone have ideas as to get around this dialogue box?

                 

                Basically I wouldn't mind skipping completely over the dwg files that require 'skipping files' aka navigating to the final drawing ~ I'd simply want to skip these files.

                 

                Because it isn't a windows dialogue box I'm trying to think of a way of how to write code for this.

                 

                I'm thinking that since the dialogue box is opened the doc actually isn't read into windows memory. Maybe a code that says 'if doc not read into memory within 2 minutes, skip file'

                 

                Any suggestions?