|
I remove control from my dialog and put simple place holder and created CDateTimeCtrl in InitDialog() member function, everything worked fine.
<br />
m_DateTime.Create(WS_CHILD|WS_VISIBLE|DTS_SHORTDATEFORMAT,rc,this,IDC_DATETIME);<br />
But how I can add member variable to my control (CString)?
Before I did it through Wizard!?
|
|
|
|
|
Solved, It just didn't work for some time for no reason, now it's OK!
|
|
|
|
|
Hi,
The following code complied properly in Vc++ 7.1.When I implemented the same code in VC++ 6.0 its giving the errors(I am not much used to VC++6.0).
The code is reading the data present in an XML file.
\****************************************************************\
MSXML::IXMLDOMNodePtr m_pDSNNode;
CString parNamevalue;
_bstr_t parName="name";
_bstr_t parval="value";
for(MSXML::IXMLDOMNodePtr pChild = m_pDSNNode->firstChild;
NULL != pChild;
pChild = pChild->nextSibling)
{
if (MSXML::NODE_ELEMENT== pChild->nodeType)
{
MSXML::IXMLDOMElementPtr pElement=pChild;
parNamevalue=pElement->getAttribute(parName);
if(parNamevalue.CompareNoCase("DataSourceName")==0)
{
strDSNName=pElement->getAttribute(parval);
strDSNName.TrimLeft();
strDSNName.TrimRight();
break;
}
}
}
\**********************************************\
The compile errors I got are
(1) error C2227: left of '->firstChild' must point to class/struct/union
(2) error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class _variant_t' (or there is no acceptable conversion)
(3)error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class _variant_t' (or there is no acceptable conversion)
Someone help me out of this problem
Thanks in advance
Regards
Engilela
|
|
|
|
|
I guess VC 6 dont know the MSXML::IXMLDOMNodePtr. Define the right WIN_VER and IE.
Comment all error lines out to find the primary error.
Better use a newer version of VC, VC6 is outdated.
Greetings from Germany
|
|
|
|
|
Hi KarstenK,
Thank u very much for your reply. I have changed MSXML to MSXML2 and tested the code.But i am getting the same errors. Our project is in VC6.0 so i cont use latest version. So help me out of this problem.
Regards
Engilela
|
|
|
|
|
Are you including all libs, headers, APIs and/or other files that the MSXML need? Maybe is by default in later versions of VC++ but in the 6.0 you will need them extra.
The C2227 is telling you the same as if you use a class from a dll whose headers where not properly included.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I used the code in tne article titled "Comparing Two Bitmaps for Equality".I get some errors as,
'GetDC' : function does not take 1 parameters
wher i used HDC hdc = GetDC(NULL); and
error C2446: '<' : no conversion from 'unsigned long' to 'unsigned char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast where i used BYTE *pLeftBits = new BYTE<BitmapInfoLeft.bmiHeader.biSizeImage>;
Please help
modified on Tuesday, July 1, 2008 12:52 AM
|
|
|
|
|
corrected the 2nd error.please help with the first.
|
|
|
|
|
projectip wrote: HDC hdc = GetDC(NULL);
Use GetDC()
projectip wrote: error C2446: '<' : no conversion from 'unsigned long' to 'unsigned char *' ...
Doesn't the error message itself say that unsigned long cannot be converted to unsigned char* and the function would be taking unsigned char* as a parameter
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Now it gives error,'initializing' : cannot convert from 'class CDC *' to 'struct HDC_
|
|
|
|
|
::GetDC
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I get a warningconversion from 'unsigned long' to 'unsigned char', possible loss of data
|
|
|
|
|
CDC *pDC = GetDC();
HDC hDC = pDC->GetSafeHDC()
...
...
ReleaseDC(pDC);
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
I get a warning
conversion from 'unsigned long' to 'unsigned char', possible loss of data<br /> when i give BYTE *pLeftBits = new BYTE(BitmapInfoLeft.bmiHeader.biSizeImage);
|
|
|
|
|
I get a warning
conversion from 'unsigned long' to 'unsigned char', possible loss of data<br /> when i give BYTE *pLeftBits = new BYTE(BitmapInfoLeft.bmiHeader.biSizeImage);
the entire code is..
bool CMydlgtestDlg::CompareBitmaps(HBITMAP HBitmapLeft, HBITMAP HBitmapRight)
{
if (HBitmapLeft == HBitmapRight)
{
return true;
}
if (NULL == HBitmapLeft || NULL == HBitmapRight)
{
return false;
}
bool bSame = false;
CDC *pDC = GetDC();
HDC hdc = pDC->GetSafeHdc();
BITMAPINFO BitmapInfoLeft = {0};
BITMAPINFO BitmapInfoRight = {0};
BitmapInfoLeft.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfoRight.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
if (0 != GetDIBits(hdc, HBitmapLeft, 0, 0, NULL, &BitmapInfoLeft, DIB_RGB_COLORS) &&
0 != GetDIBits(hdc, HBitmapRight, 0, 0, NULL, &BitmapInfoRight, DIB_RGB_COLORS))
{
if (0 == memcmp(&BitmapInfoLeft.bmiHeader, &BitmapInfoRight.bmiHeader,
sizeof(BITMAPINFOHEADER)))
{
BYTE *pLeftBits = new BYTE(BitmapInfoLeft.bmiHeader.biSizeImage);
BYTE *pRightBits = new BYTE(BitmapInfoRight.bmiHeader.biSizeImage);
BYTE *pByteLeft = NULL;
BYTE *pByteRight = NULL;
PBITMAPINFO pBitmapInfoLeft = &BitmapInfoLeft;
PBITMAPINFO pBitmapInfoRight = &BitmapInfoRight;
int AdditionalMemory = 0;
switch (BitmapInfoLeft.bmiHeader.biBitCount)
{
case 1:
AdditionalMemory = 1 * sizeof(RGBQUAD);
break;
case 4:
AdditionalMemory = 15 * sizeof(RGBQUAD);
break;
case 8:
AdditionalMemory = 255 * sizeof(RGBQUAD);
break;
case 16:
case 32:
AdditionalMemory = 2 * sizeof(RGBQUAD);
}
if (AdditionalMemory)
{
pByteLeft = new BYTE[sizeof(BITMAPINFO) + AdditionalMemory];
if (pByteLeft)
{
memset(pByteLeft, 0, sizeof(BITMAPINFO) + AdditionalMemory);
memcpy(pByteLeft, pBitmapInfoLeft, sizeof(BITMAPINFO));
pBitmapInfoLeft = (PBITMAPINFO)pByteLeft;
}
pByteRight = new BYTE[sizeof(BITMAPINFO) + AdditionalMemory];
if (pByteRight)
{
memset(pByteRight, 0, sizeof(BITMAPINFO) + AdditionalMemory);
memcpy(pByteRight, pBitmapInfoRight, sizeof(BITMAPINFO));
pBitmapInfoRight = (PBITMAPINFO)pByteRight;
}
}
if (pLeftBits && pRightBits && pBitmapInfoLeft && pBitmapInfoRight)
{
memset(pLeftBits, 0, BitmapInfoLeft.bmiHeader.biSizeImage);
memset(pRightBits, 0, BitmapInfoRight.bmiHeader.biSizeImage);
if (0 != GetDIBits(hdc, HBitmapLeft, 0,
pBitmapInfoLeft->bmiHeader.biHeight, pLeftBits, pBitmapInfoLeft,
DIB_RGB_COLORS) && 0 != GetDIBits(hdc, HBitmapRight, 0,
pBitmapInfoRight->bmiHeader.biHeight, pRightBits, pBitmapInfoRight,
DIB_RGB_COLORS))
{
bSame = 0 == memcmp(pLeftBits, pRightBits,pBitmapInfoLeft->bmiHeader.biSizeImage);
}
}
delete[] pLeftBits;
delete[] pRightBits;
delete[] pByteLeft;
delete[] pByteRight;
}
}
ReleaseDC(pDC);
return bSame;
}
|
|
|
|
|
I am creating a SDI application using app-wizard with VS 2008. My problem is this application crashes in InitInstance() at ProcessShellCommand(). I must mention that I have added no code so far, so there can be no error from my part. I am guessing some configuration problem with my system.
Has anyone seen this behaviour?
Saurabh
|
|
|
|
|
yeah and the culprit was AfxOleInit(). It was a random problem and I was not able to reproduce it. May be two calls to initializing OLE libraries caused the problem. Call AfxOleInit/InitializeOle only once in your code.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
I am not initializing OLE as the code I am testing is generated by AppWizard and I haven't added anything yet. I did have one AfxOleInit in InitInstance and uncommenting it doesn't help.
Interesting thing is if I take the code to another machine, after building if works fine. So I am pretty sure that it a comfiguration problem rather than a coding bug. I would reinstall VS but I dont have time right now.
Saurabh
|
|
|
|
|
Hello everyone,
Suppose there are a couple of threads in an MTA, since a process could have only one MTA, I think,
1. Even if each threads calls CoInitializeEx or CoInitialize, only the first call allocates COM related resources, all subsequent calls does not allocate any resources?
2. Only the last call to CoUninitialize frees the COM resources in the MTA, and at that time, the MTA terminates?
Both are correct?
thanks in advance,
George
|
|
|
|
|
From the MSDN:
"Typically, the COM library is initialized on a thread only once. Subsequent calls to CoInitialize or CoInitializeEx on the same thread will succeed, as long as they do not attempt to change the concurrency model, but will return S_FALSE. To close the COM library gracefully, each successful call to CoInitialize or CoInitializeEx, including those that return S_FALSE, must be balanced by a corresponding call to CoUninitialize. However, the first thread in the application that calls CoInitialize(0) or CoInitializeEx(COINIT_APARTMENTTHREADED) must be the last thread to call CoUninitialize(). If the call sequence is not in this order, then subsequent calls to CoInitialize on the STA will fail and the application will not work."
|
|
|
|
|
Thanks Hamid,
I am thinking about there are two levels of COM related resources? Or just MTA level COM related resources?
1. MTA level (apartment level resource), allocated by the 1st thread of the
MTA which calls CoInitialize[Ex], freed by the last thread which calls
CoUninitialize of the MTA;
2. Thread level resource, allocated and freed each time a thread in the MTA
calls CoInitialize[Ex]/CoUninitialize.
regards,
George
|
|
|
|
|
Hello everyone,
Any tools I could use to monitor (x64 platform) the status of all threads inside a specific process?
For example, wait for a handle (convenient to analyze deadlock), sleep, running? Since my application deals with I/O heavily, it is good if the tool could monitor I/O thread's status -- e.g. sent request, waiting response or something?
thanks in advance,
George
|
|
|
|
|
if you really want to retrieve so much details about a process, i think there would be much more work you have to deal with. I know there are many ring0 level functions related to it, such as ZwQueryInformationProcess. You should master some tricks to use these functions. This function will be a clue to find other functions to cooperate with.
good luck
|
|
|
|
|
Thanks kcynic!
1.
"ring0 level" means?
2.
Are there any tools without writing buggy code from scratch?
I think my requirement is common and there should be some tools?
regards,
George
|
|
|
|
|
1. 'ring0 level' is kernel mode. Most of our program runs in user mode(ring3 level), and few codes run in kernel mode(ring0 level,such as driver). To know more details about them, u can google it.
2. I don't know if there is a tool what you refer to exsit or not.
I suggest you describe more details about your question and why you want to do, so that any others can help you.
|
|
|
|
|