ActiveX in sub VI
Hello,
I am trying to use a program with ActiveX how sub VI, The program with ActiveX works well, but when I try to do one sub VI with this program the call to this sub VI don't work, What can be pass for this sub VI don't work???
Thanks
A quick comment on the code - if you are getting the ActiveX control from the front panel, you do not need to call Automation Open - the refnum returned by the container itself onto the block diagram is the instance created by LabVIEW on your behalf. Similarly, you don't need to close it either - the VI controls the life of the control.
If there is no reason to display it on the front panel, convert it to a ActiveX refnum constant and leave the Open/Close alone.
The other thing to do is go into the VI Properties and select "Execution". Change the Preferred Execution System from "same as caller" to "user interface". My guess is that when you run it as the top VI, it's defaulting to the UI execution system (typical) and everything is working fine. When you call it as a subVI, it's scheduled by the execution system to run on an available thread, which probably isn't the UI one. I'm guessing that your control requires that the caller be the UI thread.
Brian Tyler
http://detritus.blogs.com/lycangeek
Similar Messages
-
在WEB客户端调用水晶报表ACTIVEX来显示带参数的报表,但是ACTIVEX显示报表页面前就弹出一个对话框【请输入报表参数】。为了让这个对话框不弹出来,我想用代码给报表参数赋值。
问题:报表参数赋值的入口在哪里?如何赋值?要有具体代码更好。
请BO技术员或各位高手帮忙,万分感激!----【成都市保安服务总公司】
步骤如下:
-1-引用ACTIVEX控件,
控制ACTIVEX控件的显示属性
-2-加载报表
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker=CreateObject "CrystalReports11.WebReportBroker.1")
if err.number <> 0 then
window.alert "The Crystal Report Viewer is unable to create its resource objects."
CRViewer.ReportName = "890"
else
Dim webSource0
Set webSource0 = CreateObject("CrystalReports11.WebReportSource.1")
webSource0.ReportSource = webBroker
webSource0.URL = "http://crystal:8880/businessobjects/viewrpt.cwr?id=890"
webSource0.PromptOnRefresh = true
CRViewer.ReportSource = webSource0
end if
--浏览报表
CRViewer.ViewReport
End Sub
**在哪里赋参数值?你的服务态度还是蛮好的,现在,我把我的问题以及操作说具体一点,麻烦您耐心把我的问题看仔细就明白了:
【只希望斑竹和各路朋友帮忙解决这个问题】
版本:服务器 【专业版 11.0】
BOE SERVER安装环境:windows2003高级服务器, 【Tomcat6.0】平台,oracle10G数据库服务器
1:为什么IE客户端可以用Activex访问报表呢?看我操作:
登录 InfoView【这个应该晓得吧,是用于浏览报表、做任务计划的管理平台】
>点击 右上角【首选项】>选择【Crystal Report首选项】
-->u201C查看我的报表,方法是使用u201D【○-ActiveX 查看器 ○-DHTML 查看器 ○-高级 DHTML 查看器 ○-Java 查看器】
-->我选择 【○-ActiveX 查看器】
-->点右下角【确定】
-->设置完毕,然后点击某一张报表
-->第一次打开时系统提示【下载ActiveXViewer.cab控件】
-->下载完毕后,就可以用Activex访问报表了
-->有参数报表系统会自动弹出输入参数对话框
>参数输入完毕,【确定】>报表打开。
2:问题:在这种情况下,我在我的WEB业务平台上直接调用【直接连接某一张报表的URI】如:http://服务器名:8080/businessobjects/enterprise11/desktoplaunch/viewrpt.cwr?id=6846&init=actx,但是运行后需要手工输入参数, 你如何在二次开发时把参数赋进去。[activex]
(提示示:不要再发一些DHTML参数赋值的文件哈,谢谢)
Edited by: m.parker on Aug 3, 2009 3:54 AM -
ActiveX controls disappear when VI is loaded in a Sub-Panel with Start Modal Dialog usage
Hi,
I have a subpanel in a VI (VI1) in which another VI (VI2) is loaded. VI1 is used as a module for an Action step in TestStand. VI2 has ActiveX controls like ExpressionEdit and Adobe PDF reader etc. VI1 loads VI2 in a sub-panel and calls Start Modal Dialog.vi. I have set 'Show front panel when called' to true for VI1 so that the VI pops up when the sequence is run. When the sequence runs and when the Start Modal Dialog VI is called from VI1, all ActiveX controls in VI2 (loaded in the sub-panel) disappears. Here is the screenshot of the frontpanel of VI1 when the sequence is run:
This problem occurs in TestStand 4.2.1, TestStand 2010 and TestStand 2010 SP1 (as far as I have tested. May occur in older versions too). In the attached file, VI1 is 'ExprEdit Test.vi' and VI2 is 'SubpanelLoad.vi'. The attached sequence is developed in TestStand 2010 SP1.
How can this issue be solved?
Thank you,
Ganesh Kumar
Solved!
Go to Solution.
Attachments:
Subpanel Load ExpressionEdit problem.zip 23 KBHi,
An update on this issue: I tried changing the order of loading the VI in the SubPanel and the start modal dialog. I called start modal dialog and then loaded the VI (VI2) in the SubPanel. When I ran the sequence, the activeX controls did not disappear (I was pretty sure that the ActiveX controls in VI2 would not disappear since I am calling Start Modal Dialog before loading the VI in the Subpanel). Then I just changed the sequence of operations back to the previous order (loading the Subpanel with the VI and then calling the Start Modal Dialog). When I ran the sequence, the activeX controls where still displayed. But when I ran the sequence with the VI1 backup (that I had taken before making all these modifications) the activeX controls were not displayed. I a nutshell, I now have 2 versions whose codes are the same. But when I run the sequence with action steps for these VIs, the activeX controls disappear when the unmodified backup VI runs and does not disappear when the modified VI is run. I have attached the files that I used along with the sequence file. The details are as follows:
ExprEdit Test (Not Working).vi - The unmodified backup VI for which the ActiveX controls disappear.
ExprEdit Test (Working).vi - The modified VIs in which the ActiveX Controls do not disappear (But same code as ExprEdit Test (Not Working).vi).
ExpreEdit Test.seq - The sequence file containing 2 action steps one each for theabove mentioned VIs.
SubpanelLoad.vi - The VI that contains activeX controls and is loaded in the SubPanel.
Note that the sequence is created in TestStand 4.2.1.
Thank you,
Ganesh Kumar
Attachments:
Subpanel Load ExpressionEdit problem.zip 36 KB -
ActiveX Object references - casting to a specific instance
I have some ActiveX controls that are used to interface between a vendors hardware. The activex controls are quite heavy weight in that at any one time there should only be one instance of each of the type of controls within the program.
What I want to do is keep the activex controls in the top level vi and pass references to sub-vi's in order to do property changes or method calls on the activex objects.
When I create an activex reference control in a sub vi it doesnt seem to know what methods/propertys are available on that reference. I beleive it needs casting/converting to a reference that will allow LabView to recognize the reference type but im not sure how to do this.
Thanks
TMCYour automation refnums are probably not linked to the ActiveX control. Try this... select a property node in your main VI's diagram that has the desired ActiveX control attributes displayed and then select Edit>>Create SubVI from the menu. The automation refnum in the subVI will be linked to the ActiveX control and will work the way you want it to. Copy this to your other subVIs and the property nodes will start behaving. The other way to link the automation refnums is to right-click on them and choose select ActiveX class and then browse to your control.
-Jim -
How to show all view tab (Main Report and all Sub Report) in Visual FoxPro 9
I use ActiveX from Crystal Report Developer XI for viewer in Visual FoxPro 9 and I already know how to show Main Report by using command:
oRptRun=createobject("CrystalRuntime.Application")
oRptView=thisform.oleRptViewer
oRptOpen=oRptRun.OpenReport('MyReport.rpt')
oRptView.ReportSource=oRptOpen
oRptView.ViewReport
Inside the MyReport.rpt there is two subreport name :
1. MySubReport1
2. MySubReport2
My Question is :
How to show all view tab (Main Report and all Sub Report) at the 1st time we call ViewReport?
I try to using command :
oRptRun=createobject("CrystalRuntime.Application")
oRptView=thisform.oleRptViewer
oRptOpen=oRptRun.OpenReport('MyReport.rpt')
oRptSub=oRptOpen.OpenSubreport("MySubReport1")
oRptSub=oRptOpen.OpenSubreport("MySubReport2")
oRptView.ReportSource=oRptOpen
oRptView.ViewReport
but only show Main Report (view tab name : Preview)?
Did I miss any command before I call oRptView.ViewReport?Your right, there is only one tab to view the report.
To open the subreports you will need to click on them in the main report. I don't know of a way to open them programmatically like you are doing here
http://diamond.businessobjects.com/robhorne</a> -
On Demand sub report not printing in IE and Other Browsers
Hi All,
We have developed Crystal report for our web application with version 13.0 and Visual Studio 2010.
When we run our web app in IIS report display fine in All web browser and when we print report in ActiveX mode in IE 9+ for main report it prints fine but if we print on demand sub report it not printing even a single page out of 2 or more than 2 page.
If on demand sub report has only one page then it will print in IE 9+ browser.
Even If we click on Export button on demand sub report easily export to pdf or any formate the issue while we print it.
It going to hanged while we print on demand sub report with more than one page.
Please help in this issue.
Also please let me know if you want more detail.Not sure why you created two Discussions on the same issue? (CR on demand sub report goes hang in IE)
Locking this Discussion.
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
Crystal ActiveX Runtime Lib: Change text data source path at run time.
We have some PCs running Crystal Reports 10 and some running CR 9 and 8.5. For each PC, we set up a System DSN ODBC data source (in Control Panel - Administrative Tools) for pulling data from text files to
generate reports.
Recently we wrote some routines (see the Visual Basic example at the
end of this message) to change the path of the data files at runtime.
According to the Crystal Reports Technical Reference Guide, we may use
the method LogOnServer() of an Application object or an DatabaseTable
object. However, we find that this does not work: the PrintOut()
method only pulls data from the default path as configured for the
System DSN, not from the path passed as the third parameter of
LogOnServer(). It does not return any error message.
We have also tried to use SetTableLocation() method, and it still does
not work.
Would any experts examine our code below and advise what we are missing? Thanks.
For the following VB example, we have:
System DSN Name: AP_WORKSHEET
Driver: Microsoft Text Driver
Database Directory: D:\0ood2 (i.e. the default path)
Crystal Report Document: D:\3g\run\Vision\apcyto\Reports\crBlockWS.rpt
(Which specifies that the data source text file name is BlockWS.txt)
Purpose : We would like to read the data source text file from
D:\0ood1 instead of the default path.
Following is the code of the VB macro:
Sub test()
Rem In this version of the subroutine, we call
Rem DatabaseTable.LogOnServer() and "Rem"ed out
Rem Application.LogOnServer() and SetTableLocation().
Rem We have un"Rem"ed each of them and "Rem"ed others and try to run.
Rem In all runs, data are pulled from the default file
Rem D:\0ood2\BlockWS.txt instead of D:\0ood1\BlockWE.txt.
Dim crxapp As CRAXDRT.Application
Dim crxRep As CRAXDRT.Report
Dim crxDB As CRAXDRT.Database
Dim crxTab As CRAXDRT.DatabaseTable
Dim crxConnPs As CRAXDRT.ConnectionProperties
Dim crxConnP As CRAXDRT.ConnectionProperty
Dim apropSubLoc As String
Dim apropConnBufStr As String
Set crxapp = CreateObject("CrystalRuntime.Application")
Rem
crxapp.LogOnServer "p2sodbc.dll", "AP_WORKSHEET", "<CRWDC>DBQ=D:\0ood1",
Set crxRep = crxapp.OpenReport
("D:\3g\run\Vision\apcyto\Reports\crBlockWS.rpt")
Set crxDB = crxRep.Database
Set crxTab = crxRep.Database.Tables(1)
apropConnBufStr = crxTab.ConnectBufferString
apropSubLoc = crxTab.SubLocation
crxDB.LogOnServer "p2sodbc.dll", "AP_WORKSHEET", "<CRWDC>DBQ=D:\0ood1",
Rem crxTab.SetTableLocation "D:\0ood1\BlockWS.txt", apropSubLoc, "DSN="
Rem Set crxConnPs = crxTab.ConnectionProperties
Rem Set crxConnP = crxConnPs.Item("DSN")
Rem crxConnP.Value = "AP_WORKSHEET"
Rem Set crxConnP = crxConnPs.Item("Database")
Rem crxConnP.Value = "D:\0ood1\BlockWS.txt"
Rem crxTab.Location = "BlockWS.txt"
crxRep.DiscardSavedData
crxRep.PrinterSetup (0)
crxRep.PrintOut
End Sub
For VB macros, the problem exists in all of CR 8.5, 9 and 10. However,
for another platform we are using, Unify Vision 4GL, it works for CR
8.5 while not working for CR 9 and 10.
Following is the source code in Unify Vision 4GL. This language may
not be popular, but I thin you are about to see how it calls the
Runtime Library methods LogOnServer(), OpenReport(), PrinterSetup() and
PrintOut().
%gfPrintCrystalReport
BOOL FUNCTION gfPrintCrystalReport($reportName)
BEGIN
if NOTMKNOWN(GF:$oSeagateId) then
create service of activex
class 'CrystalRuntime.Application'
object_ref into GF:$oSeagateId;
if MKNOWN(GF:$oSeagateId) then
begin
/* TD23013: Database directories are dynamic to
accommodate multiple user requirement of Citrix */
send message LogOnServer to GF:$oSeagateId
using
( 'PDSODBC.DLL', 'AP_WORKSHEET', '<CRWDC>DBQ='+GF:$WinTempDir,'','')
identified by $msgHandle;
if $msgHandle:MSG_STATE 'RESPONSE_PROCESSED'
then
begin
display 'Crystal Reports cannot connect
to the datasource ' for fyi_message wait;
return (FALSE)
end
send message OpenReport to GF:$oSeagateId using
($reportName, 1)
identified by $msgHandle returning
$oCrystalReport
if MKNOWN($oCrystalReport) then
begin
if (NOTMKNOWN(GF:$printerName)) then
set GF:$printerName to
$oCrystalReport->PrinterName;
if GF:$printerName $oCrystalReport-
PrinterName then
send message SelectPrinter to
$oCrystalReport
using
(GF:$driverName,GF:$printerName,GF:$portName)
identified by $msgHandle;
set $oCrystalReport-
DisplayProgressDialog to FALSE;
while TRUE
begin
DISPLAY NOTICE 'Print to : ' +
GF:$printerName
LABELS 'Ok'
DEFAULT, 'Cancel', 'Printer Setup'
RESULT INTO $userOption
switch ($userOption)
begin
case 0 :
send
message PrintOut to $oCrystalReport
using
(PROMPT_USER, NUMBER_OF_COPIES, COLLATED, START_PAGE, STOP_PAGE)
identified by $msgHandle;
set
$oCrystalReport to UNDEFINED
return
(TRUE);
case 1:
set
$oCrystalReport to UNDEFINED
return
(FALSE);
case 2:
send
message PrinterSetup to $oCrystalReport
using
(0)
identified by $msgHandle;
if
GF:$printerName $oCrystalReport->PrinterName then
begin
set GF:$printerName to $oCrystalReport->PrinterName;
set GF:$driverName to $oCrystalReport->DriverName;
set GF:$portName to $oCrystalReport->PortName;
end
break;
end
end
end
end
return
(FALSE);
ENDHi Sydney,
If you search the Developers help file you'll find info on using the method:
How to change the data source
This example demonstrates how to change the data source from native Access to an OLEDB (ADO) data source by using the ConnectionProperty Object, as well as how to change the table name by using the Location property of the DatabaseTable Object. CrystalReport1 is connected to the xtreme.mdb database found in the \Program Files\Crystal Decisions\Crystal Reports 10\Samples\En\Databases folder. The report is using the Customer table. A copy of the Customer table is added to the pubs database on Microsoft SQL Server.
' Create a new instance of the report.
Dim Report As New CrystalReport1
Private Sub Form_Load()
' Declare a ConnectionProperties collection.
Dim CPProperties As CRAXDRT.ConnectionProperties
' Declare a DatabaseTable object.
Dim DBTable As CRAXDRT.DatabaseTable
' Get the first table in the report.
Set DBTable = Report.Database.Tables(1)
' Get the collection of connection properties.
Set CPProperties = DBTable.ConnectionProperties
' Change the database DLL used by the report from
' native Access (crdb_dao.dll) to ADO/OLEDB (crdb_ado.dll).
DBTable.DllName = "crdb_ado.dll"
' The connection property bags contain the name and value
' pairs for the native Access DLL (crdb_dao.dll). So we need
' to clear them, and then add the name and value pairs that
' are required to connect to the OLEDB data source.
' Clear all the ConnectioProperty objects from the collection.
CPProperties.DeleteAll
' Add the name value pair for the provider.
CPProperties.Add "Provider", "SQLOLEDB"
' Add the name value pair for the data source (server).
CPProperties.Add "Data Source", "ServerA"
' Add the name value pair for the database.
CPProperties.Add "Initial Catalog", "pubs"
' Add the name value pair for the user name.
CPProperties.Add "User ID", "UserName"
' Add the name value pair for the password.
CPProperties.Add "Password", "password"
' Set the table name. ' for SQL types it would be "database.dbo.table"
DBTable.Location = "Customer"
Screen.MousePointer = vbHourglass
' Set the report source of the viewer and view the report.
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub -
I developed an elborate avionics Test Bench using the data types and FileGlobals to define all of my instruments and signals. The instruments have some minor changes between Test Bench's and the signals change between projects. The actual LabVIEW VI's were written so that they would be generic, in nature, and rely on spreadsheets to determine what inputs and expected outputs are to be tested and use the FileGlobals to determine how to process each signal from this extensive data structure. This methodology has worked well so far. Now I have the need to read some of the signals being output by the black box and compute a signal as input. The black box it very particular about the timing related to how fast this input changes in response to the outputs.
Anyway, I was able to develop another sub-sequence within the main sequence and have it run as a parallel process. The problem that I have is that this extensive FileGlobals data structure is shown in the sub-sequence, but all of the data is zero or blank. What I really need is the FileGlobal data in the sub-sequence to be equal to the FileGlobals data of the main sequence at the time the ActiveX sequence is started OR have some way to access the main sequence FileGlobals from the ActiveX sub-sequence. I was able to use the when doing a Action of "call method" and a moethod of "NewExecution" to start the sub-sequence. The problem is that the data passed was only the first element in the FilGlobals structure and not the entire FileGlobals.
I have TestStand version 1.0.3 . I know, the answer is usually to upgrade, but I have my own company and am sub-contracting at this company. It took me a month to convince this company that TestStand was the way to go rather than use the old LabVIEW Test Executive that they still have. The point is that it may be difficult to get them to get a later version and at this point I do not have time to wait for a upgrade. So I need to determine an easy way to impliment this with the existing version of TestStand.
Any pointers on how you might solve this problem would be appreciated. You can email me directly at [email protected] .
Thank you for your help!William,
As you alluded, TestStand 2.0 has better solutions to this problem than TestStand 1.0.x. These include
1) Executing the subsequence on a different thread but under the same execution. The file globals are then common to the calling and called sequence. The improved Sequence Call step type gives you this option.
2) There is a new sequence file property that provides that "All Executions Share the Same File Globals".
The reason that the file globals are not shared between your 2 sequences is that they are each executed as separate executions. That is, they are each executed using the NewExecution method. With each new execution a run-time copy of the sequence is made, including the file globals.
I am assuming that you want to execute the subsequence asynchronously (i.e. in parallel) to the MainSequence and therefore must use the NewExecution method to do so. Since you must use TestStand 1.0.3 then the best option is to pass the file globals to the new execution as sequence parameters. It sounds like you tried this but had difficulties. The steps to do this are:
A) Create parameters in your called sequence that mirror the file globals that you want to pass from your MainSequence.
B) Create a new data type that is a container. The subproperties of this container must mirror the parameters in your called sequence. It is important that they are in the same order as the parameters.
C) Create an instance of this container data type as variable.
D) Pass this variable as the parameter of the NewExecution method.
I have attached an example of how to do this. I have 2 file globals that I want passed, Number and String. I have another file global that is an instance of the parameter container that I pass with the NewExecution method (could also have made as local variable). Any time I update the values of the container�s subproperty, the changes are available in the executing "subsequence". Therefore, I must update the value of these container subproperties every time I want to have access to new file global values. There is clearly some redundancy here in that my MainSequence must copy the Number and String values to the container subproperties. If fact, it may be better to simply delete the Number and String file globals and simply use the subproperties of the container directly.
You probably have to play around with the example to synchronize the change of the file globals with the message popups in the subsequence. In TS 2.0 I would have synchronized them with the new synchronization step types.
Attachments:
passfileglobals.seq 37 KB -
How do I update my ActiveX controls without breaking existing VIs?
Hi, I'm new to LabView. I've inherited a labview application that makes use of several user-written VIS. All these vi files use an ActiveX control. For better or worse, the way they've done it is to put a ActiveX Container on the front panel. They then picked "Insert ActiveX Control", and picked the correct OCX. In the block diagram, they set up a "Invoke" Node and wire the ActiveX control to that.
The problem occurs when I update the ActiveX control. I added a couple of methods and reregistered it. When I run one of my vi files, I get:
Error 0 occurred at VI Open & Init Spinstand
Possible Reasons....
I then thought that going to the front panel and deleting the ActiveX control and reinser
ting it would work. Instead I got the message:
Error 1598667368 occurred at VI open & Init...
I should point out that I'm not even attempting to use the new function yet; I'm just running an old .vi file with the updated ActiveX control.
The version of LabView I'm using is 6.0.2. Can anyone tell me what's going on? Is there a way to gracefully update the ActiveX control? I'm I adding ActiveX controls in the best way?
Any help or references would be greatly appreciated.
Thanks,
Andrew WalkerUpdating *.OCX OR *.DLL Component When Active X Automation Interface has Changed
Given that you have changed the ActiveX automation interface, e.g: by appending new functions, then, the original 'registered' ActiveX server automation interface is no longer compatible with the new one.
In this case you must: (1) �un-register� the original interface; (2) Copy the New *.OCX/*.DLL File over the previous ones; (3) Then �re-register the new interface�; (4) After that you must visit ALL your LabVIEW Diagram �PROPERTY� and �METHOD� ActiveX automation nodes and re-reference those same functions.
These FOUR (4) Steps are further explained below:
1. Unregister the *.OCX or *.DLL file by running the command
Regsvr32 /u ��
Make sure that points to the full path name for your *.OCX or *.dll file. You must use the opening and closing quotes if your file path has spaces.
2. Copy the new *.OCX or *.DLL files over the old ones
This means that you will be over-writing the old *.OCX or *.DLL with the new files. Replacing these files is re-commended so that you do not end up with multiple copies of the same file.
3. Register The New *.OCX Controls
Register the new controls by running the command
Regsvr32 ��
This will now honor your new ActiveX automation interface in place of the last one.
4. Re-Visit All �PROPERTY� and �METHOD� Nodes and Re-Reference the same functions that appear in those nodes
This means that you will be right-clicking on all the existing PROPERTY and METHOD nodes and choosing the functions accordingly from the drop-down list-view/menu. If the list view is grayed-out, then Steps 1 to 3 did not take!
NB: GOTCHA FOR *.DDL Users
If you have sub-VIs that use the *.dll Ref icon then you will have to cut and re-insert this reference control in all those sub-Vis. A quick way is to copy the top level *.Dll ref icon and paste it over the control and indicator versions of the same in those sub VIs.
These four Steps plus the 'Gotcha Step' have worked consistenly when I have had to update ActiveX controls featuring a changed automation interface. -
AcroPDF ActiveX control on Excel Userform --- how to include it when I print the form?
Here is a screen-shot of my Excel Userform which IS displaying the correct PDF file inside of an AcroPDF ActiveX control.
Everything works on this form, including an option to print out a full-sized (8.5 x 11) version of the PDF.
However ...
I would like to push the "Print this Form" button, and have a paper copy of exactly what you see on-screen.
The form does print, but the PDF displayed in the ActiveX control is BLANK.
I also have an Image control on this same form with code that allows me to browse for an image file (.JPG) which I use for Custom signs ...
The form prints and the image displayed in the Image Control DOES print with the form.
The Code:
Private Sub cboSelectSign_Change()
Dim MyPDF As String
If Len(Me.cboSelectSign.Value) > 0 Then
If Me.cboSelectSign.Value = "(Custom)" Then
Me.AcroPDF1.Visible = False
Me.ctlImage.Visible = True
Me.ctlImage.Picture = Nothing
If MsgBox("Do you have an image that you'd like to display?", vbYesNo, "Display an Image?") = vbYes Then
fOpenFileBrowser
End If
Else
Me.AcroPDF1.Visible = True
Me.ctlImage.Visible = False
MyPDF = Me.cboSelectSign.Column(1)
Me.txtPDFpath = MyPDF
Me.AcroPDF1.src = MyPDF
End If
Application.Wait (Now + TimeValue("0:00:03"))
Me.txtWidth.SetFocus
End If
End SubHas anyone had this problem?
-
Excel ActiveX slow when not connected to internet
Using LabVIEW 8.5
I hope someone has some insight into this problem because I'm lost. I have a program that communicates with a VXI instrument using a direct connection (crossover cable). I have a subVI in the program that takes data already in the program and writes it to an exisitng Excel workbook using ActiveX. When I run this subVI by itself when I have internet access (DHCP enabled), the subVI takes <2 sec to complete. However, when I am conencted to the instrument using a crossover cable, the subVI occassionally (about 1 out of 3 runs) takes >13 sec to complete. As a test, I connected back to my normal network but kept the manual TCP/IP settings (so Local Area Connection shows a network connection but I can't access the internet). I got the same result, with the subVI taking >13 sec to complete at time. Can anyone explain this behavior? Any remedies? I assume Excel or ActiveX is trying to access the internet, but that doesn't make a lot of sense.
Perhaps a related issue is when I don't have internet conection LabVIEW has problems updating the Block Diagram (i.e. a right click on a wire takes several seconds to bring up the shortcut menu and causes LabVIEW to freeze). Any rememdy for this? I don't know if it is completely related to the issue above, because I created an installer of the subVI and it still exhibits the same behavior (unless maybe its a LabVIEW Run TIme issue?)
I've attached the necessary VI's. To test you'll need to create some Excel workbook and then change the File Path control in the subVI. Also change your TCP/IP settings to something random (I use 192.168.0.2, sub 255.255.255.0, gtwy 192.168.1.1, dns 192.168.1.2, alt dns 192.168.1.3). Any suggestions welcome, or even verification of the behavior I've described.
Thanks
Michael
Attachments:
WriteExcelExistsTEST.vi 113 KB
Row Col To Range Format.vi 17 KBThanks for the response. I tried several different ActiveX applications like you suggested including: Microsoft Word 12.0 Objects Library Version 2.4, Microsoft Internet Controls Version 1.1 Internet Explorer IWebBroswerApp, Microsoft Outlook 11.0 Object Library Version 9.2 Application, etc. The only one I could get to exhibit the same behavior as the Excel app was Microsoft Visio 11.0 Type Library Versionn 4.b, and thats because Visio itself opens when I run the Automation Open then Close.
I then tried opening both Excel and Visio seperately by double clicking their link instead of using LabVIEW and ActiveX with the changed TCP/IP settings , and the same behavior was shown; occassinally it would take about 12 sec to open. So it must not be an ActiveX issue but something with Excel and Visio and my computer (since you didn't see the same behavior on yours). I guess I'll have to go searching the web for an answer...
For completeness and to answer your questions, the environment does not have an internet connection (see first post, network created by a computer with a crossover cable to a VXI-11 instrument). Using Windows XP and Office 2003
Michael -
Do Sub Functions have to be declared as AS3_Val ?
Hi,
If you include additional cpp files which contain sub functions to the main function you are calling from AS3 do they have to be declared as AS3_Val as well... for example if returnString() itself called a function of an instance of a class in another file? Or is it only the root functions in main that have to be declared as AS3_Val?
thanks as always...
-Mike
The main C file:
#include "AS3.h"
static AS3_Val returnString()
char* text = "Hello World";
return AS3_String(text);
int main()
AS3_Val cMethod = AS3_Function( NULL, returnString );
AS3_Val result = AS3_Object( "returnString : AS3ValType" , cMethod);
AS3_Release( cMethod );
AS3_LibInit( result );
return 0;Mike6679 wrote:
My .c file at compile time links to a couple of large unix based library files (each 700k) . Now do they have to be available to my Flex application at runtime along with the swc (in the Flex build directory) or are they built into the swc already?
Neither. You need to compile the library code from source with Alchemy together with your application. A library that you (I assume) only have in compiled form is no good. Flash will not allow any bytecode it loads from an swf to run foreign machine code (*), no matter whether it arises from ActionScript or from C via Alchemy.
(*) Except if you do really horrible things like package up the machine code as an ActiveX component and marshal your calls through JavaScript glue somehow, and that is not even remotely close to being a solution for your question anyway. -
Cannot create ActiveX component
So, I've looked all over for an answer for this one and so far, everything I've seen offered as fixes do not work.
Exception Details: System.Exception: Cannot create ActiveX component.
Source Error:
Line 39:
Line 40: ' Create Acrobat Application object
Line 41: PDFApp = CreateObject("AcroExch.App")
I have a webserver on which is installed the latest version of Acrobat Standard.
Here is my code:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Data.OleDb
Imports System.Security
Imports System.Security.Principal
Partial Class CodeTest
Inherits System.Web.UI.Page
Dim LOGON32_LOGON_INTERACTIVE As Integer = 2
Dim LOGON32_PROVIDER_DEFAULT As Integer = 0
Dim impersonationContext As WindowsImpersonationContext
Declare Function LogonUserA Lib "advapi32.dll" (ByVal lpszUsername As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Integer, _
ByVal dwLogonProvider As Integer, _
ByRef phToken As IntPtr) As Integer
Declare Auto Function DuplicateToken Lib "advapi32.dll" ( _
ByVal ExistingTokenHandle As IntPtr, _
ByVal ImpersonationLevel As Integer, _
ByRef DuplicateTokenHandle As IntPtr) As Integer
Declare Auto Function RevertToSelf Lib "advapi32.dll" () As Long
Declare Auto Function CloseHandle Lib "kernel32.dll" (ByVal handle As IntPtr) As Long
Private Sub savePDFtoTIF(ByVal fullPathPDF As String, ByVal fullPathTIF As String)
Dim PDFApp As Acrobat.AcroApp
Dim PDDoc As Acrobat.CAcroPDDoc
Dim AVDoc As Acrobat.CAcroAVDoc
Dim JSObj As Object
If impersonateValidUser("XXXXXXX", "", "XXXXXXXXXX") Then
' Create Acrobat Application object
PDFApp = CreateObject("AcroExch.App")
' Create Acrobat Document object
PDDoc = CreateObject("AcroExch.PDDoc")
' Open PDF file
PDDoc.Open(fullPathPDF)
' Create AV doc from PDDoc object
AVDoc = PDDoc.OpenAVDoc("TempPDF")
' Hide Acrobat application so everything is done in silentmode()
PDFApp.Hide()
' Create Javascript bridge object
JSObj = PDDoc.GetJSObject()
' Attempt to save PDF to TIF image file.
' SaveAs method syntax .SaveAs( strFilePath, cConvID )
' For TIFF output the correct cConvid is
' cCovid MUST BE ALL LOWERCASE.
JSObj.SaveAs(fullPathTIF, "com.adobe.acrobat.tiff")
PDDoc.Close()
PDFApp.CloseAllDocs()
' Clean up
System.Runtime.InteropServices.Marshal.ReleaseComObject(JSObj)
JSObj = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(PDFApp)
PDFApp = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(PDDoc)
PDDoc = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(AVDoc)
AVDoc = Nothing
undoImpersonation()
Else
lblStatus.Text = "Unable to impersonate"
Exit Sub
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
savePDFtoTIF("D:\DoH\998.110803030832.pdf", "D:\DoH\Project\000.tif")
End Sub
Private Function impersonateValidUser(ByVal userName As String, _
ByVal domain As String, ByVal password As String) As Boolean
Dim tempWindowsIdentity As WindowsIdentity
Dim token As IntPtr = IntPtr.Zero
Dim tokenDuplicate As IntPtr = IntPtr.Zero
impersonateValidUser = False
If RevertToSelf() Then
If LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
tempWindowsIdentity = New WindowsIdentity(tokenDuplicate)
impersonationContext = tempWindowsIdentity.Impersonate()
If Not impersonationContext Is Nothing Then
impersonateValidUser = True
End If
End If
End If
End If
If Not tokenDuplicate.Equals(IntPtr.Zero) Then
CloseHandle(tokenDuplicate)
End If
If Not token.Equals(IntPtr.Zero) Then
CloseHandle(token)
End If
End Function
Private Sub undoImpersonation()
impersonationContext.Undo()
End Sub
End Class
The impersonation works, as I use the same code on another page where I am manipulating file system objects through that account, with this code. Also, the code without the impersonation, works on my local machine perfectly.
Any ideas on what to do would be greatly appreciated.
JusticeLook, I got dragged into a project that was late from the start, but is a big contract for the printing company that I work for that uses a lot of Adobe products internally for what they do.
In good faith, I tried to purchase something that would work. I was in a rush and didn't read the entire EULA as I was installing it. Obviously, I wasn't trying to screw the system or I wouldn't have been here, posting about it. I also do not need an education about what is true or false on the internet. I need a solution now that is going to meet the customers needs based on what is provided here. Rather simple, and don't reallly have the time for an entire formalized consultation as to our "business needs", since this is really all we need it for and time is of the essence.
If the best Adobe can do is publicly slap customers around on forums and throw vague answers out to follow up on, then I guess it's time to seek out other solutions for our business needs. -
Acrobat Reader 9.1 ActiveX control problems
We have an application written in VB.NET 2005 which displays a PDF file using embedded ActiveX control from Acrobat Reader (using AcroPDF.dll).
The code to open the file is very simple:
Me.AxAcroPDF1.LoadFile(_path)
The application was compiled on the machine that had Acrobat Reader 8 installed and distributed. The users also had Acrobat 8 installed.
Some of the users upgraded to Acrobat 9.1. I understand that it shouldn't really matter as the ActiveX control from 9.1 should be backward compatible.
Yet some users cannot open the file and receive the following error message:
"Error HRESULT E_FAIL has been returned from a call to a COM component"
Some other users can open the file but have the following message when closing the application (which calls Me.AxAcroPDF1.Dispose() ):
"The instruction at "0x0700609c" referenced memory at "0x00000014". The memory could not be "read"."
What can cause those problems? How can I fix them?OK, no one responsed to my questions but I found answers for them so I thought I might put them here for those interested.
As for "HRESULT E_FAIL" message, all that was wrong was the "Display PDF in browser" option in Adobe Reader preferences. It needs to be ticked. A bit weird but considering that it uses the same OCX in a web browser, it makes some sense.
As for the memory issues message, I need to unload libraries manually before exiting the application (as suggested in some other thread in this forum):
<DllImport("ole32.dll")> _
Friend Shared Sub CoFreeUnusedLibraries()
End Sub
Me .AxAcroPDF1.Dispose()UnmanagedCode.CoFreeUnusedLibraries() -
ActiveX doesn't check on startup anymore?
We are heavily using ActiveX and recently built labVIEW drivers for them in 8.5.1. Why is it when the DLLs are not installed and registered is the code completely runnable? A force recompile doesn't break the VI like it used to? Is there some ini option for LabVIEW to re-enable this?
I've read on sites that a bug was fixed from 8.2.1:
49HH05G0 Registering an updated ActiveX COM library breaks VI and requires relinking all Invoke Nodes
Also I read an ini option that does NOT work advertised:
checkActiveXLibs=True
It is vital for our project to check all of our drivers are indeed correctly linked before running the executable. We need to track which VIs are broken to ensure they are all contained in our driver folder.
Many Thanks,
--Kevin
Kevin Shirey
PVI Systems Inc.
Certified LabVIEW DeveloperHello Kevin,
It sounds like you are registering a new version of an ActiveX assembly,
and the VIs which call it are automatically updated with the new
version's properties, methods, and sub-classes. As you can imagine, it
was a big pain point for people to be calling external components, and
then have to manually re-code their VI when updating the ActiveX
assembly. As you have pointed out, you took advantage of this
"feature", and used it as a way to check and make sure that all of the
ActiveX calls you were making were valid.
If you need confirmation of any property or invoke nodes that contain
values that are now invalid with the new assembly, you will still have
errors in the error list for the VI. For instance, if registered type
library contained "Class A" with "Property B", but in the new type
library "Class A" no longer has "Property B" and now has "Property Z"
instead, you will receive an error on the property node that once
accessed "Property B" similar to the following:
All of the wires will not be broken, but the actual property being
referenced by the property node will appear in black, indicating that it
is no longer valid. The same goes for invoke nodes. So if you are
looking for a simple hand-check/inspection to see if the ActiveX calls
are still valid, this should not be a problem. Broken wires are not
necessary to detect invalid calls (calls that do not exist in a new
version of a type library).
Also, if you wish to search all existing property nodes and invoke nodes
(not just ones that no longer work), then you can use the find tool
(CTRL+F) to find all instances of a function (property nodes, invoke
notes, automation open, register event callback node, etc.). However,
if there are no errors in the VI, then all ActiveX calls should be
properly registered. As for verifying the behavior of their functionality, obviously that would take an actual functional test.
Do you wish to check just for functions that contain invalid references (like the example above)? If so, LabVIEW should automatically give you this information already. If not, are you looking to verify all functions, whether they contain an invlaid reference or not?
Chris_G
Sr Test Engineer
Medtronic, Inc.
Maybe you are looking for
-
Can i use Response method in livecycle designer to render or open pdf doc?
Hello, Can anybody please tell me is it possible to use response method available in the adobe livecycle designer which takes the input value to open the pdf doc. Case 1: if we send adobe form throgh mail as pdf doc,then at the receiver side if the u
-
How do I send a 2 minute video ?
What format should I use to send a 2 minute video over email?
-
Unit STD is not created in language EN
Hi everyone, During uploading of AP transactions,we got this error: Unit STD is not created in language EN. I've checked tcode SE38 and tried to search for STD in language EN but it gives me the same warning/information. I also run RSDMD_CHECKPRG_ALL
-
Per-user cronjob (somewhat automatically)
Hi all, probably some of you have a solution for this already in place: I have switched from fetchmail to mpop and miss the daemon feature. When I tried to launch mpop with the following mpop file in /etc/cron.d, it didn't work (I think it didn't dow
-
Workprocesses go into PRIV immediately
Our users connect through our intranet and a portal to a SRM backed (among other things). When a user starts a session from the intranet, we can see it using a dialog process at the backend. This dialog process starts in PRIV mode immediately. As a c