|
|
Hi guys,
Some time ago I've found a very nice (there are probobly more of them) tutorial about developing application for Windows Vista. The article was talking about Vista security model and why it is important to specify application security level using mt.exe tool. Can anybody point me to a similar article?
thanks a lot!
zilo
|
|
|
|
|
Hi Zilo,
Please refer to the below mentioned links for information on creating applications for Windows Vista:
Link 1[^]
Link 2[^]
Link 3[^]
Link 4[^]
I hope this would be helpful.
John Adams
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Thanks John,
You have partly answered my needs, however I was more searching for an article saying why it is important to do it than the actual procedure.
although this is helpful as well, thanks a lot !
zilo
|
|
|
|
|
Hi,
I have a generally question that bother me.
Let me explain it with an example, so that you understand the question.
Let's say we have simple TcpSerer-class which a ConnectionList and looks like this
public class TcpServer {
public List<tcpclient> ConnectionList { get; }
public void start () { }
public void stop () { }
private void client_Connected ( TcpClient client ) {
ConnectionList.Add( client );
}
private void client_Disconnected ( TcpClient client ) {
ConnectionList.Remove( client );
}
}</tcpclient> So, as you can see, this class is not thread-safe.
Because an exception will thrown when i enumerate the ConnectionList
while some Client connect or disconnect.
Thats why i need an object to provide a possibility to lock the ConnectionList
while i enumerate it. OK so far so good.
Now i thought just take the SyncRoot-Property from the ICollection Interface implementation.
But someone told me, i should not use that Object for synchronization with the list.
Because the SyncRoot-Property was a mistake from Microsoft and decoy the developers
to use it without thinking about synchronization.
But the same one told me, that there is no differenc between the object from the SyncRoot-Property
and the object i could provide with a derivation of the List<T>.
Thats why my questions:
Q#1 - Is it true that the SyncRoot-Property was a mistake from Microsoft and shoundnt be used for synchronization. ?
Q#2 - If Q#1 is true then - Why ?
Q#3 - What its the recommended pattern to lock / synchronize any collection.
Thanks in advance.
P.S.: I asked this question already in the msdn-forum but it doesn't satisfy me.
Link: http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/3d760576-7cd2-44d5-936e-969ff5213648/[^]
|
|
|
|
|
A#1) Yes, SyncRoot was a bit of a balls up from someone at MS.
A#2) http://msdn.microsoft.com/en-us/magazine/cc188793.aspx[^]. Basically, IIRC it all boils down to the fact that your lock object should really be private.
A#3) Create a private object and use that.
private Object _lockObject = new Object();
.
.
.
lock(_lockObject)
{
...
}
In theory, if your writing a class to wrap a ICollection object, and if that object is contained privately within your class, and you never expose it directly, then your probably OK to use the SyncRoot object, as it will be private. I'm not totally sure on this though.
Simon
|
|
|
|
|
thank you for the good answer =)
But in the case of the TcpServerClass....I have two possiblilities
P#1 - I provide a lock-object with a collection to synchronize with it ( SyncRoot - )
or
P#2 - I provide a lock-object from the class which wrap the collection ( TcpServer.SyncLock).
But for P#2 i would have to do this everytime i use a collection whereat for the P#1 the lock-object would just come with the collection.
I understand you when you say... lock object should really be private ...but in a development, you should know what you are doing.
So, thats why it is not really necessary, i think
|
|
|
|
|
The private lock object should be private to the TcpServer class. Like this:
public class TcpServer {
private Object _lockObject = new Object() <-- HERE
private List ConnectionList { get; }
public void start () { }
public void stop () { }
private void client_Connected ( TcpClient client ) {
lock(_lockObject) <-- HERE
{
ConnectionList.Add( client );
}
}
private void client_Disconnected ( TcpClient client ) {
lock(_lockObject) <-- HERE
{
ConnectionList.Remove( client );
}
}
}
MarkPhB wrote: I understand you when you say... lock object should really be private ...but in a development, you should know what you are doing.
So, thats why it is not really necessary, i think [Smile]
It's not because of what you might do, it's because of what other people might do. If you make the lock object public, nasty horrible programmers who don't like you might write a program that reflects on your assembly, and takes a lock on your public lock object. This will cause your program to hang, or worse. Public lock objects are bad practice.
Simon
|
|
|
|
|
Simon Stevens wrote: nasty horrible programmers who don't like you might write a program that reflects on your assembly, and takes a lock on your public lock object
Well in that case you have no chance. If someone uses reflection then there is no way to protect it.
With Reflection someone can do everything, unimportant whether the lockObject is private or public.
Simon Stevens wrote: Public lock objects are bad practice
OK, but how shall i lock the ConnectionList for an external enumeration ?
...or shall i copy the entire ConnectionList befor i enumerate it ?
|
|
|
|
|
MarkPhB wrote: Well in that case you have no chance. If someone uses reflection then there is no way to protect it.
With Reflection someone can do everything, unimportant whether the lockObject is private or public. [Wink]
Really. Dam it, how stupid. How can anything ever be secure if someone can just fully reflect all your private stuff and change anything they want. Have I missed the point here?
[It seems your right: You have to pass the BindingFlags.NonPublic value! This seems rather dumb]
MarkPhB wrote: OK, but how shall i lock the ConnectionList for an external enumeration ?
...or shall i copy the entire ConnectionList befor i enumerate it ? [Sniff]
Yes, copying the collectionlist before returning it would be the standard way. We have several classes that wrap collections, and do copies before returning them to maintain integrity.
Simon
|
|
|
|
|
HI,
Ranges newRange =Excelobj.ActiveCell.SpecialCells(XlCellType.xlCellTypeAllFormatConditions, Type.Missing);
here Excelobj is my excel Object.i want to read all the ranges in which conditional formatting are applied.
for example if the conditionalformatting are used in below two ranges:
A1:c3 and d11:f12
with the above code, i get all the cells combination of both ranges.
but i want two separate range
like range1=A1 and range2=d11
now how do i get two different range from a range object.
I have searched alot but nothing found, please help meeee..........
|
|
|
|
|
having excessive amounts of .....................................
....................................................................................................................................................................................
........................................
.............................................................................................................................................................................................................
..............................................................
....................................................
is not necessary in thread titles or in the subject of a message for that matter. (Unless the person is proving a point, in this case)
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
I want to open PDF File in my application
I want to open Doc File in my application
How can I do it
Hello Friends
|
|
|
|
|
Use System.Diagnostics.Process.Start to open the file. This will open the default application associated with the file type.
|
|
|
|
|
thanks Pete O'Hanlon
but I don`t want to open a Doc file in Microsoft Word; I want to open a doc file in a viewer in my application
help me immediately please
Hello Friends
|
|
|
|
|
Laji59 wrote: help me immediately please
That's not the way this site works. This is a volunteer site - we're not paid to help you, so you might want to moderate the tone you're using to demand answers.
There are some commercial controls that will render text documents. You could probably use one of these.
|
|
|
|
|
This is a border line repost from another thread on the subject the OP started earlier in this forum.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You will have to either manually code an interpreter for both of the formats, or look into some third-party SDKs. fly2pdf[^] may help you with pdf display/manipulation/creation and VSTO may help with embedding[?] word documents in your application.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I think u can use a browser control in ur application
and then navigate to the url of the file.
I hope it helps.
|
|
|
|
|
this is a good way but may be I don`t have PDF reader like acrobat reader installed on my computer
Hello Friends
|
|
|
|
|
I am making an application in which i have a number of forms and each form has number of controls. Now i want to capture all teh key usage and mouse click at the form level so that if i enter some data and try to move to another form, it should pop up some message to save data. The code asn forms are in C#.NET.
|
|
|
|
|
Set the KeyPreview property on the form to true, and handle the PreviewKeyDown events.
Simon
|
|
|
|
|
i have a C# windows application in Visual Studio. I have a form which is opened in a panel.i want to print the data in various controls of the form upon clicking a PRINT button.but i don't want to print the jpg image of the entire form or any of its controls.i want that the text in the controls should be printed.for e.g. i have a label NAME:- and a textbox txtName in front of the label and suppose the user enters the name john in the textbox . iwant that they should be printed as follows:
NAME:- john
the enitre label and text box should not be printed but only the text in them should be printed.....is there any way to do it....is there any alternative way like adding the data in textbox and label to an MS Word document and then printing the document...plz. help...thanx in advance.
|
|
|
|
|
Have a look at the PrintDocument[^] class.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
thanks for the reply teejayem...the link to MSDN print document class was good but in the coding we have to give the path of the file to be printed ....
streamToPrint = new StreamReader
("C:\\Documents and Settings\\Administrator\\My Documents\\doc1.txt");.....
but what i wanted was that the text entered by the user in the text box etc. of the running form should be printed...how can i do that?
|
|
|
|