There are a few quirks with Note Windows when it comes to adressing the active notewindow.
The following works with 7.5-SR4.
I've not tested them with 7.0, but I think they should also work ...
#define WM_MDIGETACTIVE 0x0229
bool rename_relabel_active_note_window(string strNewNoteWinName)
{
Note nwin(strNewNoteWinName);
if(!nwin.IsValid())
{
HWND hWndMDI = GetWindow(OGW_MDICLIENT);
Window winMID(hWndMDI);
DWORD dw = winMID.SendMessage(WM_MDIGETACTIVE);
HWND hWndChild = (HWND) dw;
if(hWndChild)
{
foreach (Note nWin in Project.Notes)
{
if(nWin.GetWindow().GetSafeHwnd() == hWndChild)
{
nWin.Rename(strNewNoteWinName);
nWin.Label="NewLabel";
return (true);
}
}
}
}
return (false);
}
bool rename_relabel_note_window(string strNoteWinName, string strNewNoteWinName)
{
Note nWin(strNewNoteWinName);
if(!nWin.IsValid())
{
Note nwin(strNoteWinName);
if(nwin.IsValid())
{
nwin.Rename(strNewNoteWinName);
nwin.Label="NewLabel";
return (true);
}
}
return (false);
}