几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 10:09 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】question about input boxes

question about input boxes
with the help of you guys and a local user group, i now have a macro for sending files to our nc dept. we prefer giving them copies instead of allowing them access to the originals.
anyway, this macro calls up an input box for a file name.
i've noticed that the first time i run the macro in a session, the input box is minimized in the taskbar. after that, the next time i run the macro the input box will be centered on the screen. why is that? is there a line of code i need to add so the box will be centered on the screen the first time its run?
its a minor thing, i'm just curious.
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
can you paste the code in question? a vba inputbox can't be minimized to the taskbar as far as i know! is it really minimized to the taskbar, or is it behind the active window?
i'll get you eh steve, if it's the last thing i dooooo!
you got me to wondering, josh, if the input box was behind the sw window.
i just ran it again and i can't minimize sw or click on other taskbar icons until i click on the input box icon in the taskbar. anyway, here's my code. i'm still new at vb so i'm sure some of you experts out there would write it differently. but, hey, it works for me.
option explicit
dim swapp as object
dim part as object
dim selmgr as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
dim feature as object
dim filename as string
dim suffix as string
dim cncdir as string
dim dump as string
dim strtitl as string
dim strlength as integer
dim strdefaultname as string
dim strdonametest as string
dim strdir as string
dim intnameexist as integer
sub main()
suffix = "sldprt"
cncdir = "o:\drawings"
set swapp = application.sldworks
set part = swapp.activedoc
strtitl = swapp.activedoc.gettitle()
strlength = (len(strtitl) - 7)
strdefaultname = left(strtitl, strlength)
set selmgr = part.selectionmanager
strdonametest = "t"
do while (strdonametest = "t")
filename = inputbox("enter cnc file name:", "cnc file name in o:\drawings\", strdefaultname)
dump = cncdir & "\" & filename & "." & suffix
strdir = dir(dump)
if (strdir = "") then
strdonametest = "f"
else
intnameexist = msgbox((dump) & " already exists." & (chr(13)) & "do you want to replace it?", vbexclamation + vbyesno + vbdefaultbutton1, "cnc file name")
end if
if (intnameexist = 6) then
strdonametest = "f"
end if
loop
part.saveas2 dump, 0, true, false
end sub
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
i tried out your code and i can't reproduce your issue. i don't even get a taskbar icon for an inputbox. however, i'm on xp pro 32 bit. this may be a vista- or x64-specific thing. have you tried messing around with the optional xloc and yloc arguments of the inputbox?
i'll get you eh steve, if it's the last thing i dooooo!
edited: 01/08/2009 at 09:12 am by josh brady
josh, this just might be a vista thing. i tried setting the xpos and ypos with no difference in result. i did notice (maybe i never paid any attention before) that when i tried to open the vb editor within sw, the editor was minimized to the taskbar, also. any other vista users out there see this?
mike closson - cswa
sw 2009 sp3.0 x64
intel xeon e5345 dual 2.33ghz + 4gb ram
nvidia quadro fx 1500
vista business x64 sp1
3dconnexion spacepilot
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】create a user input form to generate parts yang686526 SolidWorks二次开发 0 2009-04-12 08:33 PM
如何用用程序模拟键盘来控制 Media Player 7? huangyhg vc编程 9 2007-11-14 09:18 AM


所有的时间均为北京时间。 现在的时间是 06:08 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多