|
Does DDX work in CWnd and CFormViews? I thought it was for CDialog-derived windows.
These lines shouldn't be necessary:
m_ComboTools.SetOwner(this);
m_ComboTools.SetParent(this);
Is your window class in a DLL or EXE?
None of this sounds related to MFC in a DLL to me, but there are issues (well documented) with
MFC extension DLLs (DLLs with classes which derive from MFC classes and are used by other MFC
applications).
|
|
|
|
|
Yes, you are right, DDX is for the automatic data transfer between controls and associated member variables of CDialog or CFormView derived classes.
The problem is that this mechanism works well in stand alone EXEs and DLLs which are linked at compile time.
My DLLs are linked at runtime via a call to LoadLibrary(), there is no chance for the compiler to puzzle all the message maps together I think. Somewhere there must lie the problem.
My window is created IN the DLL, the parent window is given to the DLL by a pointer to a CWnd, as you can see in my code.
Previously I said, that the whole Message map does not work. That was not correct. Messages for the window itself (i.e. WM_MOUSEMOVE, WM_CREATE, WM_SIZE) are delivered through the Message Map to the handler functions correctly. Only messages for the child windows like controls are not delivered.
I don't understand this behaviour... After 8 years MFC programming ;-((
|
|
|
|
|
ulretsam wrote: DDX is for the automatic data transfer between controls and associated member variables of CDialog or CFormView derived classes.
My mistake....I didn't realize DDX was part of CWnd, not CDialog.
Do you need to call UpdateData() to get MFC to call DoDataExchange()?
ulretsam wrote: My DLLs are linked at runtime via a call to LoadLibrary()
How do you link all the MFC classes once the DLL is loaded?? Wouldn't implicitly linking be
much easier??
Also, if you haven't done so already ... make sure you have something like this in your extension
dll:
static AFX_EXTENSION_MODULE MyDLLProjectDLL = { NULL, NULL };
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(MyDLLProjectDLL, hInstance))
return 0;
new CDynLinkLibrary(MyDLLProjectDLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
AfxTermExtensionModule(MyDLLProjectDLL);
}
return 1;
}
Also, your EXE should be set to use MFC in a dll, not statically linked.
|
|
|
|
|
|
I found out whats going on.
I overwrote the OnCmdMessage function because stupid as I am I thought that I am not able to make dynamic message map entries like this:
<br />
ON_COMMAND(g_iFirstCmdID + CMDID_STABILITY_TRACE, OnStabilityTrace)<br />
I thought, that the first parameter in the macro has to be a constant.
The EXE dynamically distributes ranges of command IDs to all the connected Plugin DLLs. A DLL simply says at connection time how many CmdIDs it requires and then the EXE preserves this amount of IDs from a specific start-ID on. This start-ID depends on how many plugin are already connected and how many CmdIDs they require.
So I overwrote the OnCmdMessage function and the effect was that WM_COMMAND messages were not delivered to the message map. The ON_CBN_SELCHANGE of my ComboBox is also WM_COMMAND based.
I found that I received the message ON_CBN_SELCHANGE in OnCmdMessage. After that I tried to delete the OnCmdMessage and change the message map entries like above.
It works perfectly now!! Maybe I'll write an arcticle about the plugin system...
Thanks for help!
|
|
|
|
|
Have a debug failure when creating a window of my COM 3d imager.
When I created my 3d imager window inside my application…
bRet = m_pSatMap->Create("Internal_DB_SAT_Map", 0, Rect, pMainFrm, ID_SAT_MEM_MAP, NULL, FALSE);
I got an assertion error from ENSURE(afxOccMgr != NULL)”. After researching this I found that this would occur when AfxEnableControlContainer() was not call. However it is in my main but not in my subclass where the Create is called. So I added it to that class, and now I have another assertion problem. Now “ASSERT(pWndCtrl->m_pCtrlSite == NULL)” is failing.
I think I’m looking for a site that speaks to how to pass afx control to classes inside an application.
Thanks for any help
Glenn
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Does somebody has some tricks (or code) about multilanguage support ? (C++ , XML, or something else).;)
Danny Gilbert, enginneer
Montréal, Canada
|
|
|
|
|
what exactly do you want ?
i put all my GUI strings into the resource strings table, and duplicate the table for each translation i need.
in the table properties, don't forget to associate a resource language to it.
|
|
|
|
|
|
Easy question but I don't find the answer.
I have a header file with some classes. These classes used some class from one another header file.
How can I tell to compiler to use the classes from other header files ?
Extern does not work, only work on object.
Danny Gilbert
Montréal, Canada
|
|
|
|
|
dannygilbert3 wrote: How can I tell to compiler to use the classes from other header files ?
#include "OtherHeaderFile.h"
|
|
|
|
|
#include is the directive for you...
|
|
|
|
|
If you only need to declare pointers or references to those other classes, you can do a forward declaration (I believe that is what it is called) by putting code like this:
class CClass;
class CSomeOtherClass; Before the code that declare pointers/references to that class.
class CClass;
class CSomeOtherClass;
class CMyClass
{
public:
CMyClass( CClass *pClass );
CMyClass( CSomeOtherClass &socSomeOtherClass );
<code>CMyClass( CAnotherClass *pAnotherClass );</code> <code>
<code>CMyClass( CAnotherClass &cacAnotherClass );</code> <code>
}; If you need to actually access members of the class, then you need to include the entire declaration of the class (usually by including its .H file). This is usually required in the CPP file for the class that uses the other classes. Be careful throwing includes around freely if you are not fully familiar with the code, you can introduce dependency problems and/or mess up your build times.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
Hi all,
I do:
CFileDialog fd(TRUE, NULL, percorso, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY);
fd.m_pOFN->lpstrTitle = "Dialog Title";
Now i need a CFileDialog that shows only .txt files.
I also need another CFileDialog which i use to save a file
in which the "file type" field is .txt
How can i do that ?
Thanx in advance,
Desmo16.
|
|
|
|
|
Look up how to construct Filters for the common file dialog. The docs for CFileDialog is a good place to start.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
set the extensions filter to "Text files (*.txt)|*.txt||"
|
|
|
|
|
i tried with
CFileDialog fd(TRUE, NULL, percorso, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY);
fd.m_pOFN->lpstrTitle = "load file";
fd.m_pOFN->lpstrDefExt = "txt";
and also with
CFileDialog fd(TRUE, NULL, percorso, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY);
fd.m_pOFN->lpstrTitle = "load file";
fd.SetDefExt("txt");
but it doesn't work.
Where should i search in the doc exactly ?
|
|
|
|
|
not what i told you to do.
i said assign the string "Text files (*.txt)|*.txt||" into the filter member of the CFileDialog...
(see the 5th parameter of the constructor)
|
|
|
|
|
You are right, now i wrote:
CFileDialog fd(TRUE, NULL, "*.txt", OFN_FILEMUSTEXIST | OFN_HIDEREADONLY);
fd.m_pOFN->lpstrTitle = "Carica file di osservazioni";
fd.m_pOFN->lpstrFilter = "Text files (*.txt)";
and it works great ! Thanx !
|
|
|
|
|
yes, i modified my previous post ; you could also have done this using the 5th parameter of the constructor...
also, don't hesitate to read the MSDN[^]. it's there for you !
|
|
|
|
|
The CFileDialog has on the bottom-right
corner a button labeled as "open".
How can i change the label into "save" ?
Thanx in advance,
Desmo16.
|
|
|
|
|
i am facing a problem with the socket class in win32. when trying to link windows and unix machines in win32 the unix machine not get the information as the sockets was closed for the threads which are finished .the recieving end just waits for all the threads to finish and only after all the threads finish the sockets was considered closed. is the socket class is blocking or non blocking type.
vineesh
|
|
|
|
|
Sounds like a problem with SO_LINGER. I do not think that has anything to do with blocking or non-blocking sockets.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Maybe this will help. From the SDK...
To assure that all data is sent and received on a connected socket before it is closed, an
application should use shutdown to close connection before calling closesocket. For example, to
initiate a graceful disconnect:
Call WSAAsyncSelect to register for FD_CLOSE notification.
Call shutdown with how=SD_SEND.
When FD_CLOSE received, call recv until zero returned, or SOCKET_ERROR.
Call closesocket.
Note The shutdown function does not block regardless of the SO_LINGER setting on the socket.
|
|
|
|