|
Christian Graus wrote:
With all due respect, I don't see either of those as valid reasons to disallow me from creating constants as an aid to clarity and bulletproofing my code. Am I right in also thinking I cannot pass paramters into functions as const ? I was reading the Richter book on the bus and I was left with the impression that I cannot const reference types or my own value types at *all* ???
That is true. In C# you have const locals (I was wrong in my earlier statement), and const statics, but that's all. We don't have const parameters or const methods. I'm not sure how we'd support them in a multi-language environment without requiring all languages to implement them.
That's assuming we thought the value was worth the complexity, and I think the jury is out on that one.
|
|
|
|
|
Here is a thread for view
Clickety
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
I don't have a Yahoo login and I don't want one. Could you provide the gist of it ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I have made a COM server in c++ that has a function that accepts CHAR* as a paramater. Now i am trying to use the component from C# and it says the parameter in that function is of type "ref sbyte". How do i pass a string to the function? (a regular nonunicode string)
Thanks
|
|
|
|
|
|
You need to add appropraite attributes.
interface IMyInterface
{
[PreserveSig]
void MyMethod([MarshalAs(UnmanagedType.AnsiStr)] string str);
}
Refere to docs for more info. You may need to manually edit the IL file
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
Actually this is one of those depends answer, what exactly are you trying to do. If you are just trying to pass a string to a function something along the lines of this should do.
<br />
String s = "this is a string."<br />
obj.passText(s);<br />
Now the way this works is that it default marshalling assumes the parameter is a TCHAR*, if this want you want just pass a string, on the other hand if you need to always pass a Char*(and since I take it your doing non-unicode builds this shouldn't be a problem) or receive a string from a function that is a different strory with different marshalling requirements.
|
|
|
|
|
. Reply (E-mail) Forward (E-mail)
Subject: Howto?: display a notification Attachments: None
From: "Peter" <pg8290@yahoo.com> Sent: 7/20/2002 5:16:21 PM
Does anyone know a way to display a notification on the
screen that would work under all enviroments - even when a
user is playing a game that directly draws on the screen.
I am looking for something like what windows xp has during
a style/theme update where it turns the screen black &
white and displays a message.
What i am trying to build is a program for parents and one
of the core features is a notification system which im
stumped on trying to create. Because it needs to be able
to notify the kids to finish up what they are doing in any
enviroment including when they are playing some old game
that draws directly on the screen.
Does anyone know of any controls or maybe can advise me on
how to go about creating such a notification system.
Thank you for your time,
Peter
|
|
|
|
|
Does anyone know a way to display a notification on the
screen that would work under all enviroments - even when a
user is playing a game that directly draws on the screen.
I am looking for something like what windows xp has during
a style/theme update where it turns the screen black &
white and displays a message.
What i am trying to build is a program for parents and one
of the core features is a notification system which im
stumped on trying to create. Because it needs to be able
to notify the kids to finish up what they are doing in any
enviroment including when they are playing some old game
that draws directly on the screen.
Does anyone know of any controls or maybe can advise me on
how to go about creating such a notification system.
Thank you for your time,
Peter
|
|
|
|
|
How do I create a button with a rounded edge that highlights the border (on mouse enter) in C#?
To give an example, like the buttons in the Calculator that comes with Windows XP.
Thanks
|
|
|
|
|
Create a round button image with your favrotie editor. Then subclass the button class ( can't remember the exact name ). Override the paint method to paint the image onto the screen instead of the normal button. You can then draw the string above the Image. This should give you the effect of a rounded button.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
The buttons you see with Windows XP are caused by enabling XP to use Themes on your application.
There are many topics on MSDN about enabling XP Themes so I won't tell you how here; a search for 'XP Themes' should turn up a few articles you may need to trim it down by adding '.NET' to the search as well.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
To the guyz hacking at C#
do you find it more OOL then C++ or less ?
Or is it too early to tell ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|
|
First, what's your definition of OO? There seems to be some disagreement as to what the essential constituents of it are.
I define it to include encapsulation, inheritance and polymorphism. In this respect, C++ and C# are equally OO. However, in C++ you can still write procedural code. Some take this to mean that C++ is not "pure" OO.
On the other hand C++ has multiple inhertitance. Some, like the Eiffel guys, take multiple inheritance to be part of OO, but I think this is too restrictive a definition. Few OO languages would survive such a characterisation.
Kevin
|
|
|
|
|
You are right about the definition stuff, its a disagreeable point, easily enough.
I was more after "feelings" rather than principles.
So as to see if anyone felt it was more or less OO.
Since I haven't really done nothing in C# I can't comment.
But your feedback is appreciated.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|
|
|
Just because C# is a straightjacket, does that make it more OO, or just harder to use if your project does not entirely fit an OO paradigm ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
So perhaps it's better to ask not whether C++ is OO but does it support OO? For me, the answer is definitely: yes.
Personally, I don't think the fact that C++ allows procedural programming should detract from the central question of whether it allows the full spectrum of OO features. Though, one can discuss how well it implements those features.
Interestingly, a language such as Python, unlike C++, was designed upfront to be OO. But it also supports procedural programming. Yet I bet few would say that Python is not truly OO.
Another issue, you can still do procedural programming in VB .NET. Does this mean it's not now truly OO?
Kevin
|
|
|
|
|
The question should be - is a "pure OO" (however that is defined) language better than one that is not? I have been a proponent of OO since I first learned it back in the '80's, but even I know that it is not an ideal solution to every programming issue. Therefore, a language which allows you to write non-OO code when needed is vastly better than one which does not.
"Human imagination has been sculpted by the universe within which it was born" Hmmmm...
|
|
|
|
|
Amen, Reverend. Testify !!!
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
It's true that OO is not an ideal solution to every situation. But it does not follow that a language that allows you to write non-OO code when needed is vastly better than one which does not. Some argue that trying to mix two paradigms in the same language causes confusion and makes it difficult to separate out the concepts. C++ is heavily criticised for deciding to bolt on OO on top of a procedural base. Though really its main problems are due to its retaining backwards compatibility with C, a low-level language. This tends to produce obscure and inelegant solutions. You tend to have to work much harder to do things properly in an OO sense.
Betrand Meyer argues that a better approach is to allow interfaces from OO languages into procedural code and vice-versa, rather than munging the two together.
OTOH, Python is an OO language that allows procedural programming and I don't think it has the problems of C++. This is likely because Python was designed upfront to be OO.
Kevin
|
|
|
|
|
I think this is the method i should use to retrieve a bitmap i added to resource [its not in a resource file!] in sharp develop. now i want to load that, but do not know how. some help please.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Check the bitmap properties?
Build action = Embedded Resources!
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
|
Thats a setting for files in a VS.NET project. Obviously not going to help you.
IIRC the FromResource method is used to load a Win32 resource out of a resource-only satelite dll; so it wouldn't be of much help to you.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|