|
Hi guys/gals!
I have a little problem with creating a MSI package. I have added the custom "Customer Information" dialog to my installation process, but I don't know where this information is written to. I want to use this information for display on my "About" box and maybe later for online registration proposes.
Can anybody help?
Willem Le Roux
|
|
|
|
|
The information only exists in memory. You would have to write a custom installer action that gets the data passed to it, then the code would have to persist it.
|
|
|
|
|
Okay And now repeat in English please
Sorry mrCondor, but I have no idea what you are talking about... Yet. I played around with what I think your idea is, and it seems that I will have to write some other application (exe), DLL, script (js... preferably) or something like that to get the information and write it to the registry... somewhere... Perhaps?
Also, I toyed around in MS help and got some interesting goodies about Properties, USERNAME properties, COPANYNAME properties, UserSID properties, how all this gets written to the registry under the "InstallProperties" key and all sorts of tit-bits like that, but no example, no nothing.
Can anybody please steer me in a general direction? I have absolutly no idea where to start... Fooling a little feelish now! uhm he he he...
Willem Le Roux
|
|
|
|
|
Here is the code sample of sington class and their clients
<br />
public class single<br />
{<br />
public string str = "Hello";<br />
private static single s = null;<br />
<br />
private single()<br />
{<br />
}<br />
<br />
public static single CreateInstance()<br />
{<br />
if (s == null)<br />
s = new single();<br />
<br />
return s;<br />
}<br />
<br />
public string Get()<br />
{<br />
return str;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
single i = single.CreateInstance();<br />
<br />
string str1 = i.Get();<br />
Console.WriteLine(str1);<br />
<br />
i.str = "World";<br />
<br />
i = null;<br />
single j = single.CreateInstance();<br />
<br />
string str2 = j.Get();<br />
Console.WriteLine(str2);<br />
<br />
j = single.CreateInstance();<br />
j.str = "New";<br />
string str3 = j.Get();<br />
Console.WriteLine(str3);<br />
<br />
<br />
}<br />
}<br />
Output::
Hello
World
New
But it should be
Hello
Hello
New
since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
Thanks and Regards
Madhu
|
|
|
|
|
No, since i is a local variable. You're just nulling your local reference of the singleton (which continues to exist).
/ravi
|
|
|
|
|
madhusri wrote: since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
No, that defeats the goal of the singleton pattern.
|
|
|
|
|
Hi leppie,
When i = null is assigned, there are no reference pointers pointing to the singleton object. Hence if there is a GC, then the singleton object has to be deleted. In this case, next time an instance to the singleton object is created, it should be a new object again. But the old object is being retained and returned when i call createInstance() again.
Basically, when will the singleton object be destroyed from memory?
We understand that an object will be deleted if there are no references to that object or if the object is set to null. Is this right?
Thanks and Regards
Madhu
|
|
|
|
|
When all object references are removed it is scheduled for garbage collection. The first round of the GC does the clean up. The next time the GC runs it removes it. If you need to free resources implement the IDisposable method and call that before assigning null and then just don't worry about it.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Event we tried to GC the i object after assigning to null ie.
i=null;
GC.Collect();
Thread.Sleep(2000);// Waitin for some time to Collect the object i by GC
even this never destroyed the object.
|
|
|
|
|
And if custom memory management is so important you shouldn't be using C#.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
madhusri wrote: When i = null is assigned, there are no reference pointers pointing to the singleton object.
This is incorrect. The class you showed has a static reference to its one and only instance.
madhusri wrote: But the old object is being retained and returned when i call createInstance() again.
And it manages this because something is holding a reference that the CreateInstance() method can pass back.
madhusri wrote: We understand that an object will be deleted if there are no references to that object or if the object is set to null. Is this right?
The first part is correct. The second part is incorrect because you are not setting the object to null, not now, not ever. What you are doing is setting a reference to the object to null.
|
|
|
|
|
Now we understand. Out situation is like One exe will invoke function in 2 separate dlls using reflection. first exe loaded the dlls. those dlls create log object using CreateInstance(). suppose if the dll1 assigned the
logobject.Moudulename="First";
logobject=null;<br />
GC.Collect();
then the exe unloaded this dll1 and try to access dll2 function which uses logobject instance, will the changes made by dll1 will be afected to dll2's Logobject? if yes means the logobjected is collected by GC right so it will be no longer available to dll2 rite?
|
|
|
|
|
I think you need to dispose the object out of memory.
Assigning null is no different then assigning a value. The object itself still exists.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
madhusri wrote: since we assigned i=null then the singleton must be destroyed and new instance should be created when j = single.CreateInstance(); executed right?
Nope, wrong!
See this code from CreateInstance:
if (s == null)
s = new single();
return s; What happens here is the one and only ever instance never to be repeated is created if it does not exist and stored in the static field called s. s is always returned. Nothing else ever assigns to s therefore the singleton pattern is maintained becuase you have ensured that there will only ever be one and only one ever instance of the object. This is the goal of the singleton, the behaviour you expect is at odds with the pattern you have chosen.
|
|
|
|
|
I want to set the font style to Bold when the user clicks Control + B key combination,
How do i do that?
Thanks & Regards,
Pramod
|
|
|
|
|
private void richTextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.B && e.Modifiers == Keys.Control)
{
this.richTextBox1.SelectionFont = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
}
}
|
|
|
|
|
|
You could also maintain the font and do it like this:
if (e.KeyCode == Keys.B && e.Control)
{
richTextBox1.SelectionFont = new Font(
richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style ^ FontStyle.Bold
);
e.Handled = true;
}
Michael Francik
Empireland, Inc.
|
|
|
|
|
Everything is fine
but when i press Ctrl + I the cursor moves one tab ahead,
Why does this happen?
is Ctrl + I any pre-defined short cut for richtextbox.
i am working in VS 2005.
Thanks,
Pramod
|
|
|
|
|
Thanks for that can also tell me how can i insert a link to a Folder in a richtext box.
Pramod
|
|
|
|
|
See this:
http://msdn2.microsoft.com/en-us/library/f591a55w.aspx
|
|
|
|
|
i tried but when i set a link as http://microsoft.com the text display should be only microsoft.com , but the text displayed is http://microsoft.com
please suggest Any other way to solve this.
Thanks,
Pramod
|
|
|
|
|
For example, if you want to open Directory c:\ then use
file:\\c:\
or if you want to open d:\temp then use
file:\\d:\temp
|
|
|
|
|
Hi,
How do i control access to a directory or file in a network programatically .Im using .Net Framework 1.1
(I have to restrict access to network for a particular user programatically)
Thanks in advance,
Luck is Opportunity with hardwork
|
|
|
|
|
Anything you do programmatically is in the context of the user that is running your program. If you want to kill access for a user, you cannot change a directory access while 'being' that user.
The only way is with network security setting the access rights on the folder. That's why we have network administrators in the world.
|
|
|
|