|
i had look at the link but i couldne understand. Could you elaborate just a wee bit?
|
|
|
|
|
The idea is roughly the following:
1. When the application starts, a mutex is created to decide whether it's the first instance.
2a. If it's the first instance, the application is registered as a remoting server and it's URI is written into the registry.
2b. If it's not the first instance, the URI of the first instance is fetched from the registry and the command line arguments are used as arguments for calling a method on the first instance. Afterwards, the second instance quits.
This behaviour is packed inside an application framework which handles all the dirty details. You just have to attach an event handler for a StartupArguments event and handle the command line arguments you get there.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Is there a way within C# and .NET Framework to duplicate the "Safely Remove Hardware" functionality. I am using a USB Flash drive on a Windows XP system.
I want to be be able to ensure that the device is removed from the system without loss of data. So I would imagine that the would some driver uninstall or removal of the device from registry or other location. Does anyone know of code to achieve this?
I am currently using code to raise an event when the USB Flash device is added or removed. Based on the following:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21599899.html
Just to clarify, I cannot use the standard "Safely Remove Hardare" function that appears in the status bar as My application will not boot to the standard windows shell - so there will be no status bar.
|
|
|
|
|
You might be able to gleen something useful out of this[^]. It's a C++ app that will eject a device by
Drive letter: deveject -EjectDrive:E:
DeviceId: deveject "-EjectId:STORAGE\REMOVABLEMEDIA\7&20B2C23&0&RM"
Value Name: deveject "-EjectName:USB Mass Storage Device"
If you're really adventurous, you could convert the code into a utility class in C#. Get ready for some serious P/Invoking!
BTW: This is the ONLY code I've ever found that describes how to do this... And the comments are in German!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 13:31 Thursday 9th February, 2006
|
|
|
|
|
Hi all
If i create an excel range object (from a range of items e.g. A1 to C5)
this returns me a System.__ComObject
how do i turn this into a system array so i can then iterate through and strip out the individual cells.
I know i can do Range.Value2, which returns me a System.Object[,]
but then all i have access to is the values within the range so i cant grab additional cell data such as the number format information for working out the date.
any ideas?
|
|
|
|
|
just cast the return object into a Excel.Range object and you will be able to iterate through the cells that make up the range. Look for the correct methods, its easy.
You will not be able to turn it into a system array, because if you want to keep all information contained in each cell, ur better off just using directly excel's Range object which contains all the info of all the cells contained in it.
Bare in mind that excel does not have a 'Cell' class (which u would use to create ur system array). It only has the Range class and 1 unique cell is just a Range class object that spans 1 cell.
-- modified at 5:41 Thursday 9th February, 2006
|
|
|
|
|
Hello,
I was trying to force to stop a background worker's do event handler with cancelAsynch method, but it is not stopping the work. Is that possible to force to stop ?
Emran
|
|
|
|
|
emran834 wrote: Is that possible to force to stop ?
Yes, but the task executed by the BackgroundWorker needs to periodically check the CancellationPending property to determine if it needs to stop.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi,
thanks for reply. Ok, I understood that I will have to check the pending property, but in order to check the property, the working loop must finish its task, right ? like,
while( if cancelProperty false)
{
task....
}
Now, the task is very loong task, like sending heavy attachment emails or Playing Audio Stream, so, while loop will not check the state unless the heave task has been finished, right ? I want to FORCE to STOP that heavy task in the middle of its work. Is that possible ?
Moreover, the periodical Property Checking has another drawback which we know by Race Condition, right ?
thanks and regards
Emran
-- modified at 6:56 Thursday 9th February, 2006
|
|
|
|
|
Hi Emran,
Your task could spin off a separate thread to execute the "real" (long) task, then periodically check for cancellation. If the task needs to be cancelled, it could kill the running thread.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks , thats a nice idea . I will try that,
|
|
|
|
|
where can I download FXcop SDK for visual studio 2005?
thank's
Amit
|
|
|
|
|
Hi,
Is it possible to add DLL reference in runtime ? The reason I am thinking is, I want to provide updates of my software in dll file and use will be able to include that dll file in the program folder.
Emran
|
|
|
|
|
Of course it is. You can use the Assembly class to load assemblues in runtime.
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Hi,
Thanks for the reply. Can you show me any easy snippet for example ?
Emran
|
|
|
|
|
Hi Emran, I haven't tested this, but it looks like this may work:
bool loadAssembly
(string strDllFilename)
{
try {
Assembly.LoadAssembly (strDllFilename);
} catch (Exception) {
return (false);
}
return (true);
}
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hello All,
I am facing a huge problem ,I am opening a DBF file .For some cases it is fine but few tables its giving errors like:-
"the Provider couldnot determine the Decimal value.For Example, the row was just created,the default for the Decimal column was not
available,and the consumer had not yet set a Decimal value"
Code snippet is :-
public DataSet GetProjectTable()
{
string strSql,strConnect;
try
{
strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source= '" + ngisViewer_Open.lay + "' ;Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;Encrypt Password=False";
OleDbConnection objConn = new OleDbConnection();
OleDbDataAdapter objDA= new OleDbDataAdapter();
OleDbDataAdapter objDA1= new OleDbDataAdapter();
OleDbCommand objCmd = new OleDbCommand();
objConn.ConnectionString = strConnect;
objConn.Open();
strSql = "select * from '" + ngisViewer_Open.lay_Name_Final + "' ";
objCmd.CommandText = strSql;
objCmd.Connection = objConn;
objDA.SelectCommand = objCmd;
DataColumn dc = new DataColumn("UID", typeof(int));
objDA.Fill(ds1,"MyTable");
ds1.Tables["MyTable"].Columns.Add(dc);
for(int j=0;j
|
|
|
|
|
How can I save the text from a rich text box that is generated as a new
rich text box in a tab control? The rich text box is created in a "external" class file. I want to be able to have several rich
text boxes open, and save the one that is under the selected tab.
Thanks!
|
|
|
|
|
in the tabpages there is a controlcollection where every control from this page is being contained :
With
tabpage.Controls
you can get these controls and then look for your textbox.
On the other hand you can place a reference from the tag of the tabpage to your textbox then you don't have to look it up.
Textbox textbox = new Textbox();
tabpage.Tag = textbox;
And later:
string text = ((TextBox)tabpage.Tag).Text;
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
HI all.
I hane a xml file and a xslt file, to convert them to html I use xslTransform.Transform(). It works, but only problem is that I get the message that the Transform(string, string) method is obsolute and that I should rather pass the xmlResolver to the Transform() method.
So I thought of using
XslTransform.Transform(string inputFile,string outputFile, XmlResolver resolver)
But I just can't get the resolver part right, maybe because I don't know how it works. And I understand why they would make
XslTransform.Transform(string inputFile,string outputFile)
obsolute if it works fine.
Can anyone help please.
It will come to him who waits, that is if he doesn't die of old age.
|
|
|
|
|
Hello All,
I am using datagrid to view single DBF table through OLEDB
I am not getting the desired datagrid
It comes somewhat like
-----------------------------------------------
| -->(+)
|
|
|
after clicking (+) sign it gives me table and then opens it
I have one table only
I want table to be displayed directly no (+) sign and all
Thanks and Regards
Anil Dhiman
Anil Dhiman
GIS Engineer
|
|
|
|
|
hi Anil!
perhaps yor binding your datagrid to a dataset.
try to bind it directly to the datatable on your dataset.
the cause of the (+) sign is the dataset, because dataset can contain multiple datatable and the datagrid can only show 1 datatable at a time.
hope that helps!
microsoc
|
|
|
|
|
Thanks it helped dear
Anil Dhiman
GIS Engineer
|
|
|
|
|
nice to know that!
happy coding!
microsoc
|
|
|
|
|
I have an instance of Image class. I want to get values of Red, Green, Blue components from the instance. I'm in dark. Please help me! Thanks!
NPS.
|
|
|
|