MrJJKoolJ wrote: So I call the class in my other class to do a function call and once that
function call is done so is the life of the class, correct?
If the class instance is created with a call to 'new' inside that function, yes.
MrJJKoolJ wrote: Use said to make it static in global in the class then it will persist for the life of the App.
If it's a static variable in any scope then there will only ever be one instance of the class. If it remains the same instance, I'm not sure. On second thoughts, it may not solve anything at all. What needs to happen is simply that the instance of the class is created when your app starts and to be in a scope where it's not destroyed. In a desktop app, that would be the point where the main constructor is called, in an ASP.NET app, application start would be the way to go.
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
I have a relativly simple control used for a layout manager for a form, its hierarchy is similar to this:
WorkspaceManager : Component
WorkspaceManagerControl : Control
DockingWindow : Control
ContainerWindow : Control
If I inherit 'DockingWindow' from a panel it gives me design time support to put controls on it etc.. (or set the ScrollableControlDesigner as the designer attribute)
This is almost what I want. The problem is that the DockingWindow is infact the control which draws all the required title bar etc.. and the ContainerWindow is the control I want to be able to drop controls onto
The ContainerWindow is an internal member of DockingWindow and definitly gets created and sized within the docking window ( a quick look with Spy++ shows this ) If I inherit this from Panel or add the ScrollableControlDesigner property to it I do not get the design time to support to drop the controls onto?
Why? Im probably missing some sort of attribute, or maybe need to expose the ContainerWindow as a property with some special attribute but I dont know what.
Any help/direction would be appreciated here.
Thanks - James
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
WorkspaceManager as the DockingWindows exposed as a DockingWindowCollection
I also exposed a collection of ContainerWindows as a ContainerWindowCollection
You need to create a docking window, then create a container window in the workspace manager and set the ContainerWindow property on the DockingWindow to the ContainerWindow you want to use within the window.
This seems to work so far...
Any more encapsulated solutions would be welcome )
Thanks - James
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
How to do synchronization to threads, for example if I have some number of nodes each have a thread and, also this nodes have some values for each node stored in an array, these values will be updated under some conditions “the one with min value will be updated first”, and the new value will be stored in the initial array.
How to do this?
For information on thread synchronization, see the documentation for the System.Threading namespace in the .NET Framework SDK, specifically information about the Monitor (or use the lock keyword in C#) class which is the easiest to use (but not always appropriate). I also urge you to search this forum (use "Search Comments" above) and the CodeProject site for many examples and discussions. There have been several here in the C# forum similar to your problem in the recent past.
When using the lock keyword, the C# compiler generates the following:
someObject is an instance of an object and its scope depends on your requirements. Since you're synchronizing methods on different objects, you should use a static object like the Type of your class. So, if your class is called MyClass, then use lock(typeof(MyClass)) to make sure all threads are synchronized no matter which object is trying to access a resource (like your array). If you want to synchronize a resource that is specifically to a single instance of a class, then you can lock against this.
I'm trying to have my videos of our software
(which is to be burned onto a dvd or cd)
protected from copying. I mean, I dont want the user
to copy-paste the lot of them with a happy smile.
I'd like them to be read-only.
Of course, it would be nice if there exist a simple solution
-aka not too expensive or even free!- to this minor problem.
What are my options ?
This by our hands that dream,
"I shall find a way or make one!"
Your options are to use google and not to post in the C# programming forum. This is not a programming question. There are solutions available, but everything is crackable. Just go to http://slashdot.org[^] to see what everyone thinks of them and how fast they're cracked (think: DeCSS).
Most CD copy protection schemes really just end up making some legitimate customers unhappy in the longrun (in other words, the protection causes some people who bought the software to not be able to run it).
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
i am working on an applicatin that will record all keyboard keys in a text file.... just like the keylogger do.... i have worked in windows services ... i have make that ... but my application is not working like a keylogger .... don't take it in negitative sight.... just for learning porpose... thx..
I have a TextBox inside a windows form (C#) which has capture property set to true. The TextBox captures the mouse events fine until I click inside the textbox itself, after which it does not respond to the mouse event happened outside its boundary. I checked the capture property and it is automatically set to false.
Just out of curiosity, do you have a Click event handler for your TextBox.Click event? What is it doing? If so, you should put a breakpoint at the first statement of your handler and put a watch on the Capture property of your object and see when it changes. Examine the line before the change occured.
No there is no click event declared for the textbox.
The TextBox is used to rename XYZ. So when a user choose to rename XYZ the textBox is enabled and user can write into it. Now If user is done renaming XYZ, he/she will click outside the boundary of textbox and I will disable the textbox. I am trying to make it similar the way it is done in windows to rename files.
The problem arises when I click inside the TextBox. It stops capturing the mouse events (Even though I set it to true) and I don't get mousedown event that occur outside textbox... I can not disable the textbox
Is there any one who can tell me how to get the port of an application with the application e.g i run an application and want to see on which port it is running by clicking the button with in that application
If your application binds to a port in order to listen, your application should already know which port and / or address it's binding to, or if you specify 0 for the port and IPAddress.Any for the address, you can retrieve the Socket.LocalEndPoint property to determine which address and port were selected by the service provider.
If you're connecting to another sock (and have not used Bind to pick a specific port), you should still be able to use Socket.LocalEndPoint to determine which address and port were used.
I need to copy files from a directory on our network out to a FrontPage Web's folder. Any tips/ideas on how to do this? The object browser is starting to give me a headache as I can't find anything to Open a web connection.
This is a question better suited for the Web Development forum as it has nothing to do with C#. Please post in the appropriate forum next time, please.
You can, however, simply type a URL in the Open dialog box and a new web folder is usually created, but not necessary. FrontPage uses the FrontPage Server Extensions to connect to IIS (not simply WebDAV). You should also make sure that the FrontPage Server Extensions appropriate for your version of FrontPage are installed on the server with IIS installed.
If your FrontPage site is comprised of files from the network, use File->Publish and you're provided a number of options in which to publish the site to a FrontPage directory (see the paragraph above as it still applies) and most likely WebDAV and FTP depending on your version of FrontPage.
I think my question was misunderstood. I am developing a C# application that will search a file system and then I want to automatically push the files found out to a web site that has FrontPage extensions installed. I know it is possible to connect to a site in this manner (Frontpage instead of FTP), I just don't know how. Can anyone help?
Misunderstood? You never mentioned that you wanted to write a program that did this. It helps to ask the right question.
There's no easy way to do this: the .NET base class library does not support FrontPage extensions (nor should it be expected to). You'll have to create a class library that uses the FrontPage protocol or search for one on google. The protocol is very poorly documented.
You could use WebDAV instead, which is a well-documented and industry-standard protocol. See http://www.webdav.org/[^].If you google well enough, you'll probably even find a .NET library you can use, but again it is not supported in the .NET base class library.
I didn't believe it necessary to state the obvious, that I was writing a program to do this, considering I was in the C# discussion board.
I appreciate your assistance in this. You are correct, I want to use the FrontPage protocol to do this. I am looking for people who have used it before. More specifically, the Office PIA now appears to be what I would require.
If you have and are capable of giving a more detailed explanation, great.
No, it's not obvious because we get unrelated questions like "how do I use frames in my HTML document?" all the time. Trust me - I spend a LOT of time in here.
The majority of people that have used the FrontPage protocol before were using FrontPage. Even the Apache server project had to be given a FrontPage mod by Microsoft themselves in order to support it (last I knew, it was written by an MS employee with permissions without support from MS themselves).
The Office PIAs don't expose what's necessary for the FrontPage protocol to be used through the object model - read the documentation[^] of the object model on MSDN and you'll see that. To get an instance of anything using Microsoft.Office.Interop.FrontPage you need an instance of the FrontPage.Application object, which is an out-of-process automation server (a .exe executable, namely frontpg.exe). So this won't be using the FrontPage protocol but FrontPage itself. It this is not a problem, then follow below. Otherwise, google for the API documentation if you can event find it, or visit the http://www.apache.org[^] project and look for the FrontPage extensions mod.
If you want to use FrontPage to publish the web, then create an instance of the ApplicationClass. Get the Webs property and call Add to add a file:// URL to the root network directory, which also returns a WebEx instance. That has a method called Publish that you can then use to publish the folder (and its subfolders). Call Close on the WebEx when done and call ApplicationClass.Quit (implements _Application.Quit). This is roughly how all the Office applications work. If you have any experience automating Office (and I have lots) this becomes very easy because they are all architected about the same.
You won't find specific object model documentation for FrontPage, but you can use the concepts in the Word object model and apply them here, because as I said they are very similar in concept and architecture.
I have a C# application that interops with PowerPoint 2000 (Project references description is "PowerPoint 9.0 Object Library"). I know that this app does not work on a PC that has PowerPoint 97 installed. Is it likely to work on a PC with PowerPoint 2002 (XP?). I know that COM is based on contracts of interfaces, so I guess later PowerPoint objects would support earlier versions' contracts, but is the interop generated by the IDE clever enough to deal with this too?
The Runtime Callable Wrappers (RCWs), or COM interop assemblies, generated by .NET Framework tools and the IDE are attributed with the interface and class GUIDs defined in the typelib that you're importing. So, just like COM, if a newer version of a library supports the older versions of the interfaces, you can use the new library through the old object model since the contract is honored.