|
There's a few ways:
- Set the size when you call Create() on the dialog.
- Change the size using SetWindowPos()
- Change the size using MoveWindow()
|
|
|
|
|
I need to right-click on the windows taskbar on the button of a particular application and then select one of the actions in the menu (maximize,restore,close/exit).
Have been trying to get a handle to the taskbar as follows:
HWND hDesktop = GetDesktopWindow();
HWND hTray = FindWindowEx( hDesktop, NULL, _T("Shell_TrayWnd"), NULL );
HWND hReBar = FindWindowEx( hTray, NULL, _T("ReBarWindow32") , NULL );
HWND hTask = FindWindowEx( hReBar, NULL, _T("MSTaskSwWClass") , NULL );
HWND hToolbar = FindWindowEx( hTask, NULL, _T("ToolbarWindow32") , NULL );
But I dont know what to do beyond that or if I am actually getting the correct handle.
|
|
|
|
|
To do this you can find the Window that you need to work on.
Then send it the WM_SYSCOMMAND[^] message.
For example to send the restore command -
SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
Here hWnd is the handle returned by FindWindow .
|
|
|
|
|
What I want to do is to right-click on a Button on the TaskBar corresponding to a particular running application and then select one of the actions from the Menu that shows.
Any suggestions?
|
|
|
|
|
Try this[^] sample app , you may able to right click on the menu items
HTH
|
|
|
|
|
Hello,
I am writing a program using VC++ with MFC,
I added some dialog boxes and I want that once one of the dialog is opened by DoModal()
all the buttons on the parent dialog will be disabled,
How can I do it?
thanks
Avishag
|
|
|
|
|
In the dialog's OnInitDialog[^] function, you can call EnableWindow[^] on each control.
This is assuming you want the greyed look of the controls; a modal dialog with a parent window automatically disables the parent window until the dialog is closed.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Just a query: Why do you want to disable the controls on the parent dialog i.e. only for the look and feel?. Since the dialog being popped up is a result of the DoModal thing, the hit on the parent dialog will not work unless you dismiss the popped dialog.
On the other hand as suggested with the parent dialog pointer you can disable the control on it in the InitDialog of the dialog being popped up.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
thanks for the replay,
I have a dialog that has a menu and clicking on the menu items causes to open other dialogs
by DoModal();
The problem is that, while one dialog is opened the user can click other menu items and open more dialogs and its causes me a mess.
How can I declare that the main dialog will be a parents of the other dialogs?
thanks again
|
|
|
|
|
aangerma wrote: The problem is that, while one dialog is opened the user can click other menu items and open more dialogs and its causes me a mess.
Are you certain you are calling DoModal ?
If the dialog is modal (DoModal ) the parent window should not be active and the user should not be able to click on other menus/buttons.
If that is happening, you have other issues to fix.
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: indow should not be active and the user should not be able to click on other menus/buttons.
Can i correct it as
If the dialog is modal (DoModal) the parent window will not be active and the user will not be able to click on other menus/buttons.
|
|
|
|
|
Yes, you can; but if the user experiment another behavior, there is a bigger issue.
Watched code never compiles.
|
|
|
|
|
I have a doubt that you are using DoModal. If that was the case as Maximilien told in the last mail you will not have access to the parent dialog.
Looks like you are using Modeless Dialog.
|
|
|
|
|
As Chandru080 wrote, using a modeless dialog would explain this behaviour. Alternatively, if the parent window handle is invalid or NULL, the result would be the same.
Could you post the relevant code please? It should be possible to say for sure then.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
can you explain me what does it mean 'modeless dialog',
and how can I change it?
thanks
|
|
|
|
|
|
Hi,
When i search over the google about Memory leaks.I came to know about this commands.Then i use it in my code.
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtMemState s1, s2, s3;
_CrtMemDumpStatistics( &s1 );
After closing my application i found this in output window But i cannot understand whats it saying.
Pls help me whether this is a serious concern i have to look out.
In Output window i got this
2439008 bytes in 2147348480 Free Blocks.
1244712 bytes in 2438992 Normal Blocks.
2089871648 bytes in -16711681 CRT Blocks.
2089919440 bytes in 2010977956 Ignore Blocks.
-1 bytes in 1244308 Client Blocks.
Largest number used: 2089919435 bytes.
Total allocations: 2089918906 bytes.
Anu
|
|
|
|
|
Why not use the CMemoryState Class to find the memory leak?? It gives you a better understanding.
|
|
|
|
|
Those are the memory dump statistics that you asked for. You really only need the _CrtSetDbgFlag() call in your CWinApp-derived class constructor and it will do the leak detection for you. Also remember to define new as DEBUG_NEW for debug builds in all source modules.
|
|
|
|
|
|
Hi
i have created CTreeCtrl tree view,this is having list of children (parent child relationship) like normal windows explorer tree view.if i add any new item into the any of root node it will add as a last item of that root node.my problem is once i add new item to the root node,how to set focus to the added item also how to make it visible.
1.parent is already expanded, add new item to the parent.
2.parent is in collapsed state, add new item to the parent.
In 1st case i am not able to make visible to the newly added item...
please help me...
thanks
|
|
|
|
|
I'm not sure offhand but I would expect that forcing a refresh of the CTreeView would get the item displayed.
The best things in life are not things.
|
|
|
|
|
|
Why not use
CTreeCtrl::EnsureVisible
|
|
|
|
|
yes.. EnsureVisible is working if parent node is in Collapsed state.that time if make
if (hParent != NULL)
m_TreeCtrl.Expand(hParent, TVE_EXPAND);
// Ensure the item is visible.
m_TreeCtrl.EnsureVisible(hmyItem);
like this its working,in my case parent is already expanded, i want to make perticular item visible once i add.
|
|
|
|