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

2023-11-08

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

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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐

  • 一个vue项目同时兼容pc和移动端

    介绍 公司要求vue开发的项目 既有移动端又有pc端 但是移动端和pc端展示的内容不一样 同一个组件样式也不一样 移动端展示内容比pc端少 那这个时候在一个项目种怎么做的 解决方式 路由写两份 一份移动端的 一份pc端的 这两份路由地址相同
  • 使用vscode找不到Python常见包的问题

    首先明白一个概念 Python会在以下路径中搜索它想要寻找的模块 1 程序所在的文件夹 2 标准库的安装路径 3 操作系统环境变量PYTHONPATH所包含的路径 将自定义库的路径添加到Python的库路径中去 有如下两种方法 1 动态的添
  • spring 控制反转和依赖注入的简单理解

    最近在学习springboot的时候发现我对spring不能抽象说出意思 证明当时并没理解spring只是限于使用 对于刚踏入这行的毕业生这是不行的 为了养成良好的习惯 坚持将工作中的问题总结发成博客供自己观看哈哈 现在来看一个例子 创建了
  • 用Electron将web网页程序包装成桌面应用

    用Electron将web网页程序包装成桌面应用 前提 web 端页面 真的太容易一不小心关掉了 或者 标签页比较多的时候不太容易找到 所以决定快速包装一个 认识electron electron快速入门 搭建electron项目 第一步
  • MySQL数据库:SQL语句

    MySql数据库系列阅读 MySQL数据库 MySQL数据库 SQL语句 MySQL数据库 完整性约束 MySQL数据库备份与还原 MySQL数据库 编码 1 SQL概述 1 1 什么是SQL SQL Structured Query La
  • educoder 数据库

    查询CS系学生选择的课程 列出学号 课程号 成绩 select sno cno grade from Sc where Sno in select Sno from Student where Sdept CS 查询没有选C06 课程号 课
  • node连接mysql报错:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested

    NodeJs 代码 const mysql require mysql const db mysql createPool host 127 0 0 1 user root password database dbtest1 db quer
  • uni-app微信分享 自定义分享链接在iOS中不生效的问题处理

    最近使用uni app开发了一个微信小程序使用的功能 需要用到分享给微信好友的功能 如果不做如下设置的话 本身微信默认的分享只是当前页面 分享 initShare let this this var linkUrl this GLOBAL
  • 飞机大战游戏微信小程序源码

    目录 软件介绍 微信飞机大战游戏特色 源码链接 软件介绍 微信飞机大战游戏是一款十分好玩有趣的射击类型手游 游戏的操作简单玩家很容易上手 玩法也十分的有趣 具有一定的挑战性 游戏中还会不时的出现各种让你意想不到的惊喜哦 别再犹豫 一起来感受
  • Java 4-1&2、全局异常处理

    全局异常处理 注 使用Mybatis自带的异常处理 简单异常处理 用到的注解 ControllerAdvice Spring3 2提供的新注解 Controller增强器 可对controller层中被 RequestMapping 注解了
  • 解决openwrt ipk missing dependencies libpthread librt

    新版本的trunk有在ipk打包的过程中的bug 他不能自动识别SDK中已经变异的动态链接库 比如libpthread libboost这些 解决方案是修改与pakage里同级的makefile的内容 可以修改如下 主要是添加DEPENDS
  • 高斯消元法 matlab_高斯消元法解线性方程组

    假设矩阵A是一个n阶非奇异方阵 那么对于任意一个n维向量b 线性方程组Ax b有唯一的解 考虑如下方程组 我们通常为了求解它 我们把 4乘以第一行加到第二行 7乘以第一行加到第三行 然后在进行求解 这个过程就是高斯消元法 下面我们看看通过m
  • ubuntu与centos对比和应用场景(非常透彻的一篇文章)

    观点1 CentOS适用于服务器 Ubuntu则适用于个人桌面 服务器 这一点是CentOS胜 虽然它们同样是开源 免费 CentOS它的源码是来自由商业服务器Red Hat Enterprise Linux 有很多公司都是用CentOS来
  • Typora设置字体颜色的解决方案

    关于Typora设置字体颜色的解决方案 Typora无疑是一款功能强大的编辑器 但是却无法像Word和WPS一样 随意更改设置自己喜欢的颜色 本文给出的方法需要提前安装软件 AutoHotKey 下面给出详细的操作方法 安装AutoHotK
  • 财报解读:首次全口径盈利,快手深耕电商找准了发展门道?

    快手成功闯过了盈利大关 近日快手发布的Q2财报显示 其借助于电商 内循环 取得超预期成效 不仅用户数相比一季度环比净增1900万 再创新高 而且迎来了成立以来首次单季度全口径盈利 对于快手盈利能力的大幅提升 资本市场也做出积极反应 财报发布
  • 算法记录——快速判定多个数(1~1e18)是否为质数(Miller_rabin)

    质数判定 题目描述 判定输入的数是不是质数 输入格式 若干行 一行一个数 行数不超过 105 输出格式 对于输入的每一行 如果 是质数输出一行 Y 否则输出一行 N 样例 样例输入 1 2 6 9 666623333 样例输出 N Y N
  • [Mybatis]Cannot convert string '\xAC\xED\x00\x05ur...' from binary to utf8mb3

    在使用 Mybatis Plus 的 Lambda 条件查询时 报出了这个 Cannot convert string xAC xED x00 x05ur from binary to utf8mb3 错误 java UpdateWrapp
  • 期货开户水滴石穿知行合一

    上千年来 人生价值一直都在改变 唯一没有改变的就是价值本身的规律 如果从另一个角度去观察 或许会有另外一番心境 有句老话叫做后生可畏 也许后生并不可畏 真正让人可畏可敬的或许是代表一个时代的思想和精神 如果相信自己能活着 那么只要不放弃 就
  • (转载)谈SDH、MSTP、OTN和PTN的区别和联系

    http tech c114 net 169 a892299 html width 250 height 24 frameborder 0 allowtransparency true marginwidth 0 marginheight
  • BarTender.Application COM 多次调用引发后台进程数不断增加的问题

    引用文章方法测试 目前未发现问题 Closing Instance Of Bartender BarTender Support Portal seagullscientific com Closing Instance Of Barten