|
I was going to mention this in my initial reply but decided to leave it out.
Glad that you figured it out.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi All,
I had a piece of code on COleDateTime.
COledateTime shiftStart;
if (shiftStart.invalid)
shiftStart += COleDateTimeSpan(1,0,0,0);
in this piece of code shiftStart is invalid when i do an arthimatic on this i am getting an assertion.
I want to convert the invalid datetime to valid datetime thru arthimatic.
in VC++6.0 there is no assertion as the COledateTime code in AFXOLE.INL dosent have assertion check.
in VC++ 9.0 ATLCOMTIME.INL have the assertion check for valid date.
how can i force the compile to use the old AFXOLE.INL or is there a way arround to fix it in the code?
Thanks Everyone.
|
|
|
|
|
pratap1980 wrote: how can i force the compile to use the old AFXOLE.INL
They're not adding the assertion in for fun - it's because what you're doing is (strictly) erronous.
You need to think about why your COleDateTime is invalid and fix it some other way.
It's always better to think beyond the immediate problem and find the root cause of your problem...
|
|
|
|
|
When handling this message, is it possible to get the text for the header that was clicked?
void CSomeFancyListCtrl::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
..
..
*pResult = 0;
}
Is there a GetItem() or GetItemText() using either pNMHDR or pNMListView that would work? Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
As stated here[^], iSubItem tells you which column was clicked, then you can use this[^] to obtain a pointer to the header control itself and use this[^] to get the information you need about the column.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for such an excellent response. It's perfect.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
I try to implement the FTP Command APPEND on a WinCe5.0 Device but get allways a access violation exception. Although the prgramm crashed the text was appended to the file on the server.
Thank you for your help.
hRootHandle = InternetOpen(TEXT("WinCeFtp"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
hFtpHandle = InternetConnect(hRootHandle, TEXT("server"), INTERNET_DEFAULT_FTP_PORT, TEXT("user"), TEXT("password"), INTERNET_SERVICE_FTP, 0, 0);
WCHAR szTemp[256];
wsprintf (szTemp, TEXT("APPE %s"), TEXT("DestFile.txt"));
int bRet = FtpCommand(hFtpHandle, TRUE, FTP_TRANSFER_TYPE_ASCII, szTemp, 0, &hResponse);
if (!bRet) {
wprintf(TEXT("FtpCommand failed, error: %i\n"), GetLastError());
return 1;
}
sprintf(buffer, "This data will be appended to the file");
DWORD dwLength = strlen(buffer);
if (!InternetWriteFile(hResponse, (LPVOID)buffer, dwLength, &dwWritten)) {
wprintf(TEXT("InternetWriteFile failed, error: %i\n"), GetLastError());
return 1;
}
InternetCloseHandle(hFtpHandle);
InternetCloseHandle(hRootHandle);
|
|
|
|
|
Where does it crash?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
It crashs in the InternetWriteFile function with a access violation exception.
|
|
|
|
|
You should set the second parameter to FALSE when don't excect answer from FTP server.
Or you need to call the InternetReadFile function before.
fExpectResponse
A Boolean value that indicates whether the application expects a data connection to be established by the FTP server. This must be set to TRUE if a data connection is expected, or FALSE otherwise.
|
|
|
|
|
Hai!
suppose
CString str = "This is our Book";
CString strSub = "my";
is there any function which can modify str with the value in strSub
like str.MODIFY(strSub, 9, 2);
then str must become "This is my Book"
|
|
|
|
|
Your productivity and efficiency will increase exponentially if you refer the documentation.
CString::Replace
|
|
|
|
|
Well, just think about the problem. You want to make a new string from a left section of the old string, some new string, and the right section of the old string.
That should be enough hints!
Iain.
|
|
|
|
|
Yeah perfect.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
See the suggestion here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I have a vector that contains POSITIONs. When I try to push_back or clear, the program crashes. The callstack shows _invalid_parameter_noinfo in one of the frames. I googled and found a solution(defining _HAS_ITERA.... and _SECURE_SCL to 0) , but was not effective. I'm using VS2008 with MFC feature pack installed on vista.
Please help.
Thanks
|
|
|
|
|
Can be due to a lot of reasons. Could you please provide relevant code snippet and call stack during crash?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
The call stack:
> Desktop.exe!_crt_debugger_hook(int _Reserved=0) Line 65 C
Desktop.exe!_invalid_parameter(const wchar_t * pszExpression=0x00000000, const wchar_t * pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int pReserved=0) Line 112 + 0x7 bytes C++
Desktop.exe!_invalid_parameter_noinfo() Line 125 + 0xc bytes C++
Desktop.exe!std::vector<crecord> >::insert(std::_Vector_const_iterator<crecord> > _Where=..., CRecord * const & _Val=0x01703200) Line 878 + 0x1e bytes C++
Desktop.exe!COutlineTextView::prepareSelBounds() Line 4816 C++
Desktop.exe!COutlineTextView::OnMouseMove(unsigned int nFlags=1, CPoint point={...}) Line 167 + 0x40 bytes C++
Desktop.exe!COutlineEditView::OnMouseMove(unsigned int nFlags=1, CPoint pointMove={...}) Line 2935 C++
Desktop.exe!CWnd::OnWndMsg(unsigned int message=512, unsigned int wParam=1, long lParam=3231936, long * pResult=0x007bfc9c) Line 2062 C++
Code snippet where it crashes:
declared as
std::vector<POSITION> m_selection;
in member function:
if (m_selection.size() > 0){
m_selection.clear();
}
.........
,.............
.......
POSITION pos = m_selStart.getItem();
while(pos != NULL && pos != m_selEnd.getItem())
{
m_selection.push_back(pos);
pos = getMan()->getNext(pos);
}
ASSERT(pos);
m_selection.push_back(m_selEnd.getItem());
|
|
|
|
|
Why are you mixing MFC collections with STL ones?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is it a serious issue(mixing MFC with STL)? please explain.
|
|
|
|
|
It's not FATAL - but the two mindsets of the framework designers are quite different.
So you're setting yourself up for confusion. Which is never good. I find it confusing enough just getting out of bed.
Iain.
modified on Friday, December 19, 2008 10:07 AM
|
|
|
|
|
Iain Clarke wrote: It's not FATAL - but the two mindsets of the framework designers are quite different.
Also the quality of the two mindsets is quite different (as usual this is going on my arrogant...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The problem is still not solved.
I have some classes that inherit from vectors.
I have a vector of POSITION(in afx.h)
struct __POSITION {};
typedef __POSITION* POSITION;
So when I try to push a POSITION value to the vector<position>
I get this crash saying invalid parameter.
In call stack I see its trying to push(insert) a value of different type (ref. classes that inherit from vectors) other than POSITION. How is this possible?
Please help!!!
|
|
|
|
|
Nope, if you're able to master both. Anyway, if you're able to master both then you don't mix them.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ThisIsMeRon wrote: Desktop.exe!_invalid_parameter_noinfo() Line 125 + 0xc bytes C++
Looks like a CRT invalid argument error. You can use _set_invalid_parameter_handler[^] to set a custom handler for whatever invalid argument is being passed. Note that not correctly handling the error could mask the real problem.
Best Wishes,
-David Delaune
|
|
|
|