|
Is there a way to monitor the information sent to a specific USB channel and mimic it?
I love to program!
|
|
|
|
|
The short answer is no.
The long answer is yes, but with extreme difficulty. Requiring something like kernel-level debugging techniques to intercept/shadow calls to the USB driver. AFAIK, there is no way to monitor the serial bus directly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi, i built a PVR a few years ago and its running the latest version of GBPVR, and im not exactly pleased with its support for multiple cards (particularly the softwares ability to change channels, theres no effient way to use 1 device to change the channels of the tv, its long and complicated, but its not easy...) in any case, is there a way that i can capture input from a tv tuner card and save it as an Mpeg?
|
|
|
|
|
kb1ibh wrote: in any case, is there a way that i can capture input from a tv tuner card and save it as an Mpeg?
You can try playing with GraphEdit, then use DirectShow.NET. I have not done this myself, but would love to...
kb1ibh wrote: im not exactly pleased with its support for multiple cards
From messageboards, it appears BeyondTV has the best multiple tuner support, but thats not free
|
|
|
|
|
Hi,
Is it possible to declare an enum-type at runtime???
/Besinci
|
|
|
|
|
Sure. CodeDom or Reflection.Emit?
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Do you have some code sample pls
/thx
|
|
|
|
|
Sure:
CodeTypeDeclaration ctd = new CodeTypeDeclaration("MyEnum");
ctd.IsEnum = true;
ctd.Members.Add(new CodeMemberField("int", "Value1"));
ctd.Members.Add(new CodeMemberField("int", "Value2"));
CodeNamespace cn = new CodeNamespace("MyNamespace");
cn.Types.Add(ctd);
CSharpCodeProvider prov = new CSharpCodeProvider();
ICodeCompiler comp = prov.CreateCompiler();
CodeCompileUnit ccu = new CodeCompileUnit();
ccu.Namespaces.Add(cn);
ccu.ReferencedAssemblies.Add("System.dll");
CompilerParameters cp = new CompilerParameters();
cp.OutputAssembly = "MyAssembly.dll";
cp.ReferencedAssemblies.Add("System.dll");
cp.GenerateExecutable = false;
CompilerResults cr = comp.CompileAssemblyFromDom(cp, ccu);
if (cr.Errors.Count > 0)
throw new Exception("Compile Errors!");
Assembly asm = cr.CompiledAssembly;
Type t = asm.GetType("MyNamespace.MyEnum", true, false);
foreach (string s in Enum.GetNames(t))
Console.WriteLine(s);
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
I use this code:
try
{
panelImage = new Bitmap(panelFileName);
}
catch (ArgumentException)
{
MessageBox.Show("FILE NOT FOUND:\r\n\r\n" + panelFileName);
Application.Exit();
}
and it catches the error of the file not existing, but it does not exit the application. What am I doing wrong?
Thanks
|
|
|
|
|
Are you executing this code in the constructor of your main form? In this case Application.Exit won't have an effect as Application.Run wasn't called yet.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Application.Run() was called in program.cs, but this is in the constructor of the form it ran, so this is the problem. Thanks
|
|
|
|
|
Don't fail inside of a constructor. It isn't good practice. Move failure prone code outside of the constructor and call it seperately to initilize the class. Also, Application.Exit is a bad way to exit your application. Any error that requires an exit should bubble up till it can be handled gracefully allow the application to then exit via normal channels.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Problem is that during construction of your form, Application.Run(..) isn't executed yet as where are in the state of creating the form object that gets passed into. So you cannot exit what isn't running yet.
So either move the code into an event handler for the forms Load event as suggested by the others or even put the check for crucial files inside the main method before you call Application.Run(..) . Additionally I suggest using File.Exists which is much nicer than catching exceptions.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Ah, ok... the Load handler... I forgot all about that and didn't pick that up in the other posts ( I must have been to tired ).
Also, I was trying to find the File.Exists thing, but couldn't so appreciate that one too. Now I can do that before he exception. Only reason I used that was that was the only exception thrown by the Bitmap().
Patrick
Appreciate all the help and feedback guys. The learning curve is steep.
|
|
|
|
|
I had a similar problem using VS2005. I presume your program keeps running until an error is evoked because of the missing file?
I moved the try/finally block out of the initialize program section into the MainForm_Load section and then it worked as it was supposed to.
Glen Harvy
|
|
|
|
|
I was running this from inside the constructor which I wanted to abort if the file wasn't present. But it seems I'll have to wait till out of the constructor.
Thanks
|
|
|
|
|
Okay, this is pretty complicated so let me see if I can try to explain my problem.
First I have an enumeration:
Enum BracingMemberTypes As Integer<br />
FirstItem = 0<br />
Diagonal = 0<br />
Horizontal = 1<br />
Internal = 2<br />
SubDiagonal = 3<br />
SubHorizontal = 4<br />
SubInternal = 5<br />
TopDiagonal = 6<br />
BottomDiagonal = 7<br />
TopSubHorizontal = 8<br />
BottomSubHorizontal = 9<br />
LastItem = 9<br />
End Enum
I have a file called clsSection with this declaration:
Protected m_BracingMembers As New clsBracingMemberDictionary
In the same file I also have some properties. I'll only show a couple:
ReadOnly Property Diag() As clsBracingMember<br />
Get<br />
<br />
'10-Aug-2006 Changed to use the dictionary LLS (1 of 10)<br />
If m_BracingMembers(BracingMemberTypes.Diagonal) Is Nothing Then<br />
m_BracingMembers(BracingMemberTypes.Diagonal) = New clsBracingMember(Me, BracingMemberTypes.Diagonal)<br />
<br />
End If<br />
Return m_BracingMembers(BracingMemberTypes.Diagonal)<br />
End Get<br />
End Property<br />
<br />
ReadOnly Property TopDiag() As clsBracingMember<br />
Get<br />
'10-Aug-2006 Changed to use the dictionary LLS (2 of 10)<br />
If m_BracingMembers(BracingMemberTypes.TopDiagonal) Is Nothing Then<br />
m_BracingMembers(BracingMemberTypes.TopDiagonal) = New clsBracingMember(Me, BracingMemberTypes.TopDiagonal)<br />
End If<br />
Return m_BracingMembers(BracingMemberTypes.TopDiagonal)<br />
End Get<br />
End Property
I need to create a copy function so I can have two objects and compare them. This is what I have thus far:
For i As Integer = BracingMemberTypes.FirstItem To BracingMemberTypes.LastItem
If Not .BracingMembers(i) Is Nothing Then
m_BracingMembers(i).Copy(.BracingMembers(i))
End If
Next
Basically what I am doing is looking up the bracing information. There are different bracing configurations such as X. The problem is that in the X bracing, some of the types of the enumeration do not exist. It has a diagonal (0), horizontal (1) but once it gets to internal (2) I get the null reference object error which makes sense.
This is not my code, my boss wanted me to change the code using a dictionary object.
Any ideas how to fix this short of using if statements based on the bracing configuration?
Is there a real benefit to using dictionaries? (VB programming dictionaries before the jokes come in. )
-- modified at 17:48 Friday 11th August, 2006
|
|
|
|
|
|
D'oh!
Sorry about that!
|
|
|
|
|
Hello,
I am trying to create columns in a datagridview which will have couple of textcolumns and one ComboColumn.
I am trying to add a class to the combo column. This class contains an ID column and a description column. When the user selects the item in combo column i want to extract the ID from the selected object.
But after populating the grid with my class, and selecting the dropdown, I am getting an error
"System.ArgumentException: DataGridViewComboCell value is not valid".
I have no code written in any of the events in the grid.
Any help is highly appreciated.
Here is my code snippet
datagridview1.ColumnCount = 2;
DataGridViewComboBoxCell dgvCell=new DataGridViewComboBoxCell();
//clsCombo is my class which has a constructor ID and Description
clsCombo objCombo = new clsCombo("1", "Male");
dgvCell.Items.Add(objCombo);
objCombo.ID = "2";
objCombo.Description = "Female";
dgvCell.Items.Add(objCombo);
objCombo.ID = "3";
objCombo.Description = "Other";
dgvCell.Items.Add(objCombo);
DataGridViewRow dgvRow = new DataGridViewRow();
dgvRow.Cells.Add(dgvCell);
datagridview1.Rows.Add(dgvRow);
Thanks
Siva
|
|
|
|
|
I've developed an application in C# that reads an Excel worksheet every second using Interop.Excel (Microsoft Excel 9.0 Object Library) (below is part of the code). This worksheet has many formulas and is also being fed by a DDE from another application.
It works fine for some hours but suddenly I receive the following error and Excel crashes:
Microsoft Excel - MySpread.xls: EXCEL.EXE - Application Error : The instruction at "0x301833e4" referenced memory at "0x12480010". The memory could not be "read".
I have the same spread being read by a VB6 application that uses Microsoft Excel 9.0 Object Library and it has never crashed, so I think the Interop.Excel is the problem here. Any hint?
Thanks.
public class Class1
{
public Class1()
{
}
private Excel.Application _excelApp = null;
private Excel.Workbook _myWorkbook = null;
private Excel.Worksheet _myWorksheet = null;
public void open()
{
_excelApp = new Excel.ApplicationClass();
// opens _myWorkbook and _myWorksheet
_myWorkbook= _excelApp.Workbooks.Open("MySpread.xls",
Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
_myWorksheet = (Excel.Worksheet)_myWorkbook.Sheets["Sheet1"];
}
public bool readSpread()
{
// gets data from A7 to AR60
Excel.Range oRng;
oRng = (Excel.Range)_myWorksheet.get_Range("A7", "AR60");
if (oRng==null) return false;
object[,] data = (object[,])oRng.Value2;
// extracts each value
string sProduct;
double dbPrice;
for(int r=1; r<=data.GetUpperBound(0); r++)
{
sProduct = Convert.ToString(data[r,1]).Trim();
dbPrice = Convert.ToDouble(data[r,4]);
//(...)
}
return true;
}
}
|
|
|
|
|
I have a tab control and on that control I want to have a submit button displayed regardless of the tab I choose - the submit button is always on top in the client area.
Please point me to documents / example of doing this.
Steve
|
|
|
|
|
Maybe I am missing what you are saying but can't you just put the submit button outside of the tab control?
Cheers
Disgyza
Programmer Analyst
|
|
|
|
|
I could do that. The situation is that I have multiple tab controls for different functions and the submit button is for the associated tab control.
Maybe a better idea is to have a submit button on each tabs client area because that is the information that is to be processed. Is there a way to make the same button appear, drawn, on the tabs client area when the tab is selected?
|
|
|
|
|
I don't think there is a way to draw the same control, but you can link the event handler of each submit button to one handler method.
sas9491 wrote: the submit button is for the associated tab control
Then why again does it need to be on top?
-- modified at 15:24 Friday 11th August, 2006
Cheers
Disgyza
Programmer Analyst
|
|
|
|