Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
AnswerRe: Question about DateTime or any other Data\Time object ... Pin
Shy Agam6-Aug-06 13:23
Shy Agam6-Aug-06 13:23 
GeneralRe: Question about DateTime or any other Data\Time object ... Pin
Yanshof6-Aug-06 13:31
Yanshof6-Aug-06 13:31 
AnswerRe: Question about DateTime or any other Data\Time object ... Pin
Ravi Bhavnani6-Aug-06 14:03
professionalRavi Bhavnani6-Aug-06 14:03 
QuestionHow do we pass along arguments to another thread while preventing multiple instances? Pin
Mikzi6-Aug-06 13:03
Mikzi6-Aug-06 13:03 
AnswerRe: How do we pass along arguments to another thread while preventing multiple instances? Pin
Judah Gabriel Himango6-Aug-06 17:52
sponsorJudah Gabriel Himango6-Aug-06 17:52 
GeneralRe: How do we pass along arguments to another thread while preventing multiple instances? [modified] Pin
Mikzi7-Aug-06 0:26
Mikzi7-Aug-06 0:26 
GeneralRe: How do we pass along arguments to another thread while preventing multiple instances? Pin
mav.northwind7-Aug-06 3:21
mav.northwind7-Aug-06 3:21 
AnswerRe: How do we pass along arguments to another thread while preventing multiple instances? Pin
Mikzi7-Aug-06 12:09
Mikzi7-Aug-06 12:09 
The client server method does work. It solves the problems with not relying on Visual Basic libraries as well as working with Mono/Linux. It requires some coding however, and it needs the ip address and a port number. Might be possible to simplify the process further than this...


[STAThread]
static void Main(string[] args)
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    new App();
}

class App
{
    private static Form1 mainform;
    private Mutex mutex;
    public App()
    {
        bool owned; int port = 1392;
        mutex = new Mutex(false, "Form1", out owned);
        if (!owned)
        {
            ChannelServices.RegisterChannel(new TcpChannel(), true);
            string str = "tcp://" + Dns.GetHostEntry(Dns.GetHostName()).AddressList[0] + ":" + port + "/" + typeof(RemoteServer).GUID.ToString();
            ((RemoteServer)Activator.GetObject(typeof(RemoteServer), str)).ActivateInstance(Environment.GetCommandLineArgs());
        }
        else
        {
            ChannelServices.RegisterChannel(new TcpChannel(port), true);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteServer), typeof(RemoteServer).GUID.ToString(), WellKnownObjectMode.Singleton);
            Application.Run(mainform = new Form1());
        }
    }

    private class RemoteServer : MarshalByRefObject
    {
        public void ActivateInstance(string[] args)
        { args[0] = null; mainform.Invoke(new Form1.InstanceDelegate(((Form1)mainform).processParameters), new object[] { mainform, args }); }
    }
}


// Mikzi L. Freeman

QuestionBarcode Pin
omar el halwagy6-Aug-06 12:50
omar el halwagy6-Aug-06 12:50 
AnswerRe: Barcode Pin
Judah Gabriel Himango6-Aug-06 13:02
sponsorJudah Gabriel Himango6-Aug-06 13:02 
QuestionAuto refresh of referenced library... Pin
Shy Agam6-Aug-06 11:27
Shy Agam6-Aug-06 11:27 
AnswerRe: Auto refresh of referenced library... Pin
Judah Gabriel Himango6-Aug-06 11:42
sponsorJudah Gabriel Himango6-Aug-06 11:42 
GeneralRe: Auto refresh of referenced library... Pin
Shy Agam6-Aug-06 11:51
Shy Agam6-Aug-06 11:51 
GeneralRe: Auto refresh of referenced library... Pin
Judah Gabriel Himango6-Aug-06 12:45
sponsorJudah Gabriel Himango6-Aug-06 12:45 
GeneralRe: Auto refresh of referenced library... Pin
Shy Agam6-Aug-06 12:49
Shy Agam6-Aug-06 12:49 
GeneralRe: Auto refresh of referenced library... Pin
Judah Gabriel Himango6-Aug-06 13:01
sponsorJudah Gabriel Himango6-Aug-06 13:01 
GeneralRe: Auto refresh of referenced library... Pin
Shy Agam6-Aug-06 13:15
Shy Agam6-Aug-06 13:15 
QuestionC++ to C# Pin
t4ure4n6-Aug-06 11:22
t4ure4n6-Aug-06 11:22 
AnswerRe: C++ to C# Pin
Judah Gabriel Himango6-Aug-06 11:41
sponsorJudah Gabriel Himango6-Aug-06 11:41 
QuestionPaint a cell in DataGridView Pin
kalyanPaladugu6-Aug-06 10:56
kalyanPaladugu6-Aug-06 10:56 
AnswerRe: Paint a cell in DataGridView Pin
Judah Gabriel Himango6-Aug-06 11:38
sponsorJudah Gabriel Himango6-Aug-06 11:38 
GeneralRe: Paint a cell in DataGridView Pin
kalyanPaladugu6-Aug-06 13:06
kalyanPaladugu6-Aug-06 13:06 
GeneralRe: Paint a cell in DataGridView Pin
Judah Gabriel Himango6-Aug-06 15:56
sponsorJudah Gabriel Himango6-Aug-06 15:56 
GeneralRe: Paint a cell in DataGridView Pin
Erik Molenaar8-Aug-06 7:53
Erik Molenaar8-Aug-06 7:53 
QuestionSerialisation of more than one object Pin
Malcolm Smart6-Aug-06 10:00
Malcolm Smart6-Aug-06 10:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.