|
Dave knows about reflection. That doesn't mean it's a good suggestion in this case.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I should have clarified by saying "without going through the hassle of using Reflection to do it".
Yeah, I've done it too. But I at least put all my persistent stuff in my own settings class, kind of like the one in VB.NET 2005, so all I had to do was call Save() to spit it out. It even supported plug-ins so you could persist data to anywhere you could wrap a class around.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well .... ow did you do it? Are you aware of that my application is using 2 different assemblies. Is it really possible to share information between assemblies without passing information?
If I stand in my logging function Intellisense only shows that assembli. I can in no way see the other part of the namespace.
//Maw
|
|
|
|
|
I've never had a case where I had to have multiple assemblies persisting their own properties. But, it wouldn't be hard. Each assembly can use its own copy of the Settings class.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well ... a settings-class is a really really good idea =)) But can I make such class persist data thoughout several assemblies in a project? i.e set properties in one assemblie and read them in another?
How is that done? Can you give me a small example?
//Maw
|
|
|
|
|
Of course. There's no thing assembly specific about this. All it is is writing values to an XML file.
If you want a value to be used in multiple assemblies, all you have to do is expose a filename property and methods in the Settings class so you can tell it which file you want to load/save from/to.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
well it isn't nice ...... but it is a way of doing it. I aws lookin for someway of not writing to disk or registry..
//Maw
|
|
|
|
|
Then how do you expect to "persist" the data? It normally means to make it persistant between executions of your application.
Now, you're talking about interprocess communication...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
A class with public static methods - then you don't need an instance, and you can call it from anywhere. I've done logging like this. I actually said this in my first reply.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
As I said in earlier thread ...
My application consists of many different assemblies. Logging is in one assemblie and mainapp is in another.
Can you give me information about how you did it ...
If I stand in my logging function Intellisense only shows that assembli. I can in no way see the other part of the namespace.
//Maw
|
|
|
|
|
My advice is the same - have a logging class which is given the information to log, making a class able to see everything across all your assemblies is just a bad idea. If you want your logging to always store the same info, add methods on the classes so you can get it, as a string so that it's human readable, but not machine readable.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can you give me an example of your suggestion in code?
//Maw
|
|
|
|
|
I don't do VB, but here's some C#.
class Logging
{
public static void Log(string message)
{
// Access the log file via a lazy initialised property
// Write the message to the log file
}
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well .... thats how I d it today .... Only part I'm missing is how I'll get the properties over there like username and "function" and so on. Maybe the best way is a settingsclass wich reads from an XML-file. Maybe Serialization is good idea here.
//Maw
|
|
|
|
|
MaWeRic wrote:
Only part I'm missing is how I'll get the properties over there like username and "function" and so on.
You need to pass them through. How else would you do it, generically ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thats exactly what i DONT want to do ....
Just want to call that function and it does all I want just from calling it. It is a shared function and I don't set an instance.
To make it very simple : I have a mainform with a class/structure wich just contains some properties like username, userID etc. Can I in any way read those properties from another assembly? Both mainapp and log-assembly resides under same root´-namepace i.e "MySys.MainApp" and "MySys.sys.Logging"
I heard something about application-reflection and application domains. Is this something that I can looka at?
Maybe I'll just settle for a settingsclass wich reads properties from a XML-file with serializesation or something like that. Not nice though. But maybe the only way?
And thanks for all your help and suggestions ... You have opened my eyes ...
//Maw
|
|
|
|
|
Calling ShowCursor(FALSE) in either VB.NET or classic C++ 6.0 doesn't seem to hide the mouse at all. The return value indicates success (the show count decrements) but nothing happens to the cursor.
Any ideas? I'm trying to write a full-screen magnifier, which has its own fake mouse cursor. Therefore I need to hide the real one.
Thanks!
|
|
|
|
|
How about System.Windows.Forms.Cursor.Hide ?
|
|
|
|
|
No no, I think you misunderstand. I want to hide the cursor across the entire system, not just in my own window.
Cursor.Hide works, but only for my own windows. I need to hide the real cursor across the entire screen, and display my own fake one. I've already done the second part.
I'm making an accessibility app for partially-sighted users.
|
|
|
|
|
Oops!
Well, not sure about that one.
I tried ShowCursor, but it works just like Cursor.Hide (Hides only in same app)...
|
|
|
|
|
That's right, that's how it works!
The mouse cursor is controlled by each individual application, but only when the cursor is in that applications window bounds.
You can't get ride of the cursor system-wide, but you can set it to a blank image. You'll have to create a blank cursor image, then call the Win32 API function SetSystemCursor[^] to make the cursor "disappear".
Another option would be to confine the cursor to a bottom corner of the screen. You'll have to call ClipCursor[^] for that.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I can't use ClipCursor, because I need the user to be able to click on stuff. It's just the image I need to hide, so I can replace it with another in a different place.
I'll try SetSystemCursor, thanks. Any idea if it's possible to grab the current cursor image and draw it as a graphic on a window?
Thanks!
|
|
|
|
|
Here i am again!
How about LoadCursor[^]
To use one of the predefined cursors, the application must set the hInstance parameter to NULL and the lpCursorName parameter to one the following values: IDC_ARROW etc...
BTW: stupid of microsoft to don't make a GetSystemCursor
|
|
|
|
|
Nah, that won't help. I need to get /all/ cursors - e.g. the left-handed line-selection cursor M$ Word uses when you point at the left margin. I need to grab its image and /also/ prevent it ever being displayed. I'm trying to intercept all cursor changes and use them for my own purposes.
Thanks for trying, though
|
|
|
|
|
Hey Guys,
I am New to this forum!! I need help on VB .NET
# I have got some Sub Procedures that constantly repeat in some forms.
Can i put these in a module??
# How do i call the Module??
# Also, do i need to declare things like variables,dataadapters,dataview,dataset
etc. used in those Sub Procedures in the Module??
(l0phtcrack)
|
|
|
|