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

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 Thenformat.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 = PrinterNameDim 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 Thenformat.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.ToStringDim 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 messagesmessageString &= Constants.vbLf + Constants.vbLf + message.Text
    Next messageIf engine.IsAlive Thenengine.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 colProcessobjProcess.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)

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

  1. gc --JNI调用引发的长gc问题

    [GC (GCLocker Initiated GC) 2022-02-16T12:14:20.890+0800: 494843.997: [ParNew: 482593K->398863K(6 ...

  2. jvm性能调优实战 -55RPC调用引发的OOM故障

    文章目录 Pre 系统架构介绍 故障发生现场 初步查找内存溢出的故障发生点 分析内存快照找到占用内存最大的对象 通过分析源代码找出原因 铺垫一个关键知识点:RPC框架的类定义 RPC框架的一个bug: ...

  3. Spring中事务内部调用引发的惨案

    在一个类内部有2个方法foo和bar,其中bar方法配有注解(@Transactional),即bar是事务执行的,而foo不是事务执行,当foo方法内部调用bar方法后,bar方法的事务是不生效的. ...

  4. 教你在Nodejs中如何获取当前函数被调用的行数及文件名

    苏格团队 作者:MaxPan 交流QQ群:855833773 背景 在自定义Egg.js的请求级别日志这篇文章中,我们实现了自定义请求级别的日志模块.看上去功能是完整了,但好像还缺点什么. 大家在根据 ...

  5. c 科学计算机 优先级计算,北邮上机复试 科学计算器 —— 由编译器的不同引发的数十次 WA,最后终于AC——总结...

    北邮的上机复试环境用的是标准c/c++,而我从大一开始就用vc6.0,很痛苦的出现了很多不同情况.今天用DEV c++解决了一些问题,总结一下. 1. gets() 和 scanf() gets() ...

  6. html每页显示条数,在网页代码中设置调用显示条数

    123456qqq 如果控制不了服务器想客户端js控制用这个 {"onlinetime":"2018-06-26 23:50:02","onlinen ...

  7. 14x1.5cm竖向标签有点难,VFP调用BarTender来打印

    测试环境说明: WIDNOWS 10 64bit PRO(低版本无法安装BarTender2022) 打印机 佳博GP-1324D VFP9 SP2 7423 这个软件用来打标签是真不错,很好上手. ...

  8. winform遍历bartender_C# 调用Bartender服务并打印bartender标签

    之前公司标签一直用ZPL开发,前段时间公司购买了bartender软件用于标签设计.功能大大的,没得说.废话少说了,进入正题. 需求:标签模板已经设计好,设计个简单程序调用该标签模板并打印.(标签变量 ...

  9. 【C#】C#调用Bartender模板打印

    Bartender版本:Bartender 2016(11.0.7.3.3146) Bartender下载 http://www.ddooo.com/softdown/142454.htm 或 链接: ...

最新文章

  1. iOS 关于第三方键盘
  2. Jquery页面加载效果
  3. python分配buffer_Node.js中的buffer如何和python中的buffer相对应
  4. php 设置返回的类型是图片,PHP检查上传的图片并返回图片的真正类型【扩展名】...
  5. node连接--MySQL
  6. 问答知识图谱还缺少什么信息?
  7. 决策树C4.5算法对ID3算法的改进
  8. 64位 mxcomponent_三菱MX Component 4.16S下载
  9. 我为什么要写《OpenCV Android 开发实战》这本书
  10. 分享一波恋爱社交APP源码,真好~
  11. flex实现四个元素分布在盒子的四个角
  12. jay chou歌词 文本下载数据下载
  13. windows中删除设备和驱动器中的其他软件图标
  14. C语言——从字符串中统计单词的频数
  15. 爬取网络数据到excel表
  16. @用Python的turtle库画一个奥运五环!
  17. 2018-2019-2 网络对抗技 20165328 Exp7: 网络欺诈防范
  18. 使用frp配置内网机器访问
  19. fiddler工具使用大全(全网最详细)
  20. association内属性及作用

热门文章

  1. 2021年兰州师大附中高考成绩查询,2021年兰州高中学校排名及录取分数线排名
  2. 2021年重庆各中学高考成绩查询,2021年重庆市重点高中详细排名
  3. LOJ #2878. 「JOISC 2014 Day2」邮戳拉力赛 动态规划+括号序列
  4. 仿Windows记事本简要分析 (Java)
  5. 【碎片知识(9)】PCA (Principal Component Analysis) [主成分分析]
  6. 古今智慧:一只兔子吃掉了狼和野猪
  7. 传说她是中国科技大学校花
  8. 寒冷的冬天在屋里看电视剧 2020.12.13日记
  9. ACM MM 2023截止时间
  10. 可在广域网部署运行的QQ高仿版 -- GG叽叽V1.8(源码)