I want to extract frames from video files without playing them. I used the GetCurrentImage of IBasicVideo2 to extract frames of videos as thumbnails of them. I Successfully extracted frames from video files of the format of WMV, AVI, DAT, ASF except MPG and VOB. When I extract frames of MPG and VOB files, It returns black frames.(The frames extracted are Successfully saved as bmp image files on my pc. however, they are all black frames.) Why??
Here is my code:
/// Window1.xaml 的交互逻辑
public partial class Window1 : Window
Usually you don't write unit tests for DAL. You should write tests for business layer. If it involves calls to DAL, it should be mocked. IMO, writing unit tests after completing the project is very tough. Your classes might not be test friendly and refactoring will be a pain.
Hi, I am trying to connect to Sybase SQLAnyWhere DB from C# using ODBC Data Connection.
I am getting the below error.
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Can anyone tell me the reason for that ?
Error Report :
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.UnsafeNativeMethods.SQLExecDirectW(OdbcStatementHandle StatementHandle, String StatementText, Int32 TextLength)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object methodArguments, SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
I have a list of command strings.
I am exceuting the following commands in for loop.
foreach (string str in stringlist)
OdbcCommand defineTankCMD = Conn.CreateCommand();
defineTankCMD.CommandText = str;
OdbcDataReader defineTankReader = defineTankCMD.ExecuteReader();
Is it OK. some times it is working fine and some times it was giving error.
I would like to know how can I get access to the Non-Public members of a class. In this case it is the
CellPaintinEventArgs of a DataGridView control that I would like to be able to access outside of the CellPainting event.
I know it's not common practice or even if it's possible, but I would like to call the CellPainting event directly and pass in the DataGrid and CellPaintingEventArgs myself.
Reason being is I am trying to improve the performance (efficiency) of the CellPainting event for the DataGridView control. From a little experimentation, I have discovered that the CellPainting event fires for cells that do not require updating. I am using DataGrids that can take up the entire display of a 19" Wide display and sometimes only a few cells need updating yet depending on the location of those cells, many more cells appear to be repainted unnecessarily. This noticeably slows the updating of the grid. The data is not bound to the grid and no rows or columns are added or removed from the grid. In other words the grid size remains static so there is nothing extreme happening that would force the grid to repaint most of its cells.
The code below illustrates this. Use the default names for the components on the form. Also stretch out the grid so there's no need to scroll. Just click on different cells to change the current selected cell and you will notice that the counter reveals how many times the CellPainting event is fired for something as trivial as this! Click on the first cell and then click on the last cell, the counter increments as many times as there are cells on the grid!
publicpartialclass Form1 : Form
privateint counter = 0;
privatevoid Form1_Load(object sender, EventArgs e)
dataGridView1.RowCount = 10;
dataGridView1.ColumnCount = 10;
for (int column = 0; column < dataGridView1.ColumnCount; column++)
dataGridView1.Columns[column].Width = 50;
dataGridView1.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridView1_CellPainting);
privatevoid dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
label1.Text = counter.ToString();
privatevoid button1_Click(object sender, EventArgs e)
counter = 0;
label1.Text = counter.ToString();
Do I have to override the accessibility of the CellPaintingEventArgs to be able to do this?
I found this link, don't know if it will help or how to use it:
Can any body suggest me how to do that. I am clear in the Logic part. UI is the problem. It will be more helpful if you could provide sample codes. (I am not meaning to change the colors dynamically, instead change the appearance of controls and their positions dynamically)