BarTender.Application COM 多次调用引发后台进程数不断增加的问题

news2024/10/6 6:44:26

引用文章方法测试,目前未发现问题.

Closing Instance Of Bartender – BarTender Support Portal (seagullscientific.com)

Closing Instance Of Bartender

FollowFollowed by one person

Legacy Poster

  • 9 years ago

Hello again,

I've got BarTender automating along nicely.......but have just discovered a problem when it comes to closing the instance of bartender.

My previous post http://forums.seagullscientific.com/index.php?/topic/2222-automating-label-printing-from-access-db-random-printers/

Shows how i get to the stage of printing out the labels i require, it's just that in the task manager, the number of bartender.exe instances keep adding up and up and up each time i use my access database to print a label.

I'm using bt.quit after each label is printed, but the bartender.exe instance is still in the task manager, and on our XP machines, this is causing them to slow down and grind to a halt.

Is there something i'm missing?

Regards

Ryan

0

 12

Comments

12 comments

Sort by 

  • Legacy Poster

    • 9 years ago

    when youve finished printing your labels make sure you are stopping the BT engine, so assuming your engine object is labelled as "engine" the following may help you  out 

                                        If engine.IsAlive Then

                                            engine.Stop(SaveOptions.DoNotSaveChanges)

                                        End If

    0

  • Legacy Poster

    • 9 years ago

    Hello,

    thanks for your reply, but i'm not sure i understand the engine part. The process that runs and won't stop is bartender.exe

    My code to initialize is

    Dim btApp As BarTender.Application

    Set btApp = CreateObject("BarTender.Application")

    Is this what you need to help out?

    Regards

    Ryan

    0

  • Legacy Poster

    • 9 years ago

    Please also note that Print Station also uses a bartender.exe process so killing all instances wouldn't be a feasible solution as we need Print Station open and running too

    Regards

    Ryan

    0

  • Legacy Poster

    • 9 years ago

    sorry i should of asked but what version of bartender are you running? as that code I supplied was for use with bartender 10 SR4 SDK integration

    Cheers,

    Scott

    0

  • Legacy Poster

    • 9 years ago

    Using Bartender 10.1 sr1

    Controlling access with VB

    Regards

    Ryan

    0

  • Legacy Poster

    • 9 years ago

    ah right, apologies ive used vb.net in 3.5 framework for my solutions. the only thing i could think is to look for a quit or close command against the object you are creating maybe? and see where that ends up. other than that I cannot really offer any more assistance sorry. 

    one thing are you using the SDK because i could provide you with the function we use in .NET to manage to instance closure after printing of labels?

    Cheers,

    Scott

    0

  • Legacy Poster

    • 9 years ago

    No i'm not i'm afraid, I dont completely understand it and we have a number of different Windows OS kicking about so it's a biut of a mission getting everything to work on each machine.

    If you have an easier guide then the white paper i'd be interested in that?

    Regards

    Ryan

    0

  • Legacy Poster

    • 9 years ago

    Like I said this is .NET based integration of the BT10 SR4 SDK but I hope it is of some use to you in finding a workable result.

    it might be worth taking another look at the SDK with the code below as it does handle the disposal of the BT instance when youve finished printing.

    'Bartender10.0
    
    'get a new bartender engine instantiated
    engine = New Engine(True)
    
    'check format has been cleared and clear if still in use.
    If format IsNot Nothing Then
       format.Close(SaveOptions.DoNotSaveChanges)
    End If
    
    'load the label into memory.
    format = engine.Documents.Open(Label.LabelDirectory & Label.LabelFormat)
    
    ' Get the printer and assign it to the format.
    format.PrintSetup.PrinterName = PrinterName
    
    Dim waitForCompletionTimeout As Integer = 10000 ' 10 seconds
    Dim oleDB As New Seagull.BarTender.Print.Database.OLEDB(Label.Database)
    oleDB.UserID = Label.DBUsername
    oleDB.SetPassword(Label.DBPassword)
    
    If format.DatabaseConnections.Count > 0 Then
       format.DatabaseConnections.SetDatabaseConnection(oleDB)
    End If
    
    ' Retrieve the QueryPrompts object.
    Dim queryprompts As Database.QueryPrompts = format.DatabaseConnections.QueryPrompts
    
    ' set the name queryprompt to the order number value.
    queryprompts("ID").Value = BoxToPrint.ToString
    
    Dim messages As Messages = Nothing
    format.Print(strApp, waitForCompletionTimeout, messages)
    
    Dim messageString As String = Constants.vbLf + Constants.vbLf & "Messages:"
    
    For Each message As Seagull.BarTender.Print.Message In messages
       messageString &= Constants.vbLf + Constants.vbLf + message.Text
    Next message
    
    If engine.IsAlive Then
       engine.Stop(SaveOptions.DoNotSaveChanges)
    End If
    
    

    Cheers,

    Scott

    0

  • Legacy Poster

    • 9 years ago

    Hello again,

    I'm still struggling to find a solution to my original post i'm afraid

    has anyone got any more input?

    Regards

    Ryan

    0

  • Legacy Poster

    • 9 years ago

    Hello again,

    I'm still struggling to find a solution to my original post i'm afraid

    has anyone got any more input?

    Regards

    Ryan

    Hey Ryan,

    New to this forum, however I've conjured up this little beauty in VBScript:

    strComputer = "."
    strProcessToKill = "bartend.exe" 
    
    SET objWMIService = GETOBJECT("winmgmts:" _
    		& "{impersonationLevel=impersonate}!\\" _ 
    		& strComputer & "\root\cimv2") 
    
    SET colProcess = objWMIService.ExecQuery _
    		("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
    
    count = 0
    FOR EACH objProcess in colProcess
    			objProcess.Terminate()
    			count = count + 1
    NEXT 
    

    0

  • Legacy Poster

    • 9 years ago

    Hello,

    Sorry for the delay, i've been off work for a couple of days

    Thanks for your reply, where would this script go? Also, would this kill all instances of BarTender as we also use PrintStation on the same machines so i'm concerned this would have an effect on that too?

    Regards

    Ryan

    0

  • Legacy Poster

    • 7 years ago

    Hello.

    I'm aware this post is old, but for future reference...

    After you do:

    btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges)
    btApp.Quit()
    

    Add line:  

    System.Runtime.InteropServices.Marshal.ReleaseComObject(btApp)
    

    And that will chase down any leftover bartend.exe processes.

    Regards,

    0

