EDN Admin
Well-known member
I am facing a problem in UNICODE last many days and i did not get any solution. Again i am trying to solve it.Please help me...
I have many ragular dll with MBCS.I open the GUI part from dll into Application(exe). Now i want to convert these into UNICODE.I want to change all dll one by one into UNICODE. So i changed an Dll and Application(exe) into UNICODE by mentioning
"Character Set" as a UNICODE in project setting. When i change "Charcter Set" as a UNICODE then i got many error. I solved them and compile then i did not get any error , but when i run the project then i get ASSERT ERROR(crash). It was working fine with MBCS,
but there is problem in UNICODE. I am mentioning all things about ASSERT.
the place where poiner goes when crash happen.
<img src="http://social.microsoft.com/Forums/getfile/1915/" alt="" width="522" height="280
I searched about it on internet and i observed that there is many CWinApp thread is runing.So i removed the source (cpp) file that contain CWinApp object from DLL. And now there is problem about Resource Handling and getting ASSERT on other place.
<img src="http://social.microsoft.com/Forums/getfile/11216/" alt="
Application file code is below from where i open the dialog from DLL.
<div style="color:Black;background-color:White; <pre>
#include <span style="color:#A31515; "stdafx.h"
#include <span style="color:#A31515; "sdPrmApp.h"
#include <span style="color:#A31515; "sdPrmAppDlg.h"
#include <string> <span style="color:Green; //Unicode Changes
#ifndef CDP_COM_sdPrm_H_INCLUDED
#include <span style="color:#A31515; "sdPrm.h"
#endif <span style="color:Green; //CDP_COM_sdPrm_H_INCLUDED
#include <span style="color:#A31515; "..sdCommonsdsdcini.h" <span style="color:Green; // Vikas Bhutani, April 11, 2011, VI-11012007.32135
#ifdef _DEBUG
#define <span style="color:Blue; new DEBUG_NEW
#undef THIS_FILE
<span style="color:Blue; static <span style="color:Blue; char THIS_FILE[] = __FILE__;
#endif
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp
BEGIN_MESSAGE_MAP(CSdPrmAppApp, CWinApp)
<span style="color:Green; //{{AFX_MSG_MAP(CSdPrmAppApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
<span style="color:Green; // NOTE - the ClassWizard will add and remove mapping macros here.
<span style="color:Green; // DO NOT EDIT what you see in these blocks of generated code!
<span style="color:Green; //}}AFX_MSG_MAP
END_MESSAGE_MAP()
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp construction
CSdPrmAppApp::CSdPrmAppApp()
{
<span style="color:Green; // TODO: add construction code here,
<span style="color:Green; // Place all significant initialization in InitInstance
}
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // The one and only CSdPrmAppApp object
CSdPrmAppApp theApp;
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp initialization
BOOL CSdPrmAppApp::InitInstance()
{
<span style="color:Green; /*// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();*/
AfxEnableControlContainer();
<span style="color:Green; // Standard initialization
<span style="color:Green; // If you are not using these features and wish to reduce the size
<span style="color:Green; // of your final executable, you should remove from the following
<span style="color:Green; // the specific initialization routines you do not need.
<span style="color:Green; // Change the registry key under which our settings are stored.
<span style="color:Green; // TODO: You should modify this string to be something appropriate
<span style="color:Green; // such as the name of your company or organization.
SetRegistryKey(_T(<span style="color:#A31515; "CDP Communications Inc"));
<span style="color:Green; //new CDynLinkLibrary();
#ifdef _AFXDLL
Enable3dControls(); <span style="color:Green; // Call this when using MFC in a shared DLL
#<span style="color:Blue; else
Enable3dControlsStatic(); <span style="color:Green; // Call this when linking to MFC statically
#endif
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
<span style="color:Green; // Open doc
<span style="color:Green; //
<span style="color:Green; // Parmod Nehra, April 11, 2011, VI-11012007.32135 =============>
<span style="color:Green; /*CString strError,strConfigFilePath;
if( !sdSDCINI::GetConfigFilePathEx(strConfigFilePath, strError) )
{
AfxMessageBox(strError);
}*/
CStringA strErrorA, strConfigFilePathA;
<span style="color:Blue; if( !sdSDCINI::GetConfigFilePathEx(strConfigFilePathA, strErrorA) )
{
CString strError( strErrorA );
AfxMessageBox(strError);
}
<span style="color:Green; // Parmod Nehra, April 11, 2011, VI-11012007.32135 <============
CsdPrmDoc SdPrmDoc;
SdPrmDoc.c_hIcon = ::AfxGetApp()->LoadIcon(IDR_MAINFRAME);
HINSTANCE hPrevInstance = AfxGetResourceHandle();
<span style="color:Green; /*BOOL rc =*/ <span style="color:Green; //SdPrmDoc.Open( cmdInfo.m_strFileName );
<span style="color:Green; //Convert CString to CStringA
CStringA Convert(cmdInfo.m_strFileName);
SdPrmDoc.Open( (LPCSTR)Convert ); <span style="color:Green; //Unicode Changes
<span style="color:Blue; return TRUE;
}
[/code]
Can any one suggest me or help me that how to solve it( how to handle resource if i remove the source file(cpp file) that contain CWinApp object from DLL. Pls help me.
View the full article
I have many ragular dll with MBCS.I open the GUI part from dll into Application(exe). Now i want to convert these into UNICODE.I want to change all dll one by one into UNICODE. So i changed an Dll and Application(exe) into UNICODE by mentioning
"Character Set" as a UNICODE in project setting. When i change "Charcter Set" as a UNICODE then i got many error. I solved them and compile then i did not get any error , but when i run the project then i get ASSERT ERROR(crash). It was working fine with MBCS,
but there is problem in UNICODE. I am mentioning all things about ASSERT.
the place where poiner goes when crash happen.
<img src="http://social.microsoft.com/Forums/getfile/1915/" alt="" width="522" height="280
I searched about it on internet and i observed that there is many CWinApp thread is runing.So i removed the source (cpp) file that contain CWinApp object from DLL. And now there is problem about Resource Handling and getting ASSERT on other place.
<img src="http://social.microsoft.com/Forums/getfile/11216/" alt="
Application file code is below from where i open the dialog from DLL.
<div style="color:Black;background-color:White; <pre>
#include <span style="color:#A31515; "stdafx.h"
#include <span style="color:#A31515; "sdPrmApp.h"
#include <span style="color:#A31515; "sdPrmAppDlg.h"
#include <string> <span style="color:Green; //Unicode Changes
#ifndef CDP_COM_sdPrm_H_INCLUDED
#include <span style="color:#A31515; "sdPrm.h"
#endif <span style="color:Green; //CDP_COM_sdPrm_H_INCLUDED
#include <span style="color:#A31515; "..sdCommonsdsdcini.h" <span style="color:Green; // Vikas Bhutani, April 11, 2011, VI-11012007.32135
#ifdef _DEBUG
#define <span style="color:Blue; new DEBUG_NEW
#undef THIS_FILE
<span style="color:Blue; static <span style="color:Blue; char THIS_FILE[] = __FILE__;
#endif
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp
BEGIN_MESSAGE_MAP(CSdPrmAppApp, CWinApp)
<span style="color:Green; //{{AFX_MSG_MAP(CSdPrmAppApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
<span style="color:Green; // NOTE - the ClassWizard will add and remove mapping macros here.
<span style="color:Green; // DO NOT EDIT what you see in these blocks of generated code!
<span style="color:Green; //}}AFX_MSG_MAP
END_MESSAGE_MAP()
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp construction
CSdPrmAppApp::CSdPrmAppApp()
{
<span style="color:Green; // TODO: add construction code here,
<span style="color:Green; // Place all significant initialization in InitInstance
}
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // The one and only CSdPrmAppApp object
CSdPrmAppApp theApp;
<span style="color:Green; /////////////////////////////////////////////////////////////////////////////
<span style="color:Green; // CSdPrmAppApp initialization
BOOL CSdPrmAppApp::InitInstance()
{
<span style="color:Green; /*// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();*/
AfxEnableControlContainer();
<span style="color:Green; // Standard initialization
<span style="color:Green; // If you are not using these features and wish to reduce the size
<span style="color:Green; // of your final executable, you should remove from the following
<span style="color:Green; // the specific initialization routines you do not need.
<span style="color:Green; // Change the registry key under which our settings are stored.
<span style="color:Green; // TODO: You should modify this string to be something appropriate
<span style="color:Green; // such as the name of your company or organization.
SetRegistryKey(_T(<span style="color:#A31515; "CDP Communications Inc"));
<span style="color:Green; //new CDynLinkLibrary();
#ifdef _AFXDLL
Enable3dControls(); <span style="color:Green; // Call this when using MFC in a shared DLL
#<span style="color:Blue; else
Enable3dControlsStatic(); <span style="color:Green; // Call this when linking to MFC statically
#endif
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
<span style="color:Green; // Open doc
<span style="color:Green; //
<span style="color:Green; // Parmod Nehra, April 11, 2011, VI-11012007.32135 =============>
<span style="color:Green; /*CString strError,strConfigFilePath;
if( !sdSDCINI::GetConfigFilePathEx(strConfigFilePath, strError) )
{
AfxMessageBox(strError);
}*/
CStringA strErrorA, strConfigFilePathA;
<span style="color:Blue; if( !sdSDCINI::GetConfigFilePathEx(strConfigFilePathA, strErrorA) )
{
CString strError( strErrorA );
AfxMessageBox(strError);
}
<span style="color:Green; // Parmod Nehra, April 11, 2011, VI-11012007.32135 <============
CsdPrmDoc SdPrmDoc;
SdPrmDoc.c_hIcon = ::AfxGetApp()->LoadIcon(IDR_MAINFRAME);
HINSTANCE hPrevInstance = AfxGetResourceHandle();
<span style="color:Green; /*BOOL rc =*/ <span style="color:Green; //SdPrmDoc.Open( cmdInfo.m_strFileName );
<span style="color:Green; //Convert CString to CStringA
CStringA Convert(cmdInfo.m_strFileName);
SdPrmDoc.Open( (LPCSTR)Convert ); <span style="color:Green; //Unicode Changes
<span style="color:Blue; return TRUE;
}
[/code]
Can any one suggest me or help me that how to solve it( how to handle resource if i remove the source file(cpp file) that contain CWinApp object from DLL. Pls help me.
View the full article