Click here to Skip to main content
15,914,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUNICODE MFC libraries in VC6 Pin
Todd Smith17-Oct-02 11:39
Todd Smith17-Oct-02 11:39 
GeneralRe: UNICODE MFC libraries in VC6 Pin
Anders Molin17-Oct-02 12:07
professionalAnders Molin17-Oct-02 12:07 
GeneralRe: UNICODE MFC libraries in VC6 Pin
Michael Dunn17-Oct-02 15:08
sitebuilderMichael Dunn17-Oct-02 15:08 
QuestionIs this a Bug In Microsoft Code? Pin
perlmunger17-Oct-02 11:24
perlmunger17-Oct-02 11:24 
AnswerRe: Is this a Bug In Microsoft Code? Pin
Joaquín M López Muñoz17-Oct-02 11:36
Joaquín M López Muñoz17-Oct-02 11:36 
GeneralRe: Is this a Bug In Microsoft Code? Pin
perlmunger17-Oct-02 11:51
perlmunger17-Oct-02 11:51 
GeneralRe: Is this a Bug In Microsoft Code? Pin
Joaquín M López Muñoz17-Oct-02 12:00
Joaquín M López Muñoz17-Oct-02 12:00 
GeneralRe: Is this a Bug In Microsoft Code? Pin
perlmunger17-Oct-02 12:12
perlmunger17-Oct-02 12:12 
The offending lines are in bold (comutil.h):

inline _bstr_t::Data_t::Data_t(const _bstr_t& s1, const _bstr_t& s2) throw(_com_error)
	: m_str(NULL), m_RefCount(1)
{
	const unsigned int l1 = s1.length();
	const unsigned int l2 = s2.length();

	m_wstr = ::SysAllocStringByteLen(NULL, (l1 + l2) * sizeof(wchar_t));

	if (m_wstr == NULL) {
		if (l1 + l2 == 0) {
			return;
		}
		_com_issue_error(E_OUTOFMEMORY);
	}

	const wchar_t* wstr1 = static_cast<const wchar_t*>(s1);

	if (wstr1 != NULL) {
		memcpy(m_wstr, wstr1, (l1 + 1) * sizeof(wchar_t));
	}

	const wchar_t* wstr2 = static_cast<const wchar_t*>(s2);

	if (wstr2 != NULL) {
		memcpy(m_wstr + l1, wstr2, (l2 + 1) * sizeof(wchar_t));
	}
}


And here is how MRDBInsert.h is used.

#include "stdafx.h"
#include "MRFileProcessor.h"
#include "MRDBInsert.h"
#include "MRCSVInsert.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

void usage();

void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else if (argc < 2)
	{
		usage();
	}
	else
	{
             // main application code here
             // MRDBInsert is not instatiated.
             // Omitted for brevity
        }

}


My application structure is as follow:

MRProcessApp - Main Console application
MRProcessLib - Static Library - Contains misc classes
|--------- MRDBInsert.h/MRDBInsert.cpp
|--------- Other class files...

The Worskspace for MRProcessApp contains its own project and the MRProcessLib project. There is a dependency on the processLib in the processApp project.

Thanks for your help.

-Matt

------------------------------------------

The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
GeneralRe: Is this a Bug In Microsoft Code? Pin
Joaquín M López Muñoz17-Oct-02 12:18
Joaquín M López Muñoz17-Oct-02 12:18 
GeneralRe: Is this a Bug In Microsoft Code? Pin
perlmunger17-Oct-02 13:40
perlmunger17-Oct-02 13:40 
GeneralRe: Is this a Bug In Microsoft Code? Pin
Seefou17-Oct-02 11:53
Seefou17-Oct-02 11:53 
GeneralRe: Is this a Bug In Microsoft Code? Pin
perlmunger17-Oct-02 14:07
perlmunger17-Oct-02 14:07 
AnswerRe: Is this a Bug In Microsoft Code? Pin
perlmunger18-Oct-02 8:12
perlmunger18-Oct-02 8:12 
GeneralHandle double-click on an Edit box Pin
Karl17-Oct-02 10:55
Karl17-Oct-02 10:55 
GeneralRe: Handle double-click on an Edit box Pin
valikac17-Oct-02 12:43
valikac17-Oct-02 12:43 
GeneralPrinting contents of Dialog window Pin
AnanyasChintayantoyam17-Oct-02 9:46
sussAnanyasChintayantoyam17-Oct-02 9:46 
GeneralRe: Printing contents of Dialog window Pin
Chris Losinger17-Oct-02 11:46
professionalChris Losinger17-Oct-02 11:46 
GeneralRe: Printing contents of Dialog window Pin
Anonymous18-Oct-02 5:07
Anonymous18-Oct-02 5:07 
GeneralProblem converting Chinese characters to UTF8 Pin
Anonymous17-Oct-02 9:41
Anonymous17-Oct-02 9:41 
GeneralRe: Problem converting Chinese characters to UTF8 Pin
WWen17-Oct-02 10:32
WWen17-Oct-02 10:32 
GeneralRe: Problem converting Chinese characters to UTF8 Pin
Anonymous17-Oct-02 11:34
Anonymous17-Oct-02 11:34 
GeneralRe: Problem converting Chinese characters to UTF8 Pin
Michael Dunn17-Oct-02 15:09
sitebuilderMichael Dunn17-Oct-02 15:09 
Generalhaving a color show through another color Pin
Gilfrog17-Oct-02 9:10
Gilfrog17-Oct-02 9:10 
GeneralRe: having a color show through another color Pin
Christian Graus17-Oct-02 11:30
protectorChristian Graus17-Oct-02 11:30 
GeneralRe: having a color show through another color Pin
Chris Losinger17-Oct-02 11:58
professionalChris Losinger17-Oct-02 11:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.