Handle leak - Crystal for VS 2010
I've been playing with the Crystal VS2010 runtime and have come across a problem which I believe might be a handle-leak in Crystal Reports.
I can reproduce this at will using the following example:
I created a project with a typed dataset (containing 2 empty tables with only a single column each). I then added a blank report to the project and only added a single text object to it - no data is loaded from the dataset at all.
Then, I can execute the following 100 times in a loop:
using (DataSet1 dataSet = new DataSet1())
using (CrystalReport1 report = new CrystalReport1())
report.SetDataSource(dataSet);
report.Close();
dataSet.Clear();
This I then follow with a forced garbage collect, just to make sure everything was cleaned up properly. However, +- 100 new handles were opened and using sysinternals' handle.exe, these show up as Mutexes e.g.:
1324: Mutant \Sessions\1\BaseNamedObjects\CrystalReportXalanInitilizeMutex2916l
I haven't been able to find any information about this on the forums or the internet - can anyone confirm if this is a known issue? (Or am I doing something stupid? )
Thanks!
Hi,
I've tried some of your suggestions:
In you report check on No Printer and check off all o f the Verify Database options. - Made no difference
Also, be sure to use the Legacy mode in your app.config file, search for it. MS issue with DataSets. - Also, no difference
GDI Objects - These don't budge - this is a Mutex leak, not a GDI leak
As for datasets, I'm not filling the dataset - its empty. So a database does not enter into the equation, and no database connection handles are therefore ever created.
Also, I tried the printer theory by running the app on a machine without any printers installed - the problem persisted. Machines also have entirely different graphics card drivers, so highly unlikely to cause the problem.
I've also tried targeting both Framework 4.0 and Framework 2.0 - the leak occurs in both cases.
The code that I posted was only a snippet yes, but it really is 90% of the test-app. This is the whole content of Form1.cs (a single-button form):
using System;
using System.Windows.Forms;
namespace CrystalLeakTest
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void ProduceReport()
using (DataSet1 dataSet = new DataSet1())
using (CrystalReport1 report = new CrystalReport1())
report.SetDataSource(dataSet);
report.Close();
dataSet.Clear();
private void button2_Click(object sender, EventArgs e)
for (int i = 0; i < 100; i++)
ProduceReport();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
MessageBox.Show("Done");
The rest of the app is simply a blank report, a blank typed dataset (with 1 table and 1 column - no data). That really is it
Is there anything else I can try?
Thanks!
Similar Messages
-
Crystal for VS 2010 - formatting issues in viewer (extra space) again
We're having the same problem as the one in this thread link:[Crystal 2008 for VS 2010 - Report formatting issues in viewer (extra space);. There's no resolution in the thread and it's been closed. I'm hoping that creating a new thread may cause someone to answer this problem.
We have a Windows App that we just converted to .NET 4.0 and updated the viewer to the Crystal Reports Viewer in VS 2010. When we open a report that has a large block of static text in paragraphs left-aligned the spacing around punctuation is awful - there's almost a tab's worth of space between the last letter and the period. U.S. looks like US. This happens both with reports that were created in VS2008 and ones that were created in VS2010. It is only a problem in the viewer's display - if we print to a printer or export to PDF the spacing around punctuation is fine. It's also not a problem on our development workstations which are running Windows 7, but is a problem on our test servers which are running Windows 2003 Server. I ran the modules tool and found that the version of usp10.dll does match what the previous thread said it should be and it's coming from the c:\program files\sap businessobjects\crystal reports for .net framework 4.0\common\sap businessobjects enterprise xi 4.0\win32_x86\ folder. On my development machine when I run the modules tool I notice that a second instance of usp10.dll is called which is the version installed with Windows 7. We've tried changing fonts but none of the ones we've tried (originally in Times New Roman, 12, tried Arial, Times and various sizes) have made a difference. We also tried changing the print options with no improvement. The only thing that makes it slightly better is full-alignment but our customer insists that it be left-aligned.Re. the other thread. I never did receive a sample of the report to test with. Perhaps I can get one from you? I need you to ensure that the issue occurs with a "saved data" report. If it does, let me know if you can share it and I'll contact you via email. My comment in the other thread re. available time, priorities, etc., still applies. Also, just to be clear. Service Pack 2 for CRVS2010 is closed now. Thus if I am able to reproduce the issue the fix will be targeted for October \ November time frame - no guarantees though...
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
Crystal for VS 2010 creates duplicates on edit
Hey everyone, after uninstalling the old Crystal Reports for Visual Studio and installing the new VS 2010 version, and after converting all my reports to the new format (whatever that means), a duplicate vb file is created every time I edit and save a report. So if I have some report "myreport.rpt", whenever I edit and save that report, I end up with two vb files, one named "myreport.vb" and the other named "myreport1.vb". The two files are exactly the same. This of course causes build errors, and so I have to delete the duplicate file every time I make a change, which is very annoying. Has anyone else had this issue? Does anyone have a solution?
Hello!
At our company, we run with the same problem, and this is the only way we found to solved it.
Lets assume the report name is rptExample.rpt, and the code behind, is named automatically rptExample.cs.
Then, if you install a new version for the Crystal Reports for Visual Studio, ex. from 13.0.3 to 13.0.5, sometimes it creates another code behind with the number 1 at the end, rptExample1.cs.
So, to solve it, delete all the code behinds (rptExample.cs and rptExample1.cs), then right click on the rptExample.rpt and press Rename, rename the file to rptExample1.rpt and press Enter. The visual Studio is going to make a question "You are renaming a file. Would you also like to perform a rename in this project of all references to the code element 'rptExample1'?" press YES.
Then the VS is going to create a new code behind named rptExample11.cs (weird!!!), now rename again the report file name, from rptExample1.rpt to rptExample.rpt, now the VS is going to show you an error message if you have source control "This operation cannot be completed. You are attempting to move or rename a source-controlled item where an item of the same already exists, the item is exclusively locked elsewhere or the item path is invalid", there is no other option to press OK.
Now, delete again the code behind rptExample11.cs and right click on the report file, rptExample.rpt and press the option "Run Custom Tool", and there you have the right file name rptExample.cs.
This was the only way that we found to have the same name for the code behind and the report.
Bye! -
CRVS2010 Beta - Licensing for "Crystal Reports for VS 2010"
Hello,
We have Crystal reports 2008 developer license which was upgraded from Crystal reports 11 Developer edition.
We have migrated to VS 2010 and need to use "Crystal Reports for VS 2010". But we only need to use the runtime version of it and are not using the crystal reports designer. Do we need to purchase/upgrade the license? If yes, then could you please let us know the details?
Thanks,
Gulab.
Subject modified as per the sticky post at the top of this forum; [Crystal Reports for Visual Studio 2010 Beta - read before posting|Crystal Reports for Visual Studio 2010 Beta - read before posting;
Edited by: Ludek Uher on Sep 9, 2010 6:56 AMCRVS 2010 being a Beta, I am not sure that the licensing details have been worked out yet. However, going by past versions;
Runtime is free for win apps
Runtime is free for web apps - as long as these are used internally. See [SAP Crystal Reports Licensing Information|http://www.sap.com/solutions/sap-crystal-solutions/query-reporting-analysis/sapcrystalreports/licensing/index.epx] for more details.
The above 2 I suspect will be carried over to CRVS 2010 - no guarantees, but this would make sense.
Runtime for web apps deployed to 3rd parties does require extra licensing. The licensing for versions of CR that bundled with .NET 2006 and .NET 2008 are described here:
http://support.microsoft.com/kb/317789
I'll check with Program Management if all of the above applies and confirm once I get an answer.
Ludek -
Auto execution of Crystal Reports for VS 2010 report
I'm very new to crystal and I've been searching for some time and can't seem to find a solution to this. I installed Crystal Reports for VS 2010 and can run a report without any issues. What I would like to do is basically compile and EXE that when I execute it, it will refresh a report and export it in whatever format and location I specify, without showing any GUI. This seems like it should be an easy thing to accomplish, but I have had no luck yet.
Any help is appreciated.
Thanks,
TimHi Tim,
See these samples:
Root Page
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsHome
Enterprise Samples (including managed and unmanaged ras)
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsSDKSampleApplications
Non-Enterprise Samples
http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
Exporting Samples (RAS)
http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
Just don't load the report into crystalReportviewer1 and simply export to what ever format you need.
Your users will need the CR runtime if they want to run your app. If you export to PDF or some other format then they can view the report only. Just share or e-mail the report folder.
Thank you
Don -
I would like to know which versions are available for use with Visual Studio 2010. Specifically, can both Crystal Report 13 and Crystal Reports 11 both work with Visual Studio 2010? Can I create and save a Crystal Reports 11 file and a Crystal Reports 13 file using VS2010?
I have an issue where a developer created several custom Crystal reports through Visual Studio 2010, and then saved the output as Crystal version 13 files. Our corporate accounting application uses a runtime version of Crystal Reports 11 and all standard reports work fine using this runtime version. The issues appear with the custom reports in that the print preview screens freeze when attempting to close them (after the user has printed the documents).
Please advise.Neither Crystal 2011 or 2013 come with the SDK. There's actually very little difference between them - 2013 was primarily a "rebranding" of 2011 to go with BusinessObject 4.1.
So, you'll get the separate download for Crystal for Visual Studio (see here: http://scn.sap.com/docs/DOC-7824) and it will work with reports designed in either version, as well as reports designed Crystal 2008 and possibly with earlier versions (back to Crystal 9) as well.
-Dell -
Crystal 2008 for VS 2010 - Report formatting issues in viewer (extra space)
Hello,
We have a Windows Form application developed in VS 2010 using the Crystal 2008 for VS 2010 runtime. We are having issue with extra spaces in text objects. For example: in a report header we have an object that has text similar to this:
This report will print a list of all Serial Numbers in the Serial Table that are missing related Serial Meter records.
When we run it within Crystal 2008 Designer, it looks great; however, when we run it from the Windows Viewer we developed, it looks like this:
This report will print a list of all Serial Numbers in the Serial Table that are missing related Serial Meter records .
The viewer places extra spaces between records and the period (.). We also noticed it places spaces in phone numbers:
952 -555-555
There's an extra space between the 2 and the dash (-).
One thing we noticed is, if you change the viewer zoom to 98%, then the extra spacing goes away.
We just upgraded to SP1 for Crystal 2008 for VS 2010 and still the same issue. We are referencing these DLLS: CrystalDecisions.CrystalReports.Engine.dll, CrystalDecisions.ReportSource, CrystalDecisions.Shared, and CrystalDecisions.Windows.Forms all version are 13.0.2000.0.
Any help would be great.
Thank you,
TylerHi Tyler,
I copied the text from your other post into a new report and changed the fonts and previewed in my C# test app and I don't see the problem.
"We have a Windows App that we just converted to .NET 4.0 and updated the viewer to the Crystal Reports Viewer in VS 2010. When we 952-555-555 open a report that has a large block of static text in paragraphs left-aligned the spacing around punctuation is awful - there's almost a tab's worth of space between the last letter and the period. U.S. looks like US. This happens both with reports that were created in VS2008 and ones that were created in VS2010. It is only a problem in the viewer's display - if we print to a printer or export to PDF the spacing around punctuation is fine. It's also not a problem on our development workstations which are running Windows 7, but is a problem on our test servers which are running Windows 2003 Server. I ran the modules tool and found that the version of usp10.dll does match what the previous thread said it should be and it's coming from the c:\program files\sap businessobjects\crystal reports for .net framework 4.0\common\sap businessobjects enterprise xi 4.0\win32_x86\ folder. On my development machine when I run the modules tool I notice that a second instance of usp10.dll is called which is the version installed with Windows 7. We've tried changing fonts but none of the ones we've tried (originally in Times New Roman, 12, tried Arial, Times and various sizes) have made a difference. We also tried changing the print options with no improvement. The only thing that makes it slightly better is full-alignment but our customer insists that it be left-aligned."
I threw in the telephone number also you noted in this post.
I created a new report and copied the text above into a text object and then previewed. I then changed the fonts to various types and I don't see the problem.
I also used Courier New because it's a fixed font layout, meaning the same letter always uses the same amount of space, and it shows just fine also.
I've seen issues where the Video driver and screen size can affect the spacing. Usually updating the Video driver or changing your screen resolution resolves the problem.
What Video Drivers and Monitor are you using?
And What OS?
Thank you
Don -
Crystal Report for VS 2010 - The report page doesn't show in IIS
Hi all, I get a problem with Crystal Report for VS 2010 (version 13).
My website is built using VS 2010 (asp.net 4.0) and Crystal Report v13.
It work okay when I run it in the VS 2010. But when I host my site in the IIS 7, when going to the page that contain the Report, the report show nothing.
The page is blank except my button I've created to export the Report.
The weird thing is when I click the my button (export to pdf), it doest export the correct pdf.
Note that this happens in my development machine: windows 7 32bit.
I've spent a day figure out problem but still haven't found the problem.
Hope you can help me.Let's start with the viewer. Sounds like the viewer directory is not configured correctly. Use [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50aa68c0-82dd-2b10-42bf-e5502b45cd3a] article as a guide on how to do this.
I still do not have info on the following:
it means even though the crystal report viewer doesn't show, i still can export it's content to pdf.
With all due respect, think of it this way;
You're the mechanic. I'm a guy with a car. I text you; I'm sitting in my car. It will not get me to point A. Fix it.
In a nut shell, that is what you are asking me to do with the export. The more detail you provide, the better. See if you can provide the info re export I requested in my previous post.
Ludek -
PDF File not opening in browser for sharepoint 2010
Recently we have moved our web application from one server to another in Sharepoint 2010. Back up of entire web application was taken and restored in another server. But in the new server , the PDF files in the document library is not getting opened in browser.
it always open in browser
I have already made following changes but didn,t work
Set browser file handling to Permissive from central admin
Set "open in browser" in setting s of doc library
Set the doc library file handling property using $docLib = $web.lists["Your Document Library Title"] $docLib.BrowserFileHandling = "Permissive" $docLib.Update()
Added "AllowedInlineDownloadedMimeType.Add("Application/Pdf") in web app
Installed Adober eader in client machine
Even after trying all these, the PDF files are still opening in Client application(Adobe reader) but not in the browser
It would have been great help if anybody provide a solution for this. I have been banging head on this for two daysIt would be handy if you didn't double post too.
http://social.technet.microsoft.com/Forums/sharepoint/en-US/81ed0362-4033-4a31-b265-c1aba43c3d14/pdf-file-not-opening-in-browser-for-sharepoint-2010?forum=sharepointadminprevious
To answer your question, you've tried most things that I normally see working, but there may be an extra solution here for you. The solution 2 Powershell that deals with updating the Inline MimeType may help.
http://www.pdfshareforms.com/sharepoint-2010-and-pdf-integration-series-part-1/
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
Problem getting CR for VS 2010 to work
I just downloaded and installed CR for VS 2010, the file is "CRforVS_13_0_1.exe". It seemed to install just fine. But I can't get it to work in my VB .Net 2010 project.
I can select "Add a New Item" and then select "Crystal Report", no problem.
When the new report window appears, it defaults to "Using the report wizard", if I click OK, it locks up VS and I have to use the task manager to close VB.
If I select "As a Blank Report" it's ok and will add a blank report.
But as soon as I select the Database Expert it throws an error saying "External component has thrown an exception" and then VB is locked up.
I have Win7 64bit home premium OS.
I have VS 2005 and VS 2010 installed
CR in the VS 2005 is working fine.
I had a simular problem last november and the response I got was there was I bug in CR when a machine has bot VS 2005 and VS 2010 and it was going to be fixed when the SP came out.
So, it there a SP in need to download and install? Do I need to manually add some references to my project (not sure what references are required).
Any information or suggestions will be appriciated, ThanksHi Ed,
Yup I know... The problem is Windows used to use the c:\temp and now it users the temp folders located under the c:\User\ folder structure.
CR uses a wild card \temp to save the temp files we generate. The problem is with the wild cards. The issue now is you should not be using a c:\temp folder according to Windows Rules all temp files should go under the users folder structure.
I actually do the same thing at home and ran into a problem with Logitech's installer, it would complete the install if I set my environment variable to c:\temp. As soon as I changed it back to the Windows 7 default the installer ran fine.
So even though you have been using it for 20 years, and so have I, we have to change to follow the new OS rules. Using any other name like \MyTemp is fine as I first indicated.
Thanks again
Don -
Error in File UNKNOWN.RPT (Crystal for VS 2008)
I have read and implemented nearly every suggested solution to solve this riddle of a Crystal Error I am stumped with. Of course, on my dev box the report runs perfectly, as it should. However, if I deploy my simple report web project to my client's Windows 2003 Standard Server, running IIS 6, I get this error. I have literally implemented, or attempted to implement every single suggestion Google users have to offer, including adding security for nearly every user that has ever existed, to nearly every folder that has ever existed. I have uninstalled/reinstalled/upgraded from Crystal for VS 2008, up to Crystal 12, down to Crystal 10.....and the same exact error appears.
<br><br>
Here is what my report app consists of:
1. A single Crystal Report for VS 2008, in a reports folder (which I have granted full control permissions to everybody and my mother, along with permissions to Windows/Temp)
2. That report, when called from the code behind, loads the report and immediately exports the report to a stream, so I can render that stream to a pdf viewer for the user. (yes, very simple)
3. (I do pass load a dataset that is passed into the report too)
<br><br>
What happens on the server when the report is referenced/ran<br>
1. A Crystal .rpt file is geneated in the Windows/Temp folder<br>
2. The frustrating error appears on the screen<br>
<br><br>
I have read through all BO suggested fixes for this, and nothing.<br>
I have implemented all types of permissions changes, and nothing.<br>
I have checked then rechecked the registry settings (even though everything happens on the C: drive), and nothing<br>
I have reinstalled different versions/runtimes etc...and am now back to the original Crystal for VS 2008, and nothing<br>
<br><br>
My only total confusion, is that this report runs fine on my new Windows 2003 server. The only difference between my server and my client's server, is that my client's server also has Helm installed. That's it.
<br><br>
What is next? Is there any other solution I have not tried?
<br><br><br>
Actual Error Message:<br>
Error in File UNKNOWN.RPT:<br>
The request could not be submitted for background processing. <br>
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br>
<br>
Exception Details: System.Runtime.InteropServices.COMException: Error in File UNKNOWN.RPT:
The request could not be submitted for background processing.
<br><br>
Source Error:
<br><br>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
<br><br>
Stack Trace:
<br><br>
[COMException (0x800002ad): Error in File UNKNOWN.RPT:
The request could not be submitted for background processing.]
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +271
<br>
[CrystalReportsException: Load report failed.]
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +894
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod) +85
Reports.ViewQuoteReport.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\AutoID\Reports\ViewQuoteReport.aspx.vb:30
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Edited by: ohjonny on Feb 2, 2010 7:29 AM
Edited by: ohjonny on Feb 2, 2010 7:30 AMI would pin this on the Helm (e.g.; works without, does not work with...). Couple of things you can try:
1) Call who ever you got your particular Helm from and see if they have any ideas
2) Use Process Monitor to see if it tells you what files / folders / reg entries are not being accessed. ProcMon is here:
http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx
Ludek -
Sending and receivind ADC coefficients from/to soundcard in VBA for Excel 2010
How to send and receive ADC coefficients from/to soundcard(mixer,microphone) in VBA for Excel 2010 (noncom. edition, x64) to Excel macros for DFT (from IDFT), IIR , user defined samples parser (special
noise generator, graphic s(t),S(jw), arg s(jw) soundcard AFR test ) ?
What .dll is need for this (without bass.dll)?Example from internet :
'This project needs a module and a form
'The form must contain two labels, two progressbars, a timer and a checkbox
'Paste this code into the form
Dim hmixer As Long ' mixer handle
Dim inputVolCtrl As MIXERCONTROL ' waveout volume control
Dim outputVolCtrl As MIXERCONTROL ' microphone volume control
Dim rc As Long ' return code
Dim ok As Boolean ' boolean return code
Dim mxcd As MIXERCONTROLDETAILS ' control info
Dim vol As MIXERCONTROLDETAILS_SIGNED ' control's signed value
Dim volume As Long ' volume value
Dim volHmem As Long ' handle to volume memory
Private Sub Form_Load()
Me.ScaleMode = vbTwips
Me.Caption = "Volume meter"
Label1.Move 0, 0
Label1.AutoSize = True
Label1.Caption = "Input level"
Label2.Move 0, 4 * Label1.Height
Label2.AutoSize = True
Label2.Caption = "Output level"
ProgressBar1.Move Label1.Width * 2, 0, 3375
ProgressBar2.Move Label1.Width * 2, Label2.Top, 3375
Check1.Move ProgressBar1.Left, ProgressBar1.Height
Check1.Caption = "Get Input"
Me.Move Me.Left, Me.Top, ProgressBar1.Width + ProgressBar1.Left + 10 * Screen.TwipsPerPixelX, ProgressBar2.Top + ProgressBar2.Height + 30 * Screen.TwipsPerPixelY
Timer1.Interval = 50
Timer1.Enabled = True
' Open the mixer specified by DEVICEID
rc = mixerOpen(hmixer, DEVICEID, 0, 0, 0)
If ((MMSYSERR_NOERROR <> rc)) Then
MsgBox "Couldn't open the mixer."
Exit Sub
End If
' Get the input volume meter
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
If (ok <> True) Then
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
End If
If (ok = True) Then
ProgressBar1.Min = 0
ProgressBar1.Max = inputVolCtrl.lMaximum
Else
ProgressBar1.Enabled = False
MsgBox "Couldn't get wavein meter"
End If
' Get the output volume meter
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, MIXERCONTROL_CONTROLTYPE_PEAKMETER, outputVolCtrl)
If (ok = True) Then
ProgressBar2.Min = 0
ProgressBar2.Max = outputVolCtrl.lMaximum
Else
ProgressBar2.Enabled = False
MsgBox "Couldn't get waveout meter"
End If
' Initialize mixercontrol structure
mxcd.cbStruct = Len(mxcd)
volHmem = GlobalAlloc(&H0, Len(volume)) ' Allocate a buffer for the volume value
mxcd.paDetails = GlobalLock(volHmem)
mxcd.cbDetails = Len(volume)
mxcd.cChannels = 1
End Sub
Private Sub Check1_Click()
If (Check1.Value = 1) Then
StartInput ' Start receiving audio input
Else
StopInput ' Stop receiving audio input
End If
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
' Process sound buffer if recording
If (fRecording) Then
For i = 0 To (NUM_BUFFERS - 1)
If inHdr(i).dwFlags And WHDR_DONE Then
rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
End If
Next
End If
' Get the current input level
If (ProgressBar1.Enabled = True) Then
mxcd.dwControlID = inputVolCtrl.dwControlID
mxcd.item = inputVolCtrl.cMultipleItems
rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
If (volume < 0) Then
volume = -volume
End If
ProgressBar1.Value = volume
End If
' Get the current output level
If (ProgressBar2.Enabled = True) Then
mxcd.dwControlID = outputVolCtrl.dwControlID
mxcd.item = outputVolCtrl.cMultipleItems
rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
If (volume < 0) Then volume = -volume
ProgressBar2.Value = volume
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If (fRecording = True) Then
StopInput
End If
GlobalFree volHmem
End Sub
'Paste this code into the module
Public Const CALLBACK_FUNCTION = &H30000
Public Const MM_WIM_DATA = &H3C0
Public Const WHDR_DONE = &H1 ' done bit
Public Const GMEM_FIXED = &H0 ' Global Memory Flag used by GlobalAlloc functin
Type WAVEHDR
lpData As Long
dwBufferLength As Long
dwBytesRecorded As Long
dwUser As Long
dwFlags As Long
dwLoops As Long
lpNext As Long
Reserved As Long
End Type
Type WAVEINCAPS
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * 32
dwFormats As Long
wChannels As Integer
End Type
Type WAVEFORMAT
wFormatTag As Integer
nChannels As Integer
nSamplesPerSec As Long
nAvgBytesPerSec As Long
nBlockAlign As Integer
wBitsPerSample As Integer
cbSize As Integer
End Type
Declare Function waveInOpen Lib "winmm.dll" (lphWaveIn As Long, ByVal uDeviceID As Long, lpFormat As WAVEFORMAT, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function waveInPrepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInReset Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInStart Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInStop Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInUnprepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInClose Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInGetDevCaps Lib "winmm.dll" Alias "waveInGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEINCAPS, ByVal uSize As Long) As Long
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long
Declare Function waveInGetErrorText Lib "winmm.dll" Alias "waveInGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long
Declare Function waveInAddBuffer Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Public Const MMSYSERR_NOERROR = 0
Public Const MAXPNAMELEN = 32
Public Const MIXER_LONG_NAME_CHARS = 64
Public Const MIXER_SHORT_NAME_CHARS = 16
Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
Public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
Public Const MIXERCONTROL_CT_UNITS_SIGNED = &H20000
Public Const MIXERCONTROL_CT_CLASS_METER = &H10000000
Public Const MIXERCONTROL_CT_SC_METER_POLLED = &H0&
Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, ByVal pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
Declare Function mixerGetID Lib "winmm.dll" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long
Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long
Declare Function mixerMessage Lib "winmm.dll" (ByVal hmx As Long, ByVal uMsg As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Long) As Long
Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory" (struct As Any, ByVal ptr As Long, ByVal cb As Long)
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory" (ByVal ptr As Long, struct As Any, ByVal cb As Long)
Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Declare Function GlobalLock Lib "kernel32" (ByVal hmem As Long) As Long
Declare Function GlobalFree Lib "kernel32" (ByVal hmem As Long) As Long
Type MIXERCAPS
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
fdwSupport As Long
cDestinations As Long
End Type
Type MIXERCONTROL
cbStruct As Long
dwControlID As Long
dwControlType As Long
fdwControl As Long
cMultipleItems As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
lMinimum As Long
lMaximum As Long
Reserved(10) As Long
End Type
Type MIXERCONTROLDETAILS
cbStruct As Long
dwControlID As Long
cChannels As Long
item As Long
cbDetails As Long
paDetails As Long
End Type
Type MIXERCONTROLDETAILS_SIGNED
lValue As Long
End Type
Type MIXERLINE
cbStruct As Long
dwDestination As Long
dwSource As Long
dwLineID As Long
fdwLine As Long
dwUser As Long
dwComponentType As Long
cChannels As Long
cConnections As Long
cControls As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type
Type MIXERLINECONTROLS
cbStruct As Long
dwLineID As Long
dwControl As Long
cControls As Long
cbmxctrl As Long
pamxctrl As Long
End Type
Public i As Integer, j As Integer, rc As Long, msg As String * 200, hWaveIn As Long
Public Const NUM_BUFFERS = 2
Public format As WAVEFORMAT, hmem(NUM_BUFFERS) As Long, inHdr(NUM_BUFFERS) As WAVEHDR
Public Const BUFFER_SIZE = 8192
Public Const DEVICEID = 0
Public fRecording As Boolean
Function GetControl(ByVal hmixer As Long, ByVal componentType As Long, ByVal ctrlType As Long, ByRef mxc As MIXERCONTROL) As Boolean
' This function attempts to obtain a mixer control. Returns True if successful.
Dim mxlc As MIXERLINECONTROLS
Dim mxl As MIXERLINE
Dim hmem As Long
Dim rc As Long
mxl.cbStruct = Len(mxl)
mxl.dwComponentType = componentType
' Obtain a line corresponding to the component type
rc = mixerGetLineInfo(hmixer, mxl, MIXER_GETLINEINFOF_COMPONENTTYPE)
If (MMSYSERR_NOERROR = rc) Then
mxlc.cbStruct = Len(mxlc)
mxlc.dwLineID = mxl.dwLineID
mxlc.dwControl = ctrlType
mxlc.cControls = 1
mxlc.cbmxctrl = Len(mxc)
' Allocate a buffer for the control
'hmem = GlobalAlloc(&H40, Len(mxc))
hmem = GlobalAlloc(GMEM_FIXED, Len(mxc))
mxlc.pamxctrl = GlobalLock(hmem)
mxc.cbStruct = Len(mxc)
' Get the control
rc = mixerGetLineControls(hmixer, mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
If (MMSYSERR_NOERROR = rc) Then
GetControl = True
' Copy the control into the destination structure
CopyStructFromPtr mxc, mxlc.pamxctrl, Len(mxc)
Else
GetControl = False
End If
GlobalFree (hmem)
Exit Function
End If
GetControl = False
End Function
' Function to process the wave recording notifications.
Sub waveInProc(ByVal hwi As Long, ByVal uMsg As Long, ByVal dwInstance As Long, ByRef hdr As WAVEHDR, ByVal dwParam2 As Long)
If (uMsg = MM_WIM_DATA) Then
If fRecording Then
rc = waveInAddBuffer(hwi, hdr, Len(hdr))
End If
End If
End Sub
' This function starts recording from the soundcard. The soundcard must be recording in order to
' monitor the input level. Without starting the recording from this application, input level
' can still be monitored if another application is recording audio
Function StartInput() As Boolean
If fRecording Then
StartInput = True
Exit Function
End If
format.wFormatTag = 1
format.nChannels = 1
format.wBitsPerSample = 8
format.nSamplesPerSec = 8000
format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign
format.cbSize = 0
For i = 0 To NUM_BUFFERS - 1
hmem(i) = GlobalAlloc(&H40, BUFFER_SIZE)
inHdr(i).lpData = GlobalLock(hmem(i))
inHdr(i).dwBufferLength = BUFFER_SIZE
inHdr(i).dwFlags = 0
inHdr(i).dwLoops = 0
Next
rc = waveInOpen(hWaveIn, DEVICEID, format, 0, 0, 0)
If rc <> 0 Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
StartInput = False
Exit Function
End If
For i = 0 To NUM_BUFFERS - 1
rc = waveInPrepareHeader(hWaveIn, inHdr(i), Len(inHdr(i)))
If (rc <> 0) Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
End If
Next
For i = 0 To NUM_BUFFERS - 1
rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
If (rc <> 0) Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
End If
Next
fRecording = True
rc = waveInStart(hWaveIn)
StartInput = True
End Function
' Stop receiving audio input on the soundcard
Sub StopInput()
fRecording = False
waveInReset hWaveIn
waveInStop hWaveIn
For i = 0 To NUM_BUFFERS - 1
waveInUnprepareHeader hWaveIn, inHdr(i), Len(inHdr(i))
GlobalFree hmem(i)
Next
waveInClose hWaveIn
End Sub
Error if using winmm.dll, kernel32 in x64 mode -
Has anyone seen handle leaks in ODP.NET? I have a multi-threaded server application that contains managed and unmanaged C++ code and uses ODP.NET. It leaks handles that seem to be thread handles created by ODP.NET. I cannot reproduce it in a simple test. I am working on it, but it would be nice to know if anyone noticed the same problem and has a workaround or fix. This is a big problem in my app because the number of handles goes up to 10,000 in a couple of hours. GC.Collect does not help.
Thanks,
AlekseyYes, I know that. I do close and dispose everything. The behaviour is hard to reproduce, but it does happen.
One quick tip you can try is to explicitly close all
objects you created when no longer needed. For
example, call the Close/Dispose method on your your
ODP.NET connections, DataReaders, etc. objects before
you leave your applications scope. Sometimes the
.NET garbage collector cannot reclaim resources
quickly enough under heavily-loaded conditions.
Alex -
Handle leak when using ADO2.7 access oracle
Ado version:2.7
OS:Window2000 professional
Oracle Server:9.2.0.1.0
Client Provider:9.2.0.1.0
Using Oracle OLEDB connection oracle
when i execute such function in my test program continuously:
Handle count of the program will increase.I know handle will increase for connection pool ,but it will stop increasing when handle count reach one value. i think this is a problem that ADO cann't match with Oracle OLEDB
better.
Any suggestion?
Set mConOracle = New Connection
mConOracle.CursorLocation = adUseClient
mConOracle.ConnectionString = "Provider=OraOLEDB.Oracle.1;Password=123;Persist Security Info=True;User ID=abc;Data Source=aaa;OLE DB Services=-1; "
mConOracle.Open
mConOracle.Close
Set mConOracle=NothingOk,
I tried out connection pooling switching on/off. Also waited some minutes for the pool timeout. But nothing happened.
So I made some further tests and this is what I found out:
- The left handles are all semaphores
- To generate a handle leak it is necessary to create an ADO object, call connect and do a database query. Actually some data must be transmitted over the network. Then close connection, release ADO object. -> 2-3 semaphore handles are left.
- Handle leak occurs indepentendly of apartment or multi threaded
- MDAC 2.7, MDAC 2.8 was used with no success
However, we hat one piece of software here, which didn't have handle leaks. So I did some more investigation on that phenomena.
This is what happened and could be used as a workaround until a fix is available:
- I recognized, that if at least one connection (which has been really established once by the underlying components) has been opened and is kept open, it is possible to create more ADO objects, use them for database retrieval and release them again without having the handle count increased.
- So the handle leak seems only to occur, if there is no more database connection in use and one of the underlying components tries to release everything. Each time this happens 2-3 semaphore handle are left.
- Finally my current workaround is to create and open on initalization of my process an ADO object and the database connection and leave this object alone without touching it again until the process ends. For every database query in any thread I can now use a new ADO object, without having the handles increased and never released.
So, this is the end for now. I hope this information can help somebody to figure out where the problem is eventually located and a fix could be released.
Hopefully,
Markus (writing under Uwes account) -
Using cr for vb 2010 and cr for 2012 on same development computer
I have applications in vb.net 2010 and am going to install vs 2012 on the same development machine. Can I continue to create reports for 2010 and 2012 on same development machine. Will I then have both cr for vs 2010 and cr for vs2012 on the same development machine with separate references to each vb.net version. Is that correct? Both visual studio versions will now be using the framework 4.5 as I understand when both are installed on same machine. Is there anything regarding this that would involve separate steps installing Crystal?
Is there anything else I need to do regarding crystal in terms of installation that would be different? I know there was a problem with having vs 2008 and vs 2010 with the different crystal versions on the same development machine . I gather this is not the case now?
ThanksHi Suzanne,
CR for VS 2010 and CR for VS 2012 are not different products. Its the same product called as
SAP Crystal Reports developer version for Microsoft Visual Studio which works with VS 2010, VS 2012 and VS 2013.
Yes, you could install VS 2010 and VS 2012 on the same machine and then simply install CR_VS_13.0.10.exe (SP10) from above link. This will integrate with both VS 2010 and VS 2012.
You could develop your apps saparately with both VS versions however the CR assembly references would be the same for both VS apps as its is the same CR version.
- Bhushan
Senior Engineer
SAP Active Global Support
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
Getting started and moving ahead with Crystal Reports .NET applications.
Maybe you are looking for
-
Lookup DSO in Start Routine and End Routine to update date
Hi Gurus, I need a Start Routine & help, while loading the data from DSO to Info Cube. In the DSO ( /BIC/AZSD_O0300 ) & in the InfoCube I have a common fields are 0DOC_NUMBER ( DOCUMENT NUMBER), 0S_ORD_ITEM ( Sales Document Item Number ), 0SCHED_LINE
-
Insert animated gif or flash files (.swf) in Form?
How can i insert animated gif or flash files (.swf) or another type of animated files in Form?
-
Problem with contacts after upgrading to iOS 7 (iphone 5)
After upgrading to iOS 7 (iphone 5), the contacts (loaded from icloud) in greek language aren't sorted!!! They are under the # symbol!! Anyone has a solution. I didnt have this problem with previous iOS versions!!!!
-
How to get the attribute of a selected row in a label
Hi all, I am using Jdeveloper 11.1.1.2 and ADF. I have a table with two columns, Id and Name. Furthermore I have an outputText where I would like to see the field Name of the selected Row in the table. How have I to set the property "value" of the ou
-
Creating a movie in widescreen format.
Hello, I have a question, I'm hoping that someone can help me out. I have created a movie in iMovie, what I need is to create a file that I can transfer over to my PC and then play it on the PC. When I have done this, I have created a AVI file (4 min