|
|
Hi CPallini,
Thank you very much. You help me greatly.
|
|
|
|
|
Not this problem, I made a test that has a temporary class. CMyClass. When pop_front() the desconstructor function of class CMyClass will not be called.
|
|
|
|
|
Hello,
I need to add a string on top / on bottom of a few drown GDI objects on printing. So far i override the OnPrint function.The problem i am facing is to decide where the text should be added in the CDC (i cant find the coordinates needed for TextOut)
I tried with CDC::GetBoundsRect(&dcRect, 0); but in dcRect i get nothing but zeros and the function returns 1. I think its returning DCB_RESET but i am not sure.
I tried with GetCurrentBitmap and GetBitmapDimension but still i get CSize variable with nothing but zeros.
All help is welcome 
|
|
|
|
|
The best thing i found is in the Microsoft Superpad example on the next link
Superpad
You can see how to put Header / Footer in it.
|
|
|
|
|
Using API In MFC OnDraw
TextOut(pDC->GetSafeHdc(),1, 20, "HELLO HELLO", 11);
I am not sure if that will print alligned properly.
|
|
|
|
|
My problem is finding the right coordinates for the TextOut function but after a talk with my Team manager we decided its better to be done as a header / footer.
Before that i just wanted to get the BoundRectangle with the hopes that it will be describing only the part in the page where the elements will be drown not the whole page itself.
I was wondering if there is a way to get out of the CDC member information about the position of the elements or something like that but i couldn't find any.
|
|
|
|
|
I want to use the function DhcpRequestParams() to get some information from the DHCP Server,but failes.
Any can help me?
Examples are best.
|
|
|
|
|
|
<pre lang="text">Found this very useful piece of code to get bitmap info from handle and would like to know HOW it works.
I think if I get how the LPBITAMPINFO gets filled I probably will also understand why using global handle is necessary. Or maybe not.</pre>
// a DIB is in the clipboard, draw it out
GLOBALHANDLE hGMem ;
LPBITMAPINFO lpBI ;
void* pDIBBits;
OpenClipboard() ;
hGMem = GetClipboardData(CF_DIB) ;
ASSERT(hGMem);
TRACE("\nfills LPBITMAPINFO");
lpBI = (LPBITMAPINFO)GlobalLock(hGMem) ;
Appreciate any help.
CHeers Vaclav
-- modified 15-Jan-13 15:54pm.
|
|
|
|
|
GLOBALHANDLE hGMem ; LPBITMAPINFO lpBI ; void* pDIBBits;
OpenClipboard() ; hGMem = GetClipboardData(CF_DIB) ; ASSERT(hGMem); TRACE("\nfills LPBITMAPINFO");
lpBI = (LPBITMAPINFO)GlobalLock(hGMem) ;
At this point you can copy the memory block pointed to by lpBI into your program's address space and process it as required. You should then unlock and release hGMem (which is a system resource), and release the clipboard so other applications can use it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard,
thanks for adding the comments.
I am still unclear how you get from HANDLE (pointer) - returned by GetClipboardData to BITMAPINFO (pointer).
I guess I still do not get the casting.
This may be to stupid , but why this would not work?
lpBI = (LPBITMAPINFO) GetCLipboardData(CF_DIB)
Maybe the key is really in usage of GLOBALHANDLE.
|
|
|
|
|
Vaclav_Sal wrote: Maybe the key is really in usage of GLOBALHANDLE. Exactly so. The GetCLipboardData() function returns a global handle, and you then need to use the GlobalLock() function to get a pointer to addressable memory. Remember that HANDLE s are 'opaque' types which you cannot use directly, even though they may at times point to some real memory. This is because they are owned by the Windows system and their contents at any one time is not guaranteed to be useful in user space.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
When I use ATL in MFC Application(Don't ask me why, just because I like), sometimes I got the error code: E_FAIL. However, it's almost useless for me to locate the specific reason.
I have googled so many times, but found nothing related. I thought there should be something like try{} catch{} in ATL.
Here's some sample code:
CAxWindow m_wndView; CComPtr<IWMPPlayer> m_spWMPPlayer;
AtlAxWinInit();
CComPtr<IAxWinHostWindow> spHost;
HRESULT hr;
CRect rcClient;
GetClientRect(&rcClient);
m_wndView.Create(m_hWnd, rcClient, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
|
|
|
|
|
Use the _com_error class.
Construct an object of this class by passing in the HRESULT value and then use its WCode or ErrorMessage methods to get the error code mapped to the HRESULT value.
|
|
|
|
|
Thank you for your reply.
I have did as what you said, but I only get the error message:
Unspecified error.
Here is my code:
_com_error err(hr);
auto d = err.WCode();
auto s = err.Description();
auto msg = err.ErrorMessage();
|
|
|
|
|
'Unspecified error' is the english error message for E_FAIL . There is no more information available.
|
|
|
|
|
You can try with GetLastError and see if you can get better description of the error . The number returned from the function you can check in msdn.
Good luck 
|
|
|
|
|
Hi,
I have developed an application which captures video stream using DirectShow. While capturing, video is displayed on the canvas area. This works fine for the first time. But when again clicking on Start capturing button, video is getting captured, it doesn't display in the canvas area. Don;t know whether actually the camera is capturing the video or not.
Anybody have any idea regarding this.?
Any help will be appreciated.!
Regards,
mbatra
|
|
|
|
|
You can debug to check if the code flow path is different from the first one in the second case.
If this doesn't help consider reinitialization of variables you are using before you display the video on the canvas.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
Can you post some of your code?
I am using VFW API and OpenCV and debugging real time video can be a challenge.
What works for me is using temporary displays in step thru debug mode.
|
|
|
|
|
How to convert _uint64 into two _uint32 values and vice versa.
Regards,
Vishal
|
|
|
|
|
By shifting the high part and casting:
_uint64 ui64 = 1234;
_uint32 lo = (_uint32)ui64;
_uint32 hi = (_uint32)(ui64 >> 32);
ui64 = (_uint64)lo | ((_uint64)hi) << 32;
[EDIT:] Added code formatting.
|
|
|
|
|
does it take endianness into consideration, (Little/Big Endian)
Regards,
Vishal
|
|
|
|
|
Yes, because the endianess does not care for the used logical operations.
If you think of multiplication / division instead of the shift operations and of addition instead of the OR operation it should be clear. The operation values are just high or low parts where the internally used bit or byte order does not care. Casting is similar (extending with high zeroes upon up-casting and masking out the lower bits upon down-casting).
|
|
|
|