|
When the form becomes the active form, you should get an Activated event. We would need to see your code if something is not working right.
|
|
|
|
|
I am working on a project which communiactes with a Radio Device (WR G303e Radio Receiver)connected to PC via USB.
I comes with an API WRG3API.DLL implemented as a 32-bit driver.
In the SDK it has examples for Delphi and C/C++.
My Question is.....
How can i import/communicate (with) this dll to work in C#.
I am looking for some1 2 reply... please help me if any1 out there has any info about this issue...
Kind Regards
t4urean
|
|
|
|
|
I would wrap up the appropriate C++ functions in Managed C++ and then access the managed code from C#
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote: would wrap up the appropriate C++ functions in Managed C++ and then access the managed code from C#
Ant.
do You mean that i have 2 implement all the functions in a c++ class and then import it in c#?
I am a newbie so i didn't actually understand what do u mean. Can u give me example to make me understand more quickly....
Kind Regards
t4urean
|
|
|
|
|
See Nish's article on C++/CLI[^]. Basically, it allows you to compile C++ and expose certain functions to pure managed languages, such as C#.
In C++/CLI, define a C++ class like this:
public ref class MyClass
{
void DoSomething()
{
}
};
Build this C++/CLI class a .dll.
In C#, add a reference to the C++/CLI dll you just built. You can then call the DoSomething method as if it were written in C#. It's really great. Go read Nish's article linked above. There's another article[^] over at MSDN as well.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: How 'bout a little guitar now?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I understand your idea...
I have 2 define/call all the functions which I need, from the API in c++ class and then include that class in a c# project.
Can you tell me that wouldn't it be better to directly call the functions from the API in c# (I think there is "dllimport" which I am not totally familiar with).
The reason is that my project deals with real time data and I need high speed response. Using indirect function calls may slow up the process???
... What is your opinion ....
Please comment ASAP
t4urean
|
|
|
|
|
t4urean wrote: unc
C++/CLI is far faster than using dllimport (which is part of P/Invoke). If you read Nish's article linked above, you could see the performance results yourself.
|
|
|
|
|
Hey, I’m trying to search for an ID and get the results from two tables as you can see in the below code.
The problem is that the fields that I save in dataset are from two tables but what can I do about datasource for my DatagrideVeiw there is no specific table ??!!
And when I use this code
dataGridView1.DataSource = myDS;
It doesn’t show anything !!!
string cmd = "SELECT UniversityDB.ID, UniversityDB.UniID, UniversityDB.UniCode, UniversityDB.UniName, UniversityDB.UniAddress, UniversityDB.UniDetail, UniMajorDB.Major, UniMajorDB.Level " + <br />
"FROM UniversityDB INNER JOIN UniMajorDB ON UniversityDB.UniCode = UniMajorDB.UniCode = '" + UniCode_tb.Text + "'"; <br />
<br />
MyAd.SelectCommand = new OleDbCommand(cmd, MyConn); <br />
MyAd.Fill(myDS); <br />
dataGridView1.DataSource = myDS.Tables[TableName];
can you help me out or if there is another way to show the results in DataGridView please let me know.
Thanx
Mr.K
|
|
|
|
|
mrkeivan wrote: dataGridView1.DataSource = myDS.Tables[TableName];
And finally you should call:
dataGridView1.DataBind();
|
|
|
|
|
I did that but i had this error
System.Windows.Forms.DataGridView' does not contain a definition for DataBind
what is this Databind ? what does it do ?
and the thing is that there is no table, I get the fields from two diffrent table, so what should i replace tableName with ??
Mr.K
|
|
|
|
|
Hi,
My first post here so I hope it is in the right place.
Here it goes:
Lets say I have two bitmaps. One of them is smaller than the other.
Now I want to find out if the smaller bitmap occurs somewhere "inside" the other bitmap.
How am I going to do that? I cant be to demanding, because I want some speed...
I have tried filling arrays with the bitmaps color-values and then comparing them pixel by pixel. Cant seem to get it to work properly...(maybe someone could show some code?)
Im getting very annoyed by this.
Thanks for any help. I need it.
HjalleBK
|
|
|
|
|
There are many algorithms out there for bitmap matching. The solutions generally are not trivial.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Yeah I have found a lot of those, but there is a big difference betweeb comparing two bitmaps and finding a bitmap inside another, but maybe its just me being stupid.
HjalleBK
|
|
|
|
|
Yes, matching partial bitmaps is very different to comparing two bitmaps. As I said there are a lot of algorithms out there to do this.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
It would be nice if you could direct me to some of them... I find it hard to find them...
HjalleBK
|
|
|
|
|
It may help you to look for Template Matching.
Boyer-Moore, Rabin-Karp, Knuth-Morris-Pratt algorithms. Will provide almost exact matching capabilities. Wikipedia is a good source of information:
http://en.wikipedia.org[^]
I have read about pattern matching out of interest. The subject is huge, I have not written any code personally so I can not share any with you.
Hope this helps.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
How do I communicate with a USB device.... in my C# code to read data.
Its a USB Radio Receiver WiNRADiO WR-G303e ...
It gives digitized RF signal.. which i have to read and display as a graph.
All this is to be done in Real time. I mean it will be continuous streaming
|
|
|
|
|
|
Does anyone have an example of how to read the Height and Width of a JPG file using .NET and c# BUT without loading the image into memory?
I have seen examples in C++ but have failed to translate the code. I know I need to read the binary file stream and look for the headers but have still got problems doing this.
Any help would be much appreciated.
Regards
Richard
|
|
|
|
|
Hi all, i have to put all my assemblyes into a subdirectory of my projects, it is possible for my program to call the assemblyes that i use into a different location than the root of my project?
Thanks all
|
|
|
|
|
peppepinna wrote: it is possible for my program to call the assemblyes that i use into a different location than the root of my project?
Yes. it's possible.
Try this code:
<br />
Assembly asm = Assembly.LoadFrom(filename);<br />
Type[] types = new Type[0];<br />
types = asm.GetTypes();<br />
<br />
foreach (Type t in types)<br />
{<br />
if (t.FullName == "SomeType")<br />
{<br />
object obj = Activator.CreateInstance(t);<br />
}<br />
}<br />
|
|
|
|
|
Hi there.
I am wondering how does one use another application in an application that one is writing.
Let´s say I am writing a program, A, and when a button is clicked it needs the functionality of another program, B. How does one go about making program A use program B when needed.
Any help is greatly appreciated and short examples even more appreciated.
Thanks,
F
|
|
|
|
|
It really depends on what you are trying to do. Here are two possible solutions:
- Break the needed features into a component library that both applications can share. If this is possible, this is preferable.
- Another approach might be to spawn a new process to run the application, but communication between the two applications is some what limited.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp
Beyond those general (and very different) approaches I'd need more information about what your trying todo.
Hope this helps
Marc L
|
|
|
|
|
Thanks for your answer.
When the user presses a button several things need to happen one of which is using a program (I have that one) that converts a .tiff file to a .pdf file and stores it in a folder of the users choosing (I had a TreeView in mind to let the user select a directory).
Also, can you elaborate a little on the two solutions you suggested?
Many thanks,
F
|
|
|
|
|
Sure, the different approaches are based on whether the .tiff to .pdf converter program can be used inside your application or do you need to 'run' the other application.
1)Ideally what you want is the .tiff to .pdf conversion to be done by an object in your application.
So if you can create/add a reference in your project to the converter program, what do you get? If the reference is created you can browse the exposed objects. Right click on the reference (in the solution explorer) to bring up the object browser (Visual Studio 2003). Then you have the task of understanding what objects to use and what they'll do for you. (Hopefully there's documentation)
2) If the other application can't be used as a reference then you will need to 'run' it outside your application. Use the link from the previous post to review how you can write code to run the application in a new process.
Hopefully the converter program takes commandline input that can be set in the StartInfo.Arguements property.
Hope that helps
Marc L
|
|
|
|