Example #1
0
        /* int GetCopyCount()
         * get how many copies need to print currently
         */
        public static int GetCopyCount()
        {
            if (_copyCountHandle != IntPtr.Zero)
            {
                try
                {
                    //get MSAA interface for copy count.
                    Win32API.AccessibleObjectFromWindow(_copyCountHandle, (int)Win32API.IACC.OBJID_CLIENT, ref Win32API.IACCUID, ref _paccCopyCount);

                    if (_paccCopyCount != null)
                    {
                        string countStr = _paccCopyCount.get_accValue(_selfID);

                        //if string is not null, convert to int, else return -1.
                        return(countStr == null ? -1 : int.Parse(countStr));
                    }
                }
                catch
                {
                    return(-1);
                }
            }

            return(-1);
        }
Example #2
0
        /* IAccessible GetIAccPrinterList()
         * get the MSAA interface for printer list.
         */
        private static IAccessible GetIAccPrinterList()
        {
            if (_printerListHandle != IntPtr.Zero)
            {
                Win32API.AccessibleObjectFromWindow(_printerListHandle, (int)Win32API.IACC.OBJID_CLIENT, ref Win32API.IACCUID, ref _paccPrintList);
                return(_paccPrintList);
            }

            return(null);
        }
Example #3
0
        /* void SetCopyCount(int number)
         * Set how many copies we need to print.
         * return true is success, else return false.
         */
        public static bool SetCopyCount(int number)
        {
            if (_copyCountHandle != IntPtr.Zero && number >= 0)
            {
                try
                {
                    //get MSAA interface for copy count.
                    Win32API.AccessibleObjectFromWindow(_copyCountHandle, (int)Win32API.IACC.OBJID_CLIENT, ref Win32API.IACCUID, ref _paccCopyCount);

                    if (_paccCopyCount != null)
                    {
                        _paccCopyCount.set_accValue(_selfID, number.ToString());
                        return(true);
                    }
                }
                catch
                {
                }
            }

            return(false);
        }