|
Dear Ivor,
First of all I apologize for calling you Igor in my first message (it is a more common name to me). Secondly, I manage to get the application working with the tips you gave me. Nevertheless, I still do not fully understand how the thing is working. In my application I set the parent of the tree ctrl to the COXSizeControlBar class (m_wndTree.Create(pParentWnd... where pParentWnd is a pointer to an object of a class derived from COXSizeControlBar). After this I created the tab control as a child of the COXSizeControlBar class and added the tree control to a page of the tab control. Then it was possible to handle messages from the tree control inside the COXSizeControlBar derived class.
This happens even if AddPage from the Dundas tab control makes m_wndTree.SetParent(this) where 'this' is the tab control !!!!!!!!
So in fact, I am handling messages inside the grandparent window class (The COXSizeControlBar. I have also a COXShortcutBar inside the tab control and for this I made the same thing than with the tree control. I passed a pointer to the COXSizeControlBar in the create method of the shortcut bar and then added it to a page of the tab control (COX3DTabViewBar). As you know, AddPage() sets to 'this' the parent window of control passed as argument of the AddPage() method. In this case, I was not able to process messages inside the COXSizeControlBar. I found out that it is because COXSizeControlBar 'only' sends messages to its parent/owner window so it is only possible to process them there.
What is surprising to me is that I am able to process messages inside the grandparent window event if the Dundas code makes SetParent() to 'this' for the tree control inside the AddPage method of the tab control.
I also tried to handle the messages inside a CTreeControl derived class and also it does not work. This means, I cannot handle messages inside a control's derived class which very annoying. I do not know if this is an MFC problem because I do not know what is going on.
Any ideas of what is behind this behaviour?
Best Regards,
Miguel
|
|
|
|
|
Hi Miguel,
The tree control (SysTreeView32) like all common controls sends the TVN_BEGINLABELEDIT notification thought WM_NOTIFY to its parent. The problem is that the parent to which the notification messages are sent is set at creation time (when ::CreateEx(...) for the tree is called) and cannot be changed later on. You can call SetParent(...) later on until you are blue in the face, but the messages will still be sent to the original parent. This is a problem with SysTreeView32 common control. You can easily reproduce it with a simple dialog based application where you have a tree control as a child of a tab control.
The problem second problem - namely not being able to handle TVN_BEGINLABELEDIT in derived classes is a direct consequence of the problem that I just described. This is so because handling notification messages in derived classes relies on the parent window to reflect the message back to the child control.
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
Thanks for the info and for solving my problem. I could not read it until today.
Best Regards,
Miguel
|
|
|
|
|
Hi, all
In windows if we right click any file we get a popup menu which contains something like "undo, cut, copy....etc"
My question is suppose I am doing a project where my file extention is .har.
now When a user right clicks the .har files I want to add one extra menu item.
Hope I gave clear idea about my question.
Any help will be of good use to me
thanks
harinath
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
As far as I know, that has to do with shell programming. Look at Mike Dunn's awesome articles about shell programming here on CP.
A short explanation :
Your file extension has an entry in the registry uder HKEY_CLASSES_ROOT\.har, and the associated value is your file names, like "Harinath Files".
Then, under HKEY_CLASSES_ROOT\Harinath Files\shell\command\open, you have your application path, this meaning that the shell conmand "open" will launch the appliaction associated to .har files.
Now if you add some other commands, then they will be showed in the menu.
Check the articles I meant, and you'll see.
~RaGE();
|
|
|
|
|
|
Thank you buddy.
I am reading the article.
Thanks a lot.
cheers
harinath
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
Thanks
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
Hi,
I am trying to use a property page as a dialog. When I bring up the property page using DoModal funtion, the controls in the property page do not get tabbed. TAB does not move the focus to the next control.
Ex:
CPropertyPage* pPage = new CPropertyPage(IDD_DIALOG1);
pPage->DoModal();
If I use the same resource as a dialog, it works fine. I am able to tab to the next control in the dialog.
Ex:
CDialog* pDlg = new CDialog(IDD_DIALOG2);
pDlg->DoModal();
Has anyone seen this behaviour before?
Could I use property page as a dialog?
Please let me know if you have any solutions for this.
Thanks .
Praveen
|
|
|
|
|
Why do you want to use a Property Page like that ?
Create your property page, create one propertysheet, and Add() the propertypage to the property sheet. Then use pPropSheet->DoModal(); , and here the dialog tabs are handled "normally".
~RaGE();
|
|
|
|
|
I just wanted to reuse my code. I have the property page which I am adding it to the propertysheet in my app. I have commandline options for my app which will display only the property page as a dialog.
Please let me know if you have any solution for this.
Thanks .
Praveen
|
|
|
|
|
I am not sure about that, but I actually think that this is because of the Wizard Mode ability of Propertypages. Generally, the tabs in PropertyPages are handled by their PropertySheet, and not by the Pages themselves. This allows the tabs in wizard mode to be set only on the back, next and finish buttons.
Maybe you can try to mess with the m_psp member of the propertypage, maybe there actually is a way to set the tabs feature back, but I doubt it ...
~RaGE();
|
|
|
|
|
You must insert the Properthpage in propertysheet
Derive a Class from CPropertySheet says CMyProSheet oSheet;
Derive a Class from CPropertypage says CMyProPage oPage1;
in CMyProSheet Constructor,
You just add the
AddPage(&oPage1)
Then
oSheet.DoModal();
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Thanks guyz for helping. I have found a the solutions. The below code would solve my problem.
BOOL MyPropPage::PreTranslateMessage(MSG* pMsg)
{
if( pMsg && (pMsg->message == WM_KEYDOWN))
{
if (pMsg->wParam == VK_TAB)
{
CWnd* pNextControl = GetNextDlgTabItem(GetFocus(), (GetKeyState( VK_SHIFT ) & 0x8000));
if (pNextControl)
GotoDlgCtrl(pNextControl);//pNextControl->SetFocus();
}
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
Praveen
|
|
|
|
|
I create DialogBox using Api Windows
my question is how to get handle to this dialog before the dialog appears?
in MFC i got
CMyDlg dlg;
now I am able to pass dlg somwhere (to the tread in my case)
and I do dlg.doModal;
I want to do similar thing in WinAPi
but if I do
DialogBox(hInst, MAKEINTRESOURCE(IDD_AUTHORIZATION), h, (DLGPROC)authDialog);
the dialog box appears imiedetly, and I don't have HWND of it.
Please help
|
|
|
|
|
It's not possible to work with the HWND of a dialog before the dialog is created! There exists no HWND until the dialog is created!
If you want to use some functions that uses the HWND the dialog have to exist, otherwise the doesn't work!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Grab WM_INITDIALOG inside your authDialog proc. You can do the same stuff here you would do in OnInitDialog()
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Dear All,
How can we 'disable' close button in AfxMessageBox MessageBox ?
ie. it show it disabled and should not work.
Thanks in advance
Rohit Dhamija
|
|
|
|
|
One option would be to simply remove it. You can control what buttons are shown on a message box through the MB_xxx constants. If my memory serves me right then AfxMessageBox allows you to do that, otherwise you will have to use the ::MessageBox API directly.
If you already knew all this and you simply want to disable this button without removing it then there's no easy way to do it. Russ Freeman had an excellent article here somewhere where he described a method to hook into the creation of a message box and modify it - I can't seem to find it again. Then there is another article with a custom message box: http://www.codeproject.com/dialog/xmessagebox.asp[^] which you might want to take a look at.
Hope this helps.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Thanks a lot. Can you please which MB_XXX constant can be used to disable Close button ?
Rohit
|
|
|
|
|
there is no MB_xxx that allows you to do that!!!!!!!!!!!
you should be careful when guiding others, or don't guide them al all if you don't know what you are talking about !!
|
|
|
|
|
read the manual please ...
...<br />
Message_Box Types <br />
MB_ABORTRETRYIGNORE The message box contains three pushbuttons: Abort, Retry, and Ignore. <br />
MB_OK The message box contains one pushbutton: OK. <br />
MB_OKCANCEL The message box contains two pushbuttons: OK and Cancel. <br />
MB_RETRYCANCEL The message box contains two pushbuttons: Retry and Cancel. <br />
MB_YESNO The message box contains two pushbuttons: Yes and No. <br />
MB_YESNOCANCEL The message box contains three pushbuttons: Yes, No, and Cancel.<br />
...
Those are used to create the AfxMessageBox, maybe not for dynamically remove buttons.
If you want a message box with only an OK button, you create with MB_OK only flag.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
DEAR ALL.,,
I think I should make my problem more clearer to ALL.
-----------------------
How can we Disable Close button in title bar of a MessageBox ?
----------------------
Rohit
|
|
|
|
|
Lol .. Ok now I get what you want. You are talking about the cross in the upper right corner ? Then answer is easy : you can't. You shall make your own MessageBox if you want ot do this.
Why do you want to get rid of it ?
~RaGE();
|
|
|
|
|
Anonymous wrote:
you should be careful when guiding others, or don't guide them al all if you don't know what you are talking about !!
What are you trying to say ?
If you accuse dabs of giving wrong indications, then reread his post and you'll see what he says is perfectly correct.
If you mean Rohit Divas misunderstood what dabs answered and seems to ask something impossible, then please answer quietly its question.
In both cases, let me remind you that you are on a Forum here, that all the questions might seem silly when you already know the answer, but not when you don't know it, and that giving clues that may lead to a wrong direction (which happen very seldom on CP) is not a crime, but can happen to everybody. You are here to help, or to ask for help, but keep your sad remarks for you.
~RaGE();
|
|
|
|