|
Thanks a lot!
I will look into it.
-- narada
|
|
|
|
|
Hello,
I use a context menu with 2 sub menus as follow:
My Contex Menu>
TheMenu1
TheMenu2
If I click on TheMenu1 I would like the COMMAND message routed to a message handler function within
the class MyTreeCtrl derived from CTreeCtrl
and if I click on TheMenu2 I would like the COMMAND message routed to a message handler function within the class MyDialog class derived from CFileDialog
TheMenu1 works well but TheMenu2 does not.
I use VS 2003 and when I Created the context menu I used the event handler wizard to map Themenu1 and Themenu2 to their respective function and I selected the right class that receives the function. I created the event handler for MyTreeCtrl first.
Message map code is also correct here is the sample
//Class MyTreeCtrl
BEGIN_MESSAGE_MAP(MyTreeCtrl, CTreeCtrl)
ON_COMMAND(ID__NEW_INDICATOR, OnIndicatorIsNew)
END_MESSAGE_MAP()
// Fuctions are below
Bla Bla...
************************************
//Class MyDialog
BEGIN_MESSAGE_MAP(MyDialog ,CFileDialog)
ON_COMMAND(ID__NEW_SYMBOL, OnSymbolIsNew)
END_MESSAGE_MAP()
// Fuctions are below
Bla Bla...
My question is why class MyDialog does not intercept the message?
Also I have noticed that if I delete
ON_COMMAND(ID__NEW_INDICATOR, OnIndicatorIsNew)
and I leave
BEGIN_MESSAGE_MAP(MyTreeCtrl, CTreeCtrl)
//blank
END_MESSAGE_MAP()
everything continues to work well
any idea??
Thnks for your help
|
|
|
|
|
Arris7 wrote: and if I click on TheMenu2 I would like the COMMAND message routed to a message handler function within the class MyDialog class derived from CFileDialog
What do you mean by "if I click on TheMenu2"?
Are you looking to have one context menu for the tree control and another context menu for the dialog it self?
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Actually I would like only one contextmenu and two different classes that receive the messages.
Suppose that my contextmenu is like the menu File with two submenu New and Open.
If I click on open I would like that the COMMAND message is handled by the Class A
and when I click on New, the COMMAND message will be handled by the class B.
|
|
|
|
|
Hi All
I want to know that if can we use all API in VC++ 6.0 into VC++.Net.Is it benificial to use VC++.Net for product Developement? Send me your view on this.
Thanks and Regards
M. Atul
M. Atul
|
|
|
|
|
The API is not bound to a compiler/IDE version or another. More important is the Platform SDK in this case.
The main issue can be that a newer compiler is usually much less forgiving with warnings and errors than a previous one. Visual C++ 2005 compiler was absolutely "devastating" compared to Visual C++ 6.0 - after the first rebuild I get maybe 50 times more warnings, and sometimes even errors.
For example, a code like
for(int i = 0; i < 1; i++) {
f(i);
}
for(i = 0; i < 1; i++) {
g(i);
}
works in Visual C++ 6.0, but if you compile in Visual C++ 2005 with "force conformance in for loop scope", the second for statement will complain about undeclared i variable.
But go for it, if you can dedicate time for getting rid of those pesky warnings; expect also some code reworking.
|
|
|
|
|
The real question is do you want to take advantage of .NET?
I personally don't care for the VS 2005 IDE, but the complier is worlds better than VC 6.0 Complier. If you use STL at all it’s worth the upgrade to VS2005 alone.
If you are just doing C++ Development you can use VS2005 without worrying about .NET. Should you decide to move devolvement from VS 6.0 to VS 2005 there where some very important changes made. VS 2005 targets version 8 of the C / MFC run time, this isn’t a huge issue except most computers do not have the updated version of the run time installed. The only way to update the run time versions is to install them. Gone are the days of dropping dependency DLLs of that nature onto the computer, the new paradigm is SAS (Side By Side) DLL Support. This allows many versions of the same DLL to be run on the same box, theoretically eliminating DLL Hell. Additionally, by default all projects are UNICODE now (not generally an issue but it did trip me up for a few minutes).
Good Luck!
-- modified at 5:39 Wednesday 3rd January, 2007
-- modified at 5:40 Wednesday 3rd January, 2007
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
I'm trying to Localize my application but facing some problem.
Issue:
I'm having Resource's in Resource-Only DLL and this DLL contains String table Icons and Dialogs. I'm able to get the Strings & Icons and able invoke in EXE. But failed to invoke Dialogs.
Please can any one of you help me how to invoke dialogs from Reource-Only DLL in EXE.
Pradeep
|
|
|
|
|
Pradeep.Reddy wrote: But failed to invoke Dialogs.
How you are doing this ?
|
|
|
|
|
I have one MFC application, I removed the resource(.rc file) in the "File View". I created a "Reource-Only DLL" and I added that removed resource(.rc file and resource.h file) here. With Linker option as /NOENTRY.
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
Refer localization [^] section of this site.
You will get good idea , how to acheive this.
|
|
|
|
|
Try "AFX_MANAGE_STATE(AfxGetStaticModuleState());" before you call the dialog in the dll
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Hi,
Even I tried with "AFX_MANAGE_STATE(AfxGetStaticModuleState());".
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
If is a MFC dll, make the project MFC extension dll, load the dll normally with LoadLibrary or AfxLoadLibrary, and use it directly.
For example, you may have a dialog implemented in DlgCustom.cpp/.h in DlgCustom.dll but resource is actually in DlgCustomRC.dll.
A possible implementation can be
#include "../DlgCustomRC/resource.h"
class CDlgCustom
{
enum IDD = { IDD_CUSTOM };
protected:
HMODULE m_hRC;
};
CDlgCustom::CDlgCustom()
{
m_hRC = LoadLibrary(_T("DlgCustomRC.dll"));
}
CDlgCustom::~CDlgCustom()
{
FreeLibrary(m_hRC);
}
and instantiation can simply be
void CParentWindow::onCallCustom()
{
CDlgCustom dlg(this);
dlg.DoModal();
}
The DlgCustom.dll will export the class CDlgCustom, that will manage itself the loading of resource-only dll DlgCustomRC.dll.
VERY important is to have resources in all those binaries that do not overlap.
So NO two dialogs with the same ID in the same executable space. I had to write tools that detects and reports such "resource clash" conditions.
If you want to do the job manually, load the library with "load library as data file" since is a resource dll, locate the resource with RT_DIALOG and corresponding IDD, create the DLGTEMPLATE and then use a CreateDialogXXX call. MFC does this - consult the implementation of CreateDialog (I think is in ../mfc/src/dlgcore.cpp).
|
|
|
|
|
Hi,
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP"
Please can you help me on this...
Pradeep
|
|
|
|
|
It could be a custom control or ActiveX control that is not registered, and contained in the dialog. Other than that, I have no idea, and I can't help you since I cannot debug your code. Check again the usual problems (resources, dll paths, initialization problems etc.), it shouldn't be something that cannot be found on a careful analysis.
|
|
|
|
|
When i open a project provided by the manufacturer of an ip camera i get the following messages.
"The Active X control cannot be instantiated".
" 2 Active X controls could not be instantiated".
"Reinstall or Register the controls and try again".
How can i resolve this problem?
|
|
|
|
|
As error says, your project contains some activeX , which needs registration.
Try registering those.
|
|
|
|
|
|
You need to identify activeX in your project and use following line from commandline
regsvr32 /u "activeXFile"
RegSvr32[^]
|
|
|
|
|
Hi experts,
I want to add a com dll file in my project.I wtitten the below code to create a pst file in c drive.
Program compiled successfully
But the function Logon() goes fail and sows a exception :
"Unhandled exception at 0x7c812a5b in samp.exe: 0x0EEDFADE: 0xeedfade."
CoInitialize(NULL);
IRDOSessionPtr session;
HRESULT hr = session.CreateInstance(__uuidof(RDOSession));
session->Logon(" ",NULL,NULL,NULL,NULL,NULL);
session.Release();
what is the problem.Is there other way to add com dll in prject.
Plz tell
manu
|
|
|
|
|
You should always check the returned HRESULT value, i.e.
if (FAILED(hr)))
{
}
and never use the pointer (even the smart ones ) if the
CreateInstance failed.
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.
|
|
|
|
|
Whats return value of hr?
|
|
|
|
|
Again this is malini.I dont know how to start. Suppose i am connected to net. And http://WebSite/ResourceName?Data=Data....... is the address. Can i find the address using C++. Does there exists any class for this?
Thanx in advance friends!!
Malini
|
|
|
|
|
Malini Nair wrote: Suppose i am connected to net. And http://WebSite/ResourceName?Data=Data....... is the address.
You can be connected to more than one site at a time. IE has an automation interface that you can use to enumerate the currently open URLs.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|