|
Hi, I'm not sure where this questions belongs, so I posted it in the C# and C++ boards.
My goal is to create a C# COM Object that will act be a source for an unmanaged C++ sink. I followed the guide that I found at http://support.microsoft.com/kb/313891 to create the C# object, but I was unable to get callbacks from the resulting .NET component with my C++ client. I have found that I can get the C++ client to work if I have a "SetCallbackFunction( IntPtr callbackFunctionPointer )" method in the C# code, but this solution is not acceptable for my project. Is there any way that I can get events working correctly using the technique described in the link I provided earlier? If not, is there any way to fire an event in C# and have the C++ handle it without a set function method? I'm used to the ConnectionPoint stuff for COM objects, but that doesn't seem to apply here. Thanks for the help.
|
|
|
|
|
I do not pretend to know, but I believe you should not try to deviate from the SetCallbackFunction guidelines. Because this is the intended vehicle, I would anticipate that just about anything else you might try to do will still be relegated to having to pass through a SetCallbackFunction portal. If not, you would find alternative methods documented -- assuming the ludicrous of course... that things will be so plainly documented.
Breaking intended patterns doesn't often work. Usually instead (if practice needs to depart from a pattern), they need shored up to work well, or even to accomplish what is intended of them.
Parts of your question lean toward writing the whole thing in C++. It is not clear why you wanting to use C#, or if this is the place to interface between what you can do in the different languages.
|
|
|
|
|
i am working on a software... the main purpose is to capture audio and video then send them through network using UDP protocol then the receiver preview it ... so it is a live capture...
i really need the source code .in C# is better. i have searched the articles but found nothing pleas i am running out of time
thanks allot
|
|
|
|
|
Try this out, number 9 should help...
School Help[^]
Good luck.
|
|
|
|
|
do not worry about number 9...
thanks any way
|
|
|
|
|
marwan_siala wrote: pleas i am running out of time
If this is your work, you should never take on a job unless you know how to do it, or what resources you need to do it.
If this is school work, your class will have given you all the information you need.
Audio/Video capture happens using DirectX. I know for a fact there are many resources on this site in this regard. Sending information through a network connection should not be difficult, and playing video on the other end is trivial.
No-one here is going to write your project for you, if it's due now, you should have realised sooner that you were stuck, and asked questions to help you get the info you need to do your own work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i am just asking if some one already did what i am looking for as i said i am running out of time cuz i have a lot of other works to do...
how ever Audio/Video using DirectX ,i have already take it from an article witch is working properly and Sending information through a network connection is really pace of cake ... but the problem as i figured out that DirectX can not deal with network connection so there must be another source.
i have posted a request
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=1896415&df=100&fr=1175.5#xx1896415xx
thanks any way
|
|
|
|
|
marwan_siala wrote: i am running out of time cuz i have a lot of other works to do...
So how is passing off someone elses work as your own going to help? What are you going to do when the code breaks and you have no idea how it works?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: So how is passing off someone elses work as your own going to help?
i believe we are all here to help each other and if i got this work from some one else i will not say it is mine... that is not my manners
Dave Kreskowiak wrote: What are you going to do when the code breaks and you have no idea how it works?
i know this code is not a big deal... and i know it is understandable by any one.
|
|
|
|
|
marwan_siala wrote: i believe we are all here to help each other and if i got this work from some one else i will not say it is mine... that is not my manners
We're here to help you write your own code. Not just hand over something prewritten for you.
marwan_siala wrote: and i know it is understandable by any one.
Wanna bet?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
It's not a big deal AND it's understood by anyone, yet he can't write it ?
I am convinced that there is a subset of CPians that represents people who take RentaCoder jobs then post questions here to get them done. I'm also convinced that you and I will have jobs for a long time, judging by how many people post homework here, verbatim.
You're not summitting, are you ? I leave next Friday.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: It's not a big deal AND it's understood by anyone, yet he can't write it ?
My point exactly!
Christian Graus wrote: I am convinced that there is a subset of CPians that represents people who take RentaCoder jobs then post questions here to get them done.
You know, I haven't thought of that, but your absolutely right. I'd be willing to bet that's exactly what's going on!
Christian Graus wrote: You're not summitting, are you ? I leave next Friday.
No, I'm not I'm still working 60-80 a week pulling my hair out over what other people are building and calling "Production Quality". Sadly, it's my yob to support the crap they put out and call "tested".
I have sweatshirt I'm seriouly thinking of wearing to work. Acrossed the front it say "Is it me, or is this place a festival of idiots?";)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
ok i have gain time extension... and i am stuck here...
as i said i am using c# .net 2005
i need to convert Byte[] to network stream .. how is that
thanks
or better convert Byte[] to image ( using System.Drawing )
-- modified at 11:52 Monday 26th February, 2007
|
|
|
|
|
Hi All,
I am using datlist on the basket page, in the i have a text box for quantity.
as you all know that there will be multiple lines in the basket i just get the dataset and bind that to Datalist.
I have to validate the textbox quantity to accept only the numberic chars. I was trying to capture the kedown event which i cannot use as the textbox is bound on datalist.
Can any one give me some suggestions of advice how to hadle this.
|
|
|
|
|
Hi all
iwant to know that cn an application have two or three parent forms??
i have a MainForm which is my current parent form. i have form1, form2, form3, form4 which are child to the MainForm.
now i want my form2 to be child to form1 and form1 to be child of MainForm.
how can i do this? if this is just not possible then plz tell me whether my application can have two parent forms like this:
MainForm ---> form1, form2
Form3 ----> form4
|
|
|
|
|
It's not really clear what you're talking about so...
There can only be one top level startup form. This form holds your application's message pump. If this form gets closed, your entire application closes with it.
Now, the rest depends on what you mean by Child forms. If you simply launching a child form by creating a new form object and showing it with .Show() or .ShowDialog() , then you can have multiple levels of children, like this:
Startup Form
|
+--->Main Form
| |
| +--->Child Form
| |
| +--->Child Form
| |
| +--->Child Form
|
+--->2nd Main Form
|
+--->Child Form
|
+--->Child Form
If you're talking about MDI Child forms, you can have multiple parent forms, each with it's own set of MDI Children. But, under Windows, it's impossible to have an MDI Child be a MDI Parent to another MDI Child form. In other words, a form cannot be both and MDI Child AND MDI Parent at the same time. You can do this:
Startup Form
|
+--->MDI Parent Form
| |
| +--->MDI Child Form
| |
| +--->MDI Child Form
|
+--->2nd MDI Parent Form
|
+--->MDI Child Form
|
+--->MDI Child Form
You CAN NOT do this:
Startup Form
|
+--->MDI Parent Form
|
+--->MDI Child Form
|
+--->MDI Child Form
|
+--->MDI Child Form
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi plz tell me if this is possible
Startup Form <br />
|<br />
+--->MDI Parent Form -->MDI Child Form-->Child Form
now what i wanted to know was that can the Child Form be an MdiChild of the MDI Parent Form and the Child Form at the same time?
|
|
|
|
|
Yes, it is. An MDI Child form can launch an instance of another form, so long as the MDI Child does not try and become an MDI Parent to that new form.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Is it even legal to have a parent-child relationship anymore?
|
|
|
|
|
What's the best way of storing an application setting to read it later? Do I have to resort to a text file or is there some better way with .NET 2.0?
|
|
|
|
|
I would store them in the app.config file.
// Get the application configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
///Make changes to the config file. Perhaps in someplace like appSettings
//then save
config.Save();
Hope that helps.
Ben
|
|
|
|
|
Depends on your needs. If it's simple data, use an App.config or the Web.config if you're doing a web app. You can just add keys to them which are easy enough to retrieve.
<configuration>
<appSettings>
<add key="field" value="1" />
</appSettings>
...
</configuration>
Then in code you can access them with something like...
string field = System.Configuration.ConfigurationSettings.AppSettings("field");
But if you have more complex data that you need to store, I usually do my own XML structure and use something like Skeleton Crew[^] to build a code model to use it with.
|
|
|
|
|
Which is better?
1. Set a member of a class as public
<br />
public class SearchBox<br />
{<br />
public string keyWordString;<br />
<br />
public SearchBox()<br />
{<br />
}<br />
}<br />
-or-
2. Set a member of a class as private and create a public property for that member.
<br />
public class SearchBox<br />
{<br />
private string keyWordString;<br />
<br />
public string KeyWord<br />
{<br />
get<br />
{<br />
return this.keyWordString;<br />
}<br />
<br />
set<br />
{<br />
this.keyWordString = value;<br />
}<br />
}<br />
<br />
public SearchBox()<br />
{<br />
}<br />
}<br />
Both options do the same action. What are the advantages/disadvantages of one over the other?
Thanks
Rob Tallent
|
|
|
|
|
Always use Public properties. It is good OO design along with allowing you to only give out what is needed. It is easy to change the public property to readonly by removing the set method. You can't really do that with the Public Var. Also the public method allows you to do some extra coding if needed. Perhaps in the Get method you have some stuff like:
if (this.keywordstring == null)
{
//get default from where ever...
}
Anyway that is my two cents.
Ben
|
|
|
|
|
Encapsulating your data members by hiding them and exposing a property lets you control access to the member. Just a public field allows somebody to put any value in the variable, which may or may not be a valid value for the class.
All your classes should have well defined expected input. It should be able to guaranty a valid result given expected input, so you have to be able to control that input and notify when the input is invalid.
Does that help?
|
|
|
|