|
Good on you! That's a clever solution.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I was able to find the answer to this question at the end of this post:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3c4c722d-eecd-49ce-98f9-5948b656bd93/wsextoolwindow-doesnt-give-look-i-want-in-windows-8?forum=vcgeneral[^]
=========
I am creating a window with the WS_EX_TOOLWINDOW style on Windows 8, and the window ends up with the full-height title bar instead of the expected half-height title bar of a tool window.
Does Windows 8 not support this half-height title bar for tool windows, or am I doing something wrong?
Here is the window creation:
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, _TEXT("Class"), _TEXT("Caption"), WS_SYSMENU | WS_VISIBLE | WS_SIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
EDIT:
I just tested this in a Win 7 virtual machine, and I get the expected half-height title bar, so apparently this has something to do with Windows 8. Does anyone have any idea how to get the half-height title bar in Windows 8?
The difficult we do right away...
...the impossible takes slightly longer.
modified 3-Jan-14 9:37am.
|
|
|
|
|
I am working on a Windows program in C++ that downloads a variable number of files into a directory. Before I do the download, I want to delete all the files in the directory before downloading them. I do not want to write a separate script to do this. I want the C++ program to do it. What is the easiest way to do this?
Bob
|
|
|
|
|
|
BobInNJ wrote: What is the easiest way to do this? I suppose SHFileOperation() would be.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thanks for the responses. Based upon the responses I received I was able to write the code I wanted.
Bob
|
|
|
|
|
How can my CWnd object retrieve the mouse coordinates while processing the WM_MOVING message?
Is there a function like "GetMouse() "?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You probably need to capture the mouse and then use one of the tracking functions[^].
Veni, vidi, abiit domum
|
|
|
|
|
Ah, so that's how it's done. Thanks.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Does GetCursorPos() help?
|
|
|
|
|
Yes, that's very helpful. I'll remember that for next time.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
SandipG wrote: Does GetCursorPos() help?
I ended up using the function you suggested. Thanks again.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello. I can not seem to understand how to show 640 x 480 RGB data onto a dialog as a single picture. Following code uses SetPixel() to show it but looks like it makes and show two pictures of 320 x 240.
void CShowPicDlg::OnShowClick()
{
CDC* pDC = this->GetDC();
DWORD dwStartIndexRGB = 1, dwMiddleIndexRGB = 2, dwEndIndexRGB = 3;
for (int y = 0; y < 480; y++) {
for (int x = 0; x < 640; x++) {
POINT wndPoint;
wndPoint.x = x;
wndPoint.y = y;
BYTE r = m_pFrameData[dwStartIndexRGB];
BYTE g = m_pFrameData[dwMiddleIndexRGB];
BYTE b = m_pFrameData[dwEndIndexRGB];
pDC->SetPixel(wndPoint, RGB(r, g, b));
dwStartIndexRGB += 4;
dwMiddleIndexRGB = dwStartIndexRGB + 1;
dwEndIndexRGB = dwStartIndexRGB + 2;
if(dwStartIndexRGB >= m_nSize)
break;
}
}
}
So
1 - why is it showing two similar pictures of smaller frame size while the data itself is a single picture with frame size 640 x 480 ?
2 - how do I set alpha value for getting original colors?
Thanks for any pointer.
modified 1-Jan-14 23:34pm.
|
|
|
|
|
What is the value of m_nSize ?
if(dwStartIndexRGB >= m_nSize)
break;
Veni, vidi, abiit domum
|
|
|
|
|
It is size of the data. I am storing this data and its size using constructor. The size of the data is 614400 . As said earlier, frame size is 640 x 480 and video format is RGB32.
|
|
|
|
|
640 * 480 * 4 bytes/pixel = 1,228,800 bytes. A size of 614,400 indicates that you may have smaller images or less colors.
You should also consider to use one of the bit blitter functions to show the images. They are much faster than drawing them pixel by pixel.
|
|
|
|
|
I am using IMFSourceReader interface to get frames from my HD cam. After configuring this interface when I call IMFSourceReader::ReadSample() function, I am given IMFSample pointer. Now this IMFSample contains the video data and its size. And the size is 614400.
I must point out that using the same configurations, I am writing the same data in a .wmv file using IMFSinkWriter . So how is it possible that .wmv file has the frame size 640 x 480 and then the same data, when drawing pixel by pixel, gets smaller?
I am stuck in it for the last two weeks. Still not idea how to display a frame on dialog, this way.
|
|
|
|
|
You must find out how the pixels are organized when you get the frames. With videos, frames may be present as progessive or interlaced frames. I guess you have interlaced frames (each frame contains only half of the picture). Then you must combine two frames to a full picture (get first scan line from frame 1, second line from frame 2, third line from frame 1, and so on).
|
|
|
|
|
I have checked this too, and came to know that frames are progressive. Everything is sett by default and I am setting only two properties i.e. Stream Type (video) and it's sub type (RGB32).
|
|
|
|
|
How did you checked that? When writing the frames using IMFSinkWriter , the stream is recoded when the input format does not match the output format. But you are trying to show a frame from the input stream. So you must know the format of the input stream (which may be also recoded by IMFSourceReader ). And the frame size indicates that it is interlaced or 320 * 480.
|
|
|
|
|
Jochen Arndt wrote: How did you checked that?
Let me write a small pseudo code for this operation, though the code is very long.
HRESULT hResult = OpenMediaSource();
hResult = EnumerateStream();
hResult = ConfigureDecoder();
hResult = SetDeviceFormat();
hResult = ConfigureEncoder();
Now I am setting frame size on IMFSourceReader in ConfigureDecoder() . Then I get IMFMediaType of IMFSourceReader in ConfigureEncoder() and set it using IMFSinkWriter::SetInputMediaType() . I also use IMFMediaType->GetUINT32(MFVideoInterlaceMode, ...) within ConfigureEncoder (among other things), which returns MFVideoInterlace_Progressive.
In short, IMFSinkWriter has the same type as the IMFSourceReader . Here is how I capture the video and save it in a .bin file
IMFSample* pSample = NULL;
IMFMediaBuffer* pBuffer = NULL;
HRESULT hResult = pReader->ReadSample();
hResult = pReader->ReadSample();
while(nTotalSamples <= 360)
{
pSample->SetSampleTime(llTimeStamp);
pWriter->WriteSample(0, pSample);
pSample->GetBufferByIndex(0, &pBuffer);
pBuffer->GetCurrentLength(&dwLength);
pBuffer->Lock(&pData, NULL, &dwSize);
pBuffer->Unlock();
pReader->ReadSample();
nTotalSamples++;
}
Hopefully I was able to make it clear.
|
|
|
|
|
|
Yes. I get this kind of information in a separate function which gets called in ConfigureEncoder() . As I said, IMFMediaType is same for both encoder and the decoder.
Since I am a newbie with this, can you explain what does it mean when the size is 1228800 (640x480x4) and 614400.
However, after all the mess that I created , I must inform that I was able to run the program with expected results. You were right. 614400 size meant that the frame size was smaller (as said earlier, I don't know why). I tried frame size 320 x 480 (320x480x4) and it worked. Perhaps I will try to scale the picture for better viewing. I thank you, once again, for your constant support.
modified 1-Jan-14 23:40pm.
|
|
|
|
|
Hi,
My dialog is calling a child CFileDialog(). I killed app using Task Manager but common dialog still alive and appear as a separate process in Task Manager.
Please suggest ... how to close this?
|
|
|
|
|
We cannot tell what is happening unless you show the code where you start the orphan dialog.
Veni, vidi, abiit domum
|
|
|
|