Click here to Skip to main content
15,909,652 members
Home / Discussions / C#
   

C#

 
QuestionDisable Update of xmlns into Report Viewer C# Pin
rikidev23-Nov-17 23:37
rikidev23-Nov-17 23:37 
QuestionHow to locate a window by title Pin
Leif Simon Goodwin23-Nov-17 20:53
Leif Simon Goodwin23-Nov-17 20:53 
Bit of a long winded question I'm afraid.

I have an app which sends data to an open document displayed by an app such as Word, using a simple paste operation. This requires that I locate the handle of the window associated with the document. The user configures the file location of the application that displays the document, and the file location of the document.

Obtaining the window handle is usually quite easy using something like this:

using (var searcher = new System.Management.ManagementObjectSearcher("SELECT ProcessId, ExecutablePath FROM Win32_Process"))
{
  using (var results = searcher.Get())
  {
    foreach (System.Management.ManagementObject item in results)
    {
      string ExecutablePath = (string)item["ExecutablePath"];
      if (!string.IsNullOrEmpty(ExecutablePath) && (ExecutablePath == _destinationApplication.DestinationApplicationPath))
      {
        int processID = (int)(uint)item["ProcessId"];
        System.Diagnostics.Process process = System.Diagnostics.Process.GetProcessById(processID);

        if ((process != null) && process.MainWindowTitle.Contains(documentTitle))
        {
          return process.MainWindowHandle;
        }
      }
    }
  }
}


Unfortunately Microsoft Word is a pain as one instance manages multiple open documents. Calling GetWindowText() on the main window handle gets the name of one document. Using Spy to look at the window tree for Word shows that none of the child windows store the name of the other document as the window text, even though I can see the name of the document displayed by a window.

So, how do I locate the handle of the window in which the second document is displayed?
AnswerRe: How to locate a window by title Pin
Eddy Vluggen24-Nov-17 2:48
professionalEddy Vluggen24-Nov-17 2:48 
GeneralRe: How to locate a window by title Pin
Leif Simon Goodwin24-Nov-17 3:32
Leif Simon Goodwin24-Nov-17 3:32 
QuestionDelete only the rows that has a particular Column value using C# code Pin
Member 1245769023-Nov-17 14:43
Member 1245769023-Nov-17 14:43 
AnswerRe: Delete only the rows that has a particular Column value using C# code Pin
Eddy Vluggen24-Nov-17 2:46
professionalEddy Vluggen24-Nov-17 2:46 
QuestionHow to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201823-Nov-17 14:29
C Sharp coder 201823-Nov-17 14:29 
AnswerRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 2:44
professionalEddy Vluggen24-Nov-17 2:44 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 2:56
C Sharp coder 201824-Nov-17 2:56 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:06
professionalEddy Vluggen24-Nov-17 3:06 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:20
C Sharp coder 201824-Nov-17 3:20 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:24
professionalEddy Vluggen24-Nov-17 3:24 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:39
C Sharp coder 201824-Nov-17 3:39 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:42
professionalEddy Vluggen24-Nov-17 3:42 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:52
C Sharp coder 201824-Nov-17 3:52 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 5:10
professionalEddy Vluggen24-Nov-17 5:10 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201828-Nov-17 17:48
C Sharp coder 201828-Nov-17 17:48 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201828-Nov-17 17:56
C Sharp coder 201828-Nov-17 17:56 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen29-Nov-17 0:27
professionalEddy Vluggen29-Nov-17 0:27 
Questionerror:The remote server returned an error: (411) Length Required. Pin
Urmila Pawar22-Nov-17 18:44
Urmila Pawar22-Nov-17 18:44 
AnswerRe: error:The remote server returned an error: (411) Length Required. Pin
Jochen Arndt22-Nov-17 21:28
professionalJochen Arndt22-Nov-17 21:28 
QuestionTabcontrol and treeview data binding Pin
Hervend22-Nov-17 12:59
Hervend22-Nov-17 12:59 
AnswerRe: Tabcontrol and treeview data binding Pin
Mycroft Holmes22-Nov-17 13:15
professionalMycroft Holmes22-Nov-17 13:15 
Questionhow svd(singular decompostion value) works for matrix? Pin
Isawyouoo22-Nov-17 4:00
Isawyouoo22-Nov-17 4:00 
AnswerRe: how svd(singular decompostion value) works for matrix? Pin
M-Badger22-Nov-17 4:36
M-Badger22-Nov-17 4:36 

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.