|
Why it doesnt work did you get any error?
|
|
|
|
|
thanks for your response.it worked after sometime.but now the problem is the first vlc plyer in the main dialog displays nothing after returning from the second.the second dialog too is programmed to play the video.i have a stop button in the second dialog .in that i have written code to stop the display in the second dialog.
|
|
|
|
|
Hi all,
If from a CString variable we want to get 3 characters from right we can use Right(3) api but for getting 3 characters from right in a TCHAR variable what function we should use.....
Can anybody help me in this....
Thanks in advance
|
|
|
|
|
CString cs = _T("Some string");
TCHAR tcBuf[4] = {0};
_tcsncpy( tcBuf, (LPCTSTR)cs.Right(3), 3 );
modified on Wednesday, June 11, 2008 6:10 AM
|
|
|
|
|
TCHAR * szSource = _T("Hello world!");
TCHAR szTarget[4];
size_t len = _tcslen(szSource);
_tcscpy(szTarget, &szSource[len-3]);
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
|
|
|
|
|
FYI, VS does come with the source for MFC. Try looking in the CString source to see what CString::Right does.
Judy
|
|
|
|
|
Sometime I am getting the error message saying:
"Unhandled exception at 0x00000000 in MyApplication.exe: 0xC0000005: Access violation reading location 0x00000000." but it is not pointing to the source code line caused this violation.
If I break, callstack is pointing "00000000()".
In this case is there any setting in VC++ to detect the line which caused exception.
Otherwise I will debug manually to find out the place..
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
If you start your debugger, it should bring you to the problem (or to assembly code if no source can be found). From there, use the call stack to come back into your own code.
|
|
|
|
|
Hi Cedric Moonen,
Thanks for your help!!
Sorry I modified the question, I am using debugger but callstack not showing source line.
Disassembly is showing address 00000000 and there are only question marks "????".
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
How does your call stack look like. It seems that you are confusing call stack with something else... The call stack shows all the functions that have been called to reach the current point in the code. By walking the callstack, you can 'travel' back to where the problem is coming from.
For VC2005: "Debug" menu -> "Windows" -> "Call stack" (or Alt + 7) will display the call stack window if you are in debug mode and on a breakpoint.
|
|
|
|
|
I used to look at callstack to trace the error always, but some cases like this, callstack is not showing any function but the arrow pointing to "00000000()" in callstack.
I think it means something out of callstack scope, or we have change some setting to break and show this exception in callstack
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
The error is making your call stack unreadable, so you need a different method to find the error. Use breakpoints to find the last statement executed before the error occurs. I'm predicting you're trying to use a NULL pointer.
|
|
|
|
|
In the Debug Menu
Exceptions
do modification to some setting over there...
|
|
|
|
|
I am using WM_PRINT to print the control. But it is copying the content of the control not the screen shot of the control. I tried to use PrintWindow. But as i am working on VC6.0, not able to use.
Any help is appreciated.
|
|
|
|
|
subramanyeswari wrote: But it is copying the content of the control not the screen shot of the control.
Sorry, I coudn't understand the diifference...What do you mean by "content of the contol" and "screen shot of the control".
subramanyeswari wrote: I tried to use PrintWindow. But as i am working on VC6.0, not able to use.
In VC6 also you can use this function. For this either you have to import this function dynamically or you should install latest platform SDK( it is free ).
|
|
|
|
|
I have a grid in the control. It is capturing the data in the grid but it is not capturing the grid. I mean the grid is not displayed.
Regards
|
|
|
|
|
So how did you draw your grid and data( data means text, right? ). In OnPaint() ?
|
|
|
|
|
my main(CAlarmObject) class is derived from CObject. i have a class (CWiZListCTRL)and that is derived from CListCtrl. and drawing is taken place in the OnPaint of CWiZListCTRL. and i am calling that in my main(CAlarmObject) draw method
Regards
|
|
|
|
|
subramanyeswari wrote: and i am calling that in my main(CAlarmObject) draw method
can you paste the code of OnPaint() here. Also you should never call the onpain() function directly.
|
|
|
|
|
No ..i am not calling onpaint. i am calling updatewindow, which is issuing OnPaint() command.
modified on Friday, June 27, 2008 3:05 AM
|
|
|
|
|
Is CMemDC your class? In the baove code, I coudnt find the you bitblt the content of memorydc back to the paint dc. Is it performed in the destructor of the CMemDC?.
Also why are you using a Memeory dc here? Is there any problem is you directly use the CPaintDC object?
|
|
|
|
|
Yes you are right CMemDC is our class. Here BitBlt fails because it is not one of active screen. Actual draw method is this
CWnd InTouch;
InTouch.Attach(m_hWndParent);
m_Parent.AttachExternalObject(this);
DWORD dwStyle = WS_CHILD |WS_VISIBLE;
VERIFY(m_Parent.Create(NULL, "Invisible", dwStyle, DrawRect, &InTouch, 0));
SetDrawMode (DRAWMODE_DESIGNTIME);
Draw(&InTouch, DrawRect);
where m_Parent is a member of one of our class CInvisibleParent. before calling the actual drawing of the user control we are creating m_Parent by attaching InTouch. So BitBlt is failing.
|
|
|
|
|
but what is the relation between this code and onpaint() function? The bitblat need be done to the CPaintDC object( the object your apssing to the CMemDC constructor ).
|
|
|
|
|
Naveen,
I tried BitBlt in the onpaint. What it returns is a blank page. here is my code.
HDC hdc = ::GetDC(this->m_hWnd);
HDC memDC = ::CreateCompatibleDC(hdc);
int w = rectTemp.right-rectTemp.left;
int h = rectTemp.bottom-rectTemp.top;
HBITMAP bitmap = ::CreateCompatibleBitmap(hdc,w,h);
::SelectObject(memDC,bitmap);
BOOL bRet = ::BitBlt(memDC, 0, 0, w, h , hdc, rectTemp.left, rectTemp.top , SRCCOPY );
Regards
|
|
|
|
|
no no whet i mean is to the following line in the end of the OnPaint() function.
dc.BitBlt( 0, 0, rect.Width(), rect.Height() , hdc, 0, 0 , SRCCOPY );
|
|
|
|