|
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
CWinApp theApp;
void usage();
void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else if (argc < 2)
{
usage();
}
else
{
}
}
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
|
|
|
|
|
Do you in any manner overload memcpy or redefine (through macros, maybe) wchar_t ? This seems unlikely, but the error is truly odd.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I wish. It is odd indeed!! I can't imagine that no one has ever built a console application with ADOX support and haven't faced this error. I can't find a reference to it anywhere on the internet. Google, Google Groups, etc........ Nada!
If you know of any other possibilities, I'm all ears. Thanks for looking at this.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
reinstall vC++ with unicode support libraries. just select
VC++ while instalation and then select upper button above
select all and select all the options the submenu. this
will solve the problem.
seefou
|
|
|
|
|
I've done what you suggested and it doesn't appear to have worked. Is there anything that I need to do in the project settings now to take advantage of what I've installed?
Thanks for your help.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I never did figure out the problem. Instead, I created a new Console applicatiton. Since my console application simply used classes from my static library, I just pasted the old _tmain code into the new _tmain and linked the library in again. Works beautifully now and I have yet to figure out what is different between the project that won't work and the one that does. Just FYI.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I am trying to build an application that calls a dialog if an Edit box is double-clicked. The basic application is a read-only view of DB Records where various fields that were created using a combo/dropdown are displayed as a simple string inside an edit box.
I would like to call a dialog on double-click on the edit box that then queries the DB, populating a combo/dropdown to select a different value for that field.
|
|
|
|
|
One solution is to add a double-click handler for the edit box. I believe there is a message for double-click in an edito box.
Check MSDN.
Kuphryn
|
|
|
|
|
i have a Dialog Application and have a CTreeCtrl as one of its members . I need to print the contents of the CtreeCtrl . How do I go about this ?
Please help
|
|
|
|
|
do you want to print it as an image, or do you want to extract the contents and print them in some other format? either way, you have to do it by-hand.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
I was assuming there was something like a Print Preview or a Print Pane available.
Another Option is to make this dialog a a part of a frame , which is in turn a part of an SDI application and then print the data .
Thanks
|
|
|
|
|
I am trying to convert a string of Chinese characters to UTF8.
The code is as follows:
<br />
res = WideCharToMultiByte(CP_UTF8,0,(LPCWSTR)lpwszSearchURL,-1,&buffer[0],1000,NULL,NULL);<br />
This seems really basic, but the UTF8 I get back is always %3F %3F %3f etc (Basically ???)
Any ideas and thanks?
|
|
|
|
|
Here is the working sample we used in our project:
/* convert buffer from TCHAR to UTF-8 */
LPTSTR pszRequestBuf, int nBufLength;
char *szReqBuf;
int nBytes;
szReqBuf = (char *)malloc(nBufLength*sizeof(TCHAR));
nBytes = WideCharToMultiByte(CP_UTF8, 0, pszRequestBuf, nBufLength,szReqBuf, nBufLength*sizeof(TCHAR), NULL, NULL);
Your project should be in Unicode mode.
Hope this will work.
|
|
|
|
|
Does this work under both Windows 2K and Windows 98? Looking at MSDN, it seems that for 2K you are supposed to use CP_SYMBOL or CP_THREAD_ACP.
Thanks for the quick response.
|
|
|
|
|
WideCharToMultiByte converts to DBCS, not UTF-8.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color.
I would like to blend these 2 colors to show that it is selected and show the original cell background color.
when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines.
Similar to how excel handles selection and background colors.
thanks
|
|
|
|
|
If it's just two values, blend them yourself. Or use GDI+, which has transparency, or AlphaBlt ( I think ), which is in Windows 98 upwards. Or go to the WDJ site and download the code for my article on doing alphablending for Windows 95.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Rblend = (R1 + R2) / 2
Gblend = (G1 + G2) / 2
Bblend = (B1 + B2) / 2
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
COLORREF CList::Transform2SelColor(COLORREF clr)
{
return RGB(
abs( ((DWORD)clr&0xFF) - (255 - ((DWORD)m_clrSelection&0xFF)) ),
abs( (((DWORD)clr>>8)&0xFF) - (255 -(((DWORD)m_clrSelection>>8)&0xFF)) ),
abs( (((DWORD)clr>>16)&0xFF) - (255 - (((DWORD)m_clrSelection>>16)&0xFF)) ));
}
where clr is the slection color
take the absolute value of (R value of the selection color - the inverse of the background color)
|
|
|
|
|
Hi,
I need to delete files that are in use.
I can´t restart my computer or neither exit programs that are using them. Any suggestions? Need to work on NT/2000 server.
/Ola Carlsson
|
|
|
|
|
|
SHFileOperation, I think it can do that ...
Max.
|
|
|
|
|
That reminds me of a question:
How can one determine the process(es) by which
the file is in use? It's be nice to have a little
utility that reports who has what files open.
|
|
|
|
|
Scott H. Settlemier wrote:
How can one determine the process(es) by which
the file is in use?
http://www.sysinternals.com/[^]
Has just such a utility
|
|
|
|
|
Dear all,
I need to use INetCfg COM interface.
so I import it's dll in my project
#import <netcfgx.dll>
but got the following error:
/////////////////
fatal error C1083: Cannot open type library file: 'netcfgx.dll': Error loading type library/DLL.
////////////////////
I can find this netcfgx.dll under the WINNT/system32/
Need Help!
Laura
|
|
|
|