const char* title = "old title";
HWND hwnd = FindWindow(title, title);
SetWindowText(hwnd, "new title");
This sets the title bar to "new title", but the caption in the task bar is still "old title". How do I set both?
If relevant, this is being done in a DLL loaded in the process which owns the window.
This should set both, window title and task bar item. Your call
HWND hwnd = FindWindow(title, title);
does not look good, first parameter has to be class name (look at FindWindow). It looks to me that problem is somewhere else but I may be wrong.
Related
I'm quite new in swift programming but couldn't find an answer to the question how to change the title of the navigation bar when the user taps on it (see example app "ToDo" from Microsoft [former Wunderlist]). So first I choose the "Item A" out of a tableview and in the following screen the title stands in the navigation bar - so far so good. With a tap on this title "Item A" it should be possible to change the title (also for the previous tableview with the list of items by saving the changes in Realm). For now I just use the commands
title = selectedItem!.title
in my viewDidLoad in the upcoming view controller where .title equals the title from my "Item"-class
class Item: Object {
var parentCatergory = LinkingObjects(fromType: Category.self, property: "items")
#objc dynamic var title: String = ""
}
Any ideas? Or do I have to use a customized navigation bar, if so how?
Thanks in advance!
According to the UIViewController lifecycle, anything that you add to the method viewDidLoad() will be executed once when the view is loaded. If you want to change the title property on demand on a ViewController, is necessary invoke the navigation bar title property again from your tab action method. Check this post for more information: How to set the title of a Navigation Bar programmatically?
I have a page (render in IE) that creates a model dialog with style: WS_POPUP - showModalDialog. I can find HWND of the dialog but how I can find the HWND of parent?
Because the model dialog and its parent run on different processes, API function getParent does not work. In addition! sometimes another window can stand between the dialog and parent page :(, This prevents me from using 'next window' :(.
There is no code, and "API function getParent does not work" isn't helpful. You should check with Spy++ parent value in Properties->Windows.
Please check also Remarks section in GetParent documentation
To obtain a window's owner window, instead of using GetParent, use GetWindow with the GW_OWNER flag. To obtain the parent window and not the owner, instead of using GetParent, use GetAncestor with the GA_PARENT flag.
You have written:
In addition! sometimes another window can stand between the dialog and parent page
This may suggest that you don't have true owner-owned relationship. Maybe it is only simulated by disabling your owner window and making your dialog topmost. You can verify this by using Spy++ looking for WS_EX_TOPMOST in Properties->Styles. With HideThatWindow application you can manipulate window styles on runtime and further confirm this.
For getting HWND I would post custom message from one window to other.
UINT MyWmMessage = RegisterWindowMessage( TEXT( "HereIsMyHWND.mydomainname.pl" ) );
...
PostMessage( DialogHWND, MyWmMessage, 0, (LPARAM) ParentHWND );
And in dialog window:
// If this is in another process, reregister custom message.
UINT MyWmMessage = RegisterWindowMessage( TEXT( "HereIsMyHWND.mydomainname.pl" ) );
...
LRESULT CALLBACK DialogWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
...
if ( msg == MyWmMessage )
{
WeGotParentHWND = (HWND) lparam;
}
...
}
I know programmatically I can set a child view controller's title and it will updated its related tab bar item's title but how do I set that up in Interface Builder?
Interface Builder doesn't have an exposed property for a view controllers title but it does allow you to set properties in the "User Defined Runtime Attributes" section under Identity Inspector tab. Just set the key path to title, type to String, and Value to your desired title. Also check out Apple's documentation. Or check out this blog for a visual walkthrough: http://ios-blog.co.uk/tutorials/user-defined-runtime-attributes/
You can also have finer grain control by setting these different properties:
self.navigationItem.title = #"my title"; //sets navigation bar title.
self.tabBarItem.title = #"my title"; //sets tab bar title.
self.title = #"my title"; //sets both of these.
RT.as the picture below.
I try several ways as below, but not work :
Explorer Bars, Tool Bands, and Desk Bands, see here
Namespace extensions,see here
Implementing a Folder View, see here
I have resolve this problem, just resize the folder view window and create a new custom window and move it to the right postion, show below, this code will show custom window in top of folder view window:
HWND phwnd = (HWND)explorer SHELLDLL_DefView handle;
HWND chwnd = (HWND)explorer DirectUIHWND handle;
RECT *rcClient = new RECT();
GetClientRect(phwnd, rcClient);
MoveWindow(chwnd, rcClient->left, rcClient->top+39, rcClient->right, rcClient->bottom-39, TRUE);
HWND haddwnd = ::CreateDialogParam(hInst,
MAKEINTRESOURCE(IDD_DIALOG1),
phwnd,
(DLGPROC)About,
(LPARAM)rcClient);
ShowWindow(haddwnd, SW_SHOWNOACTIVATE);
MoveWindow(haddwnd, 0, 0, rcClient->right, 39, TRUE);
<pre>
I have created MFC MDI project with base class CFormView, ribbon, caption bar etc.
In CMainFrame, OnCreate() calls EnableMDITabbedGroups() which automatically adds one tab
and attaches CMyProjectView view. Now I want to add second tab and attach second view to that tab. I created new dialog and added CFormView derived class to it.
Here is the code:
void CMainFrame::CreateViews()
{
const CObList &tabGroups = GetMDITabGroups();
CMFCTabCtrl *wndTab = (CMFCTabCtrl*)tabGroups.GetHead();
wndTab->m_bEnableWrapping = TRUE;
CRect dummyRect;
CNewFormView *pNewView = (CNewFormView*)RUNTIME_CLASS(CNewFormView)->CreateObject();
((CWnd*)pNewView)->Create(NULL, NULL, WS_CHILD, dummyRect, wndTab, IDD_NEWFORMVIEW);
wndTab->AddTab(pNewView, _T("NewTab"), -1, TRUE);
}
Now, I'm pretty sure I missed something trivial or went in wrong direction all together,
but I can't get new view to show up. Also, I can't catch AFX_WM_CHANGE_ACTIVE_TAB or AFX_WM_CHANGING_ACTIVE_TAB in CMainFrame. Message gets send from CMFCBaseTabCtrl::FireChangingActiveTab but nothing happens.
WS_VISIBLE is missing from the view's styles?
You may want to set the active view for the frame too.