It looks as an MDI application (I can open multiple documents within a window). However I cannot get the handles of the opened documents (MDI children?). I tried with FindWindowsEx(..) and EnumChildWindows(..) and could not find any children. Then I tried with Spy++ and I got that the handle of each child is equal to the handle of the parent (MDI application?). Is this application a MDI application at all? Are these opened documents some kind of fake windows since they do not have handles? How can I access them?

Thank you very much for any help!

Show us some code

Show us some code

static HWND child[10];
static int st = 0;

BOOL CALLBACK WindowEnumProc(HWND hwnd, LPARAM lParam) {
  static bool first = 1;
  if (first) {
    dbe = hwnd;
    first = 0;
  }
  child[st] = hwnd;
  st++;
  return 1;
}

main () {
  HWND dbe = NULL;
  char title[50];
  strcpy_s(title, "ApplicationName - C:\\a\\Document1");
  while (dbe == NULL) {
    dbe = FindWindow(NULL, LPCSTR(title));
  }
  HWND child1 = NULL;
  HWND child2 = NULL;
  child1 = FindWindowEx(dbe, NULL, "MDIClient", NULL);
  child2 = FindWindowEx(dbe, NULL, NULL, NULL);

  LPARAM l=NULL;
  EnumChildWindows(dbe, WindowEnumProc, l);

  for ( int j = 0; j < st; j++ ) {
    cout << "child[st]= " << child[j] << endl;
  }
}

Both child1 and child2 remain NULL, and the variable st equal to 0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.