|
Fu Chen wrote: Ohh, it just a function not a method in COM object.
Then why does it return a HRESULT ?
Fu Chen wrote: Maybe it is a good idea to first pack it into a COM and use this function as a part of COM object.
In my book, that's a much easier way to get C# interop than using MC++, unless you either don't know anything about COM, or know at least as much about MC++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi..
Anyone there could help me out with some design problems i encounter... I need to design a web page using C# web application but somehow i am unfamiliar of the toolbar i'm using.I'm design a web page jus like a user log in and retriving data out.. Anyone who has done this similiar project as me don't mind sharing with me.. Thankz..
Thank =)
|
|
|
|
|
Cheese_kid wrote: but somehow i am unfamiliar of the toolbar i'm using
How do you mean ? What toolbar ?
Cheese_kid wrote: Anyone who has done this similiar project as me don't mind sharing with me.. Thankz..
What do you have so far ? Have you used ASP.NET at all before ? it sounds to me like the tutorials on this site, or the MSDN site ( msdn.microsoft.com ) would go a long way to answering your questions.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Here is a gateway. The TCP/IP Property of my Ethernet card has set the IP address of the gateway.All my ip packet outside the LAN is resent by the gateway.
Now I want to create a proxy server and want to resend all the request of client to the gateway.Then return the response of the gateway to the client.
If the request is HTTP , I have to parse the content.
Is there a method by which I need not parse the content , just only resend?
Thanks!
|
|
|
|
|
I'm having a relatively complex problem with the PropertyGrid. Here it is:
I've got a complex class heirarchy. Each object in the heirarchy is easily referenced/retrieved by Guid (they all implement a common interface that has the Guid as a property). I've created a custom PropertyConverter to get the list of possible values that the object should allow (it pulls this from the object heirarchy). I've also created a custom property descriptor object that will return my custom property converter if the property's values are pulled from the object heirarchy. The object in question that I'm using to test also implements ICustomTypeDescriptor. The only method not passed off to the static TypeDescriptor object is the GetProperties() method. Instead of using the standard property descriptor, I'm using my custom property descriptor.
Now, here's the deal. I can get a string description of the appropriate objects to appear in the drop down list in the property grid. However, when I select a value, I get an error indicating that it couldn't convert from the data type in the property grid to the type of object I want. What I would like to do is retrieve the Guid of the object I selected. Do I just need to implement the CanConvertFrom, CanConvertTo, ConvertFrom, and ConvertTo methods in my PropertyConverter? Obviously, the selected value will need to be converted back to be used in the PropertyGrid as well.
Is this the right approach?
Thanks,
Will
|
|
|
|
|
I wrote the following code:
class Class1
{
[STAThread]
static void Main(string[] args)
{
Class1 x = new Class1();
x.DoIt();
}
public void DoIt()
{
try
{
Class2.GetIt();
}
catch(Exception)
{
}
}
}
public class Class2
{
static Class2()
{
throw new InvalidCastException("dummy");
}
public static string GetIt()
{
return "";
}
}
In .NET 1.1 the static ctor exception is not caught and whole application crashes. In .NET 2.0 it catches the exception, and everything is fine.
Is this a bug in 1.1 that was fixed in 2.0, or "by design" which is different between the .NET versions?
Anyway, how can I catch a static ctor exception in .NET 1.1?
Ami
-- modified at 16:30 Sunday 23rd October, 2005
|
|
|
|
|
Ofcourse it will crash, because there is no static classes in .NET 1.1, you can't make a class static.
The difference will be in http://www.msdn.microsoft.com/netframework.
"Praying." Is this only what I can do for him ?
|
|
|
|
|
You're wrong. He's not making a static class ( which is just a bit of syntactic sugar in C# 2.0 ), he's creating a static constructor, which you can most definately do in C# 1.1.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
OH, sorry, I've read the code wrong, .
"Praying." Is this only what I can do for him ?
|
|
|
|
|
Ami Bar wrote: Anyway, how can I catch a static ctor exception in .NET 1.1?
It actually works for me in VS2003 (C#1.1) I can't imagine why it would not work for you. I just copied and pasted your code into a new project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: It actually works for me in VS2003 (C#1.1) I can't imagine why it would not work for you. I just copied and pasted your code into a new project.
I've just checked the code again to make sure, and it still crashes. I've even cleard all the exceptions (Debug -> Expections... -> Clear All).
When I run it in debug, it breaks into the debugger pointing to the 'throw new InvalidCastException("dummy");' statment.
Ami
|
|
|
|
|
Oh, I see. Yes, I don't think there's ever any guarentee as to when a static constructor will be called, only that it's called before your class is used. As such, you are probably right, and the problem is that the language spec does not help you even remotely, you can't count on being able to throw an exception in a static constructor and catch it. In fact, throwing exceptions in constructors is generally a bad idea in any case.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: Yes, I don't think there's ever any guarentee as to when a static constructor will be called,
Actually, there is, if the class is not marked with the beforefieldinit flag. This[^] discusses the various possibilities with and without beforefieldinit.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
NEVER have exceptions thrown from a static constructor.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Hi, I have Rational Rose XDE for Visual Studio and I want to do a reverse engeneering from an existing C# project. Can you tell me the steps to do that? Thank you!
|
|
|
|
|
Hello, I have made an application and I know how to add a progress bar to it that can run based on timers, however if my code is within a large loop (such as an algorithm) the progress bar freezes (even on progress bars created by other people). Is there a way to make it so a progress bar will progress even inside of a large loop. This is mostly a "gold-plating" feature, however any help to accomplish it would be helpful. Thanks!
Mike - I love to program!
|
|
|
|
|
I think you have to make a second thread. In this Thread you do your large loop and call (with delagate) a method that performes a step of the toolbar.
mfg
edvo
|
|
|
|
|
You could also just call Application.DoEvents() periodically inside your loop, which is a lot simpler than using multiple threads. Something roughly like this (there are lots of variations you could do on the same basic idea):
int onePercent = loopCount / 100;
for( int i = 0; i < loopCount; i++ )
{
DoLengthyCalculations();
if( i != 0 && i % onePercent == 0 )
{
progressBar.Value = i / onePercent;
Application.DoEvents();
}
}
Matt Gerrans
-- modified at 14:51 Sunday 23rd October, 2005
|
|
|
|
|
I am new to .NET and would realy apreciated if someone makes time to give me some hints on using BitArray (I am making a compresion program and I need some clues for serialization). I am sorry if I sound to newbie
.NET rocks&rulz
-- modified at 12:34 Sunday 23rd October, 2005
|
|
|
|
|
Look at BitVector32 instead.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
I would like to know if anyone shall be interested by a 100% C# class for reading/writing ID3V1 and read-only ID3V2 (working on the writing part right now).
I just would like to know if anyone would be interested to read an article about that. My job is nearly done on this class and I would put it on Code Project with a sample of an "automatic mp3 renamer".
Anyone's comment ?
If someone says "Die mortal!", don't stay to see if he isn't.
|
|
|
|
|
That sounds handy. I'm not very familiar with this stuff. Would it allow you to do something like rename mp3s so that they have their correct album order instead of being alphabetical?
Matt Gerrans
|
|
|
|
|
An ID3 is only a tag that is placed at the beginning or the end of a file and that allow to identify the Artist, song, track, album or more of a mp3.
Let's say that you have a song filename like this : "05 - Nothing Else Matter.mp3"
Unless you know that song... you don't know which artist it is. If you are a ordered music maniac like me... you must hate having files like that.
My class will allow you to read those tag. The tag will probably return "Metallica" and "Nothing Else Matters"
So the only thing you would need to do, build a software that use this class to do a mass renamer.
This will probably be my demo project.
That will rename all song selected from "05 - Nothing Else Matters.mp3" to "Metallica - Nothing Else Matters.mp3" or to any other template that could be configured (album, track, year... etc...)
Any body would like to comment ?
If someone says "Die mortal!", don't stay to see if he isn't.
|
|
|
|
|
I can only say that that would be a very cool article!
(And i need such a utility too... )
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
If a client try to connect a web server by HTTP procotol, what is the response of the server?
Thanks!
|
|
|
|