Please sign in to leave a comment.

btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges)
btApp.Quit()

Add line:  

System.Runtime.InteropServices.Marshal.ReleaseComObject(btApp)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/418378.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LLM:Vicuna 7B模型简单部署体验

0、引入1、保存权重文件到阿里云盘2、部署环境3、上传权重文件到30904、下载安装源码4.1 下载编译安装源码4.2 安装5、开始使用6、直接使用我的镜像立即开启人机对话Debug:可能的报错0、引入 随着ChatGPT的火热,科技公司们各显神通,针对大语…

设计模式之中介者模式(C++)

作者:翟天保Steven 版权声明:著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处 一、中介者模式是什么? 中介者模式是一种行为型的软件设计模式,也称为仲裁者模式,顾名思义&am…

nginx--基本配置

目录 1.安装目录 2.文件详解 2.编译参数 3.Nginx基本配置语法 1./etc/nginx/nginx.conf 2./etc/nginx/conf.d/default.conf 3.启动重启命令 4.设置404跳转页面 1./etc/nginx/conf.d/default.conf修改 ​2. 重启 5.最前面内容模块 6.事件模块 1.安装目录 # etc cd …

排序-时间复杂度

技巧:先处理 内层 一次排序,在处理外面 直接插入排序 升序 最坏(遇到降序):O(N^2) 等差数列 123…(n-1) (n^2-n)/2 最好(有序) O(N) 希尔排序 gap 任何数字/2都是1 gap/3 1 保证gap最后是1 gap是多少 就分了多少组,每组数据可能少一点&…

根文件系统移植:bulidroot根文件系统搭建详细步骤

bulidroot根文件系统 文章目录bulidroot根文件系统1.buildroot 下载2 配置 buildroot1、配置 Target options2、配置 Toolchain3、 配置 System configuration4、配置 Filesystem images5、 禁止编译 Linux 内核和 uboot6、配置 Target packages3 编译 buildroot4 buildroot 根…

第一章 计算机网络概述

计算机网络基本概念 计算机网络是计算机技术与通信技术相互融合的产物计算机网络是互连的、自治的计算机的集合 自治——互连的计算机系统彼此独立,不存在主从或者控制与被控制关系互连——利用通信链路连接相互独立的计算机系统 目前最大的、应用最广泛的计算机网…

函数栈帧的创建和销毁(带你进一步深入理解函数的执行流程)

本文主题 什么是函数栈帧? 理解函数栈帧能解决什么问题? 函数栈帧的创建和销毁解析 1. 什么是函数栈帧 ? 我们在写C语言代码的时候,经常会把一个独立的功能抽象为函数,所以C程序是以函数为基本单位的。 那函数是如何…

人人都是数据分析师-数据分析之数据图表可视化(上)

