|
Hello,
Can I change the CREATESTRUCT& cs without calling PreCreateWindow function in the ChildFrame and assign it to the window class procedure AfxRegisterWndClass()
Prithaa
|
|
|
|
|
What does mean "without calling PreCreateWindow"? The window class should be registered before the window gets created. To modify a window class, an ideal place is PreCreateWindow. If the window has already been created then you still may change separate attributes [of the window class] by using SetWindowLong, SetWindowLongPtr, SetClassLong..
--
=====
Arman
|
|
|
|
|
prithaa wrote: Can I change the CREATESTRUCT& cs without calling PreCreateWindow function in the ChildFrame
Do you mean without calling the base class PreCreateWindow()?
If so, then yes. If you want to use a different window class than the default MFC class then
you'll want to call AfxRegisterWndClass() sometime before you create the window (I personally
do this in the constructor). In your PreCreateWindow() override, set the class name in the
createstruct to the name of the class you registered.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hello,
Thanks for all your replies.
I mainly want to change the menu of the child window for which I want to change the CREATESTRUCT& cs.hMenu.
But even if I assign cs.hMenu = mynewmenu which is an object of CMenu I fail to see the new menu when the child window appears but
if I assign cs.lpszName = "my Window"; then the title changes of the child window.
I don't know why the menu does not take effect but the title of the window changes
Thanks
Pritha
|
|
|
|
|
Can child windows have a menu? According to the docs, the HMENU is an integer ID when the
window is a child.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi.
I have developed a program in Visual C++, MFC.
When I finished I ordered all the .h and .cpp files in folders, and then changed all the includes so that it could work fine.
It works, there is no error. but now when I open the class wizard it is empty. I think that it may be looking for the files in the old place. So, how can I say to the class wizard that now all the files are in another folder? Thanks.
|
|
|
|
|
Class wizard information is saved in a *.clw file. Delete this file and open class wizard again. It will ask you to rebuild class wizard info from source file, say yes. You will be able to select all your files once again.
|
|
|
|
|
Gosh!!! Thanks a lot!! I love you!!!
|
|
|
|
|
Already running into some issues, like not being able to add member variables of control types to controls in an MFC dialog app, but hoping a patch is available for VS2005 (or Vista?) to fix this?????
Are there any other issues I need to be aware of - the new IDE looks very nice, and it seems to compile and run under Vista but don't want to waste too much time making something work if there are going to be serious problems ahead.
cheers
Lee
|
|
|
|
|
|
That seems to have done something (installed SP1 and then the Vista update), but still don't seem to be able to properly/easily add member control variables to controls on dialogs like I used to with the class wizard. Even if I right click on the class view and Add variable, though I can now tick the control variable box, nothing is showing up in the drop down list for control IDs etc, and basically everything is empty - should this be working?
|
|
|
|
|
can anyone help please?
|
|
|
|
|
I had Buil my source code and be error like follow,
Please help Me....to solve them (my mail:thoyib.bustomi@iaodt.com) :
1>Compiling resources...
1>Linking...
1>LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
1>.\maxcust.def(3) : warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
1>.\maxcust.def(4) : warning LNK4017: EXETYPE statement not supported for the target platform; ignored
1> Creating library .\Debug/maxcust.lib and object .\Debug/maxcust.exp
1>mc200.obj : error LNK2019: unresolved external symbol __imp__wsprintfA referenced in function _GetText
1>mc200.obj : error LNK2019: unresolved external symbol __imp__GetWindowTextA@12 referenced in function _A_FindItemNum
1>mc300.obj : error LNK2001: unresolved external symbol __imp__GetWindowTextA@12
1>mc400.obj : error LNK2001: unresolved external symbol __imp__GetWindowTextA@12
1>mc200.obj : error LNK2019: unresolved external symbol __imp__SetWindowTextA@8 referenced in function _A_CompatibleRef
1>mc300.obj : error LNK2001: unresolved external symbol __imp__SetWindowTextA@8
1>mc400.obj : error LNK2001: unresolved external symbol __imp__SetWindowTextA@8
1>mc200.obj : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function _A_CheckApproverRequester
1>.\Debug/maxcust.dll : fatal error LNK1120: 4 unresolved externals
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Developer's Kit\maxcust\Debug\BuildLog.htm"
1>maxcust - 9 error(s), 1054 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
|
|
|
|
|
add an #include to afxwin.h in your project.
But this seems weird, usually this goes automatically added to the project when creating it. What plateform are you compiling for ? CE ?
Constantly "Saving the day" should be taken as a sign of organizational dysfunction rather than individual skill - Ryan Roberts[^]
|
|
|
|
|
Rage wrote: add an #include to afxwin.h in your project.
If afxwin.h was missing, he would be receiving compiler errors, not linker errors.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Whats your application type and your compiler?
|
|
|
|
|
specify the user32.lib in the link tab->object/library modules of the project settings
nave
|
|
|
|
|
Hello,
I'm using this code in all the dialogs of my app:
void CTAM_BODlg::OnActivateApp(BOOL bActive, DWORD dwThreadID)
{
CDialog::OnActivateApp(bActive, dwThreadID);
#ifndef DEBUG
if (bActive == FALSE)
{
this->SendMessage(WM_CLOSE);
}
#endif
}
The thing is that it seems it don't work always, sometimes the application just don't get closed.
I cannot get the keyboard strokes and neither I can get the mouse events, the computer in which that application is installed is not a normal computer, it is a robot controller. The software on the robot allows me to launch my application, but it don't allow me to get the keystrokes as the keyboard is not a normal keyboard that they are handling in a special way. In any way, when the customer presses one defined key, automatically the robot controller computer sets the focus to the main robot application. After that point I'd like to get my application closed. And this is what it fails sometimes.
What could I check or modify in order to make it work always?
As always thank you in advance.
|
|
|
|
|
Can you debug it (not with the debugger, but with a message on a display or something, just to be sure you are indeed going through the code ?)
You could as well try the OnKillFocus handler instead.
Constantly "Saving the day" should be taken as a sign of organizational dysfunction rather than individual skill - Ryan Roberts[^]
|
|
|
|
|
I'm using this code in all the dialogs of my app:
In regard to this info, your call SendMessage(WM_CLOSE) is wrong. It would close the application only when 'this' is the main window pointer. Otherwise, the call closes a concrete dialog only. [Actually, you'd rather call PostMessage not SendMessage, anyway..].
Put AfxPostQuitMessage(0) instead of sending WM_CLOSE.
--
=====
Arman
|
|
|
|
|
I'm using a GlobalAddAtom function in my project to add a string and later posting a string(ATOM) to a window. I want to know the significance of this function. Well the intent here is to send a concatenated string to a window by means of PostMessage. But I really could not understand the significance of the same.
|
|
|
|
|
It allows a kind of interprocess communications: defining a global string that can be later retrieved by a numeric ID you can effectively send a string from an application to another one (e.g.PostMessaging the numeric ID to the receiving application).
Of course, documentation [^] helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I have created this tabbed dialog application and I want to have a wizard-like dialog inside to one of my tab controls..
Please help me how to do it..
I have a code already but it hangs up...
Anyone interested...please email me at ntongoy@infoweapons.com
Thank you!!!!
-- modified at 5:56 Wednesday 23rd May, 2007
|
|
|
|
|
I think that the best you can do is to make a property sheet and embed it into the dialog you are working by setting it as a child. Then each tab will have it's own dialog resource and it will be very easy to maintain.
Hope this helps...
|
|
|
|
|
Thats somehow what I did. But its somewhat complicated...
E.g.
I have have tab1. Tab1 is designed to act like a wizard. It contains a button "next". Everytime I click next, the dialog changes. But it is still in Tab1.
If you want to have a look at the code, I can send it to you through email.
Thanks...
|
|
|
|