|
AFAIK the window will only get messages when it is "visible" and non-minimized, which means you should show it on the desktop, at any location you like, including (-1000,-1000) to keep it out of sight.
|
|
|
|
|
Thanks, Luc. I tried specifying a location with the same lackluster results:
BOOL bCreated = this->CreateEx( 0, cstrWndClassName,
L"CMessageOnlyWindow", -1000, -1000, 100, 100, 0, HWND_MESSAGE, 0 );
|
|
|
|
|
I was thinking you had to actually show the window (hence the off-screen coordinates), howver my source code (which is C#) doesn't, and works well. I'm afraid I can't help you.
|
|
|
|
|
Hi again,
I happened to require detection of memory stick insertions (in C# again), and experimented a bit more. My conclusion is the app needs a window that is shown, non-minimized, possibly off-screen, and then overriding the wndProc yields the necessary events. So I chose "manual window position" with a bounding rectangle of (-32000,-32000,100,100) and it works well; it does not when minimized or not shown at all.
|
|
|
|
|
I've got that configuration Video capture -> Sample Grabber -> Null renderer to play video file.
I'd like to able to seek to any position in a video file to grab raw image data.
If the filter graph is stopped, then seek is performed to specific position and then run again sample grabber captures the correct image. But graph stop and run takes significant amount of time.
If the graph is already running the seeking does not position to correct location however. It is always the first frame or in some video file only after second seeking operation to the same location sample grabber returns correct frame.
m_pSeeking->SetPositions(&m_pPosition, AM_SEEKING_AbsolutePositioning, NULL, NULL);
Чесноков
|
|
|
|
|
And what about the method return value?
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]
|
|
|
|
|
There are no errors. All HRESULTS are OK.
Initially I wanted to seek to specific location in video file, then run the graph, wait for completion and get buffer.
Seeking function
<br />
m_pPosition = (1000000 * (LONGLONG)millisecond) / 100;<br />
hr = m_pSeeking->SetPositions(&m_pPosition, AM_SEEKING_AbsolutePositioning, &m_pStop, AM_SEEKING_AbsolutePositioning);<br />
if (FAILED(hr)) <br />
return -2;<br />
hr = m_pSeeking->GetCurrentPosition(&m_pPosition);<br />
if (FAILED(hr)) <br />
return -3;<br />
Grabbing function
<br />
hr = m_pMC->Run();<br />
if (FAILED(hr)) <br />
return -2; <br />
long evCode;<br />
hr = m_pEvent->WaitForCompletion(m_TimeOut, &evCode);<br />
if (FAILED(hr)) <br />
return -3;<br />
hr = m_pMC->Stop();<br />
if (FAILED(hr)) <br />
return -4;<br />
hr = m_pGrabber->GetCurrentBuffer((long *)&m_BmiHeader.biSizeImage, (long *)pFrameData);<br />
if (FAILED(hr))<br />
return -5;<br />
I used SetOneShot(TRUE); during sample grabber setup to make sure graph filter stops after single grabbing.
But that resulted in significantly slower grabbing due to filter graph run/stop operation.
I realized that it is possible to seek to any location while filter graph is already running as specified in documentation so I used SetOneShot(FALSE) and moved graph running and stopping from grabbing function.
But with SetOneShot false WaitForCompletion returns 0x80004004 if wait interval is specified or never returns with INFINITE wait period.
Is there fast seeking approach to grab raw image data with sample buffer?
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: But with SetOneShot false WaitForCompletion returns 0x80004004 if wait interval is specified or never returns with INFINITE wait period
And what is the evCode value?
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]
|
|
|
|
|
evCode = 0;
That is wierd. With SetOneShot set to TRUE filter graph does not stop as it should after sample grabber frame capture.
With SetOneShot set to FALSE WaitForCompletion never returns.
Чесноков
|
|
|
|
|
Any pointer to some good example on how to use the CTreeCtrl ?
|
|
|
|
|
|
bad answer... I've already done that and could not find just a full example of the
basic CTreeCtrl, otherwise I wouldn't ask it here, would I ?
|
|
|
|
|
The answer is actually correct.
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]
|
|
|
|
|
With smart-aleck replies like this, you'll be lucky to receive any further help in the future.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
point taken... but I did already my bit in searching the articles first...
neededless to say, giving an answer in search form is a bit pointless as it was my first try to already search the articles... hence what I'm looking for is somewhat different:
a pointer to a short/full application that does use the CTreeCtrl that is not listed in the search
results...
otherwise I'll just feel somebody thinks me to be so stupid to don't search before asking !!!
|
|
|
|
|
federico.strati wrote: otherwise I'll just feel somebody thinks me to be so stupid to don't search before asking !!!
How can we tell, in advance, how stupid are you?
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]
|
|
|
|
|
you have just to assume what you would do in the first place, like an "I wouldn't do that,
wouldn't I?" ...
Oh well, I just know I'll end up as always writing my own little app exploring all available options of the CTreeCtrl just for fun in learning...
grazie comunque 
|
|
|
|
|
federico.strati wrote: Oh well, I just know I'll end up as always writing my own little app exploring all available options of the CTreeCtrl just for fun in learning...
That's what I would do. Populating it with files from your computer would be a great exercise.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
federico.strati wrote: you have just to assume what you would do in the first place, like an "I wouldn't do that,
wouldn't I?" ...
As David, pointed out, I assume what would do the average poster of this forum (unless I know him very well).
federico.strati wrote: Oh well, I just know I'll end up as always writing my own little app exploring all available options of the CTreeCtrl just for fun in learning...
By chance you've just found yourself the best route.
Si figuri...
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]
|
|
|
|
|
|
federico.strati wrote: but I did already my bit in searching the articles first...
How were we to know?
federico.strati wrote: neededless to say, giving an answer in search form is a bit pointless
Unless you consider that most folks that visit the C++ forums have NOT done an initial search. They would rather spend more time creating a CP profile and typing in an incoherent question than they would by just Googling. Lazy does not begin to describe some of the ones here. Given that your profile indicates you are indeed an educated person, you probably should have prefaced your post with what you had already tried. That would help to set you apart from the others.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I cannot find a way to force an OpenFileDialog under Windows 7, Visual Studio 2010 C++ to always open the a folder of my choosing. The documentation for OPENFILENAME structure states for Windows 7 "If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory."
I cannot find a way to override this - I have a set directory I always want to open to no matter what.
Of course I am always setting lpstrInitialDir to that folder. That works the first time, but as it says above, next time it opens to the last folder the user selected.
I saw a few C#, .NET flags in other posts to change this, but nothing I can find for MFC/C++.
Any ideas appreciated! TIA
|
|
|
|
|
Does it behave the same way also if you set lpstrInitialDir to NULL and pass the path in lpstrFile?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
lpstrInitialDir is not supported starting from Vista.
As Code-o-mat said, you can copy the folder to be initially shown in lpstrFile .
An important point to note is that the path must have a trailing back slash.
|
|
|
|
|
Thanks, but what I have discovered is that if the Vista flag for the CFileDialog is set false, then the dialog will fail (not display and immediately return IDCANCEL) with a "bad filename" in the CommDlgExtendedError. It does not like just a directory in the lpstrFile if the Vista flag is false.
So unless there's another idea floating about, I am stuck! I have to use the old style dialog for now.
UPDATE(s): To help anyone who struggles with this:
I was not able (at first) to use the new style dialogs (vista=true) because OnInitDialog and OnInitDone are NOT supported anymore for CFileDialog. Our code did depend on this. But I found a post that suggested using OnFolderChange() instead. My tests indicate that it indeed is called before the user gets control (which was the reason for the OnInit stuff). So you might give that a try.
UPDATE2: The Superman's response is true, but I now know what the problem is: you have to have *.* or some more specific find option if you wish to set vista flag false and use lpstrFile. So, if I set the vista flag false, and use a string like "C:\\temp\\*.*" as lpstrFile, then the initial directory (C:\temp)is picked out of the full path.
Note that using the vista flag is cool as you get a preview, but in our case we have to do our own previews using a dialog template, which also is not supported after vista. So now, by using vista false, i get the OnInits, initial directory, and templates which means I can get my project done
Thanks for the help.
modified on Friday, November 5, 2010 3:55 PM
|
|
|
|