BI报表、运营同学的汇报报告中数据图表大多为 表格、折线图、柱状图和饼图,但是实际上还有很多具有代表性的可视化图表,因此将对常见的可视化图表进行介绍,希望这些图表可视化方法能够更好的提供数据的可用性。 导语 数据是我们在数据分析工…

通过1个IP地址同时采集2台西门子S7200 Smart的数据

一、应用场景 制药厂的颗粒包装机,控制系统由2台西门子S7200 Smart的PLC和1台昆仑通泰MCGS的触摸屏组成。现在MES管理系统,需要采集设备的数据,只提供一个IP地址,且IP地址和原系统不在同一个网络段内。 二、原系统架构 2台西门子S…

浅析DNS Rebinding

0x01 攻击简介 DNS Rebinding也叫做DNS重绑定攻击或者DNS重定向攻击。在这种攻击中,恶意网页会导致访问者运行客户端脚本,攻击网络上其他地方的计算机。 在介绍DNS Rebinding攻击机制之前我们先了解一下Web同源策略, Web同源策略 同源策略…

智慧校园人员定位系统解决方案

人员定位是安全管理中最重要的一个环节,尤其是石化、矿业、电力、建筑等高危行业,人员安全管理更是重中之重,除了工业领域,其它领域也需要人员安全管理,比如:学校、医院、养老院、物业、环卫等。下面我们以…

SpringSecurity之基本原理——过滤器加载过程

前言 前一篇讲解了SpringSecurity的过滤器链的基本只是,今天我们就要进入过滤器,看看其加载过程是如何的? 相信认真度过第一篇文章的小伙伴还记得,我说在SpringBoot出现后,帮助我们省去了那些繁琐的配置,…

2023年MathorCup数模A题赛题

A 题 量子计算机在信用评分卡组合优化中的应用 在银行信用卡或相关的贷款等业务中,对客户授信之前,需要先通过 各种审核规则对客户的信用等级进行评定,通过评定后的客户才能获得信 用或贷款资格。规则审核过程实际是经过一重或者多重组合规则…

树的直径问题

一,定义 树的直径就树中所有最短路经距离的最大值 求取树的直径可以使用两遍dfs或者树形dp获得 二,两遍dfs获得树的直径(注意,该方法边权必须都为正边权) 思路: 我们首先任取一点走dfs,然后…

索引:索引知识重复习,什么是索引、索引的类型、建立索引及【最左匹配原则】、Explain查看sql的执行计划

文章目录什么是索引索引的类型主键索引(primary key)普通索引(index)复合索引全文索引(fulltext)空间索引唯一索引索引修改及删除Explain一、using filesort(减慢查询效率)二、Using temporary三、using in…

TensorFlow 1.x学习(系列二 :3):变量与tensorboard可视化

文章目录1.变量2.可视化学习 Tensorboard3.可视化过程中遇到的问题:import tensorflow as tf1.变量 变量op: 变量也是一种OP,是一种特殊的张量,能够进行存储持久化,它的值就是张量,默认被训练和常量不同(…

15个 AI-powered应用,加速学术写作和阅读

文章目录写作方面1.Jenni AI(推荐)2.Paperpal阅读方面3.Schoarlcy4.chatpdf5.Casper6.SciSpace(推荐)文献管理/写论文笔记用7.lateral8. ClioVis9.Glasp10. Audiopen学术目的的搜索引擎11. Consensus(推荐)…

【私有云盘】搭建PHP轻量文件管理器 - TinyFileManager「公网远程访问」

文章目录前言1. Tiny File Manager网站搭建1.1.Tiny file manager下载和安装1.2.Tiny file manager网页测试2. Cpolar内网穿透的安装和注册2.1 本地网页发布2.2 Cpolar云端设置2.3 Cpolar本地设置3. 公网访问测试4. 结语前言 文件共享和查阅是现在网络最常见的应用场景&#x…

windows环境nodejs卸载与安装

windows环境nodejs卸载与安装一、卸载1.1 控制面板卸载程序1.2 手动清理相关文件夹二、安装2.1 下载安装包2.2 安装操作2.3 验证安装是否成功2.4 环境变量设置2.4.1 node程序添加到系统环境变量PATH2.4.2 修改全局模块下载路径2.4.2.1 node_global路径变量2.4.2.2 node_modules…

Docker应用部署

文章目录Docker 应用部署一、部署MySQL二、部署Tomcat三、部署Nginx四、部署RedisDocker 应用部署 一、部署MySQL 搜索mysql镜像 docker search mysql拉取mysql镜像 docker pull mysql:5.6创建容器,设置端口映射、目录映射 # 在/root目录下创建mysql目录用于存…