|
The MFC8 wizard offers Multiple Top-Level Documents, but from what I've seen from the generated code there is nothing new since MFC6.
MFC does not keep track of the open main frames, there is still just a single m_pMainWnd member in CWinApp.
Has anything changed with the threads or command routing?
Thanks
Andre
|
|
|
|
|
Hi, how do I get the z-order of another application? I have the HWND for the window but don't know how to proceed from there.
Thanks in advance.
|
|
|
|
|
I don't think there is a GetWindowZOrder function (that would be nice), but you might be able to use EnumChildWindows to determine it.
You might be able to salvage some of this hacked together code:
BOOL CALLBACK EnumZOrderProc(HWND hwnd, LPARAM lParam);<br />
<br />
class CZOrder<br />
{<br />
public:<br />
int m_zorder;<br />
HWND m_hwndFind;<br />
<br />
CZOrder() : m_zorder(0), m_hwndFind(NULL) <br />
{ }<br />
<br />
int GetWindowZOrder(HWND hwnd)<br />
{<br />
m_hwndFind = hwnd;<br />
m_zorder = -1;<br />
::EnumChildWindows(::GetDesktopWindow(), EnumZOrderProc, (LPARAM)this);<br />
return m_zorder;<br />
}<br />
<br />
};<br />
<br />
BOOL CALLBACK EnumZOrderProc(HWND hwnd, LPARAM lParam)<br />
{<br />
WINDOWPLACEMENT wp;<br />
wp.length = sizeof(WINDOWPLACEMENT);<br />
::GetWindowPlacement(hwnd, &wp);<br />
<br />
if (wp.showCmd != SW_SHOWMINIMIZED
&& ::IsWindowVisible(hwnd)
&& ::GetParent(hwnd) == NULL)
{<br />
CZOrder* pZorder = reinterpret_cast<CZOrder*>(lParam);<br />
pZorder->m_zorder++;
<br />
if (hwnd == pZorder->m_hwndFind)<br />
return FALSE;
}<br />
return TRUE;
}<br />
<br />
CZOrder zo;<br />
int windowZOrder = zo.GetWindowZOrder(hwnd);<br />
<br />
Good thing it's Friday!
- S
50 cups of coffee and you know it's on!
-- modified at 18:17 Friday 28th April, 2006
|
|
|
|
|
Hi,
I've a process handle. I would need the primary thread handle from that process because I need to send it some windows messages and I don't want to create any windows (nor invisible nor message only windows); I would like to use PostThreadMessage and I know that the primary thread will be pumping the message queue.
Thanks in advance,
Federico
|
|
|
|
|
Hope I understood your question
you need to primary thread from a proccess you find your answer in exmpale MSDN but im sorry i dont know filename.
|
|
|
|
|
I am not sure if it is the right place to post my problem. If it is not, just delete this message. Here comes my problem using graphedit.
I am developing a source filter following the example ball from directshow. There is no error to build the filter, and register it, but as I load it into graphedit to test it, error message comes up, and all applications are closed. The message is
DirectShow SDK Filter Graph Editor has encountered a problem and needs to close. We are sorry for the inconvenience.
Thanks for any information
|
|
|
|
|
Just to clarify. This is happening to you with the Ball sample filter with no modifications?
|
|
|
|
|
Sorry for not state my question clearly. Actually, I built a source filter based on ball source filter. In the filter I added Ifilesourcefilter to load mp4 file, and added a aacdecoder class to decode mp4 files. The decoder is based on c source code. Thank you.
|
|
|
|
|
If GraphEdit is crashing (look at the details of the crash and see if it is crashing in your filter) when you just add the filter to the filter graph then I would guess that something is happening in your constructors to cause it to crash. Make a debug build of the filter and debug it (set GraphEdit as the action command). If you still can't locate the crash set breakpoints or comment out code. You don't even see GraphEdit popping up the choose a file dialog I suppose.
-- modified at 23:55 Friday 28th April, 2006
|
|
|
|
|
Thanks for your reply. I registered the filter successfully, and I can see that filter in graphedit when I try to insert that filter. The error comes up as I insert the filter. When I did that, a window popped up to ask me to load a file, but as I chose one mp4 file, graphedit crashed. Thank you.
|
|
|
|
|
Then GraphEdit isn't crashing when you insert your filter. It is crashing in your implementation of the IFileSourceFilter::Load() method. Did you try running the debugger?
|
|
|
|
|
Thank you so much for your reply. I did not run debug, I am not familiar with it. I followed the instruction to debug, but did not success. Could you please tell me how to do that? Thanks again.
|
|
|
|
|
1. Set a breakpoint at some function of interest
2. Compile a debug build of your filter
3. Make sure that this debug filter is registered and not your release build (regsvr32). You can setup a custom build step to ensure this is done.
4. Press F5
5. You should see a dialog that pops up asking for the executable to be used for the debugging session. Select GraphEdit. (If you do not see the dialog you need to modify your project configuration properties under Debugging)
6. Insert your filter and do what you want. When it hits a breakpoint you'll see it.
|
|
|
|
|
Thanks for your detailed the instruction about filter debugging. I followed those instructions step by step, but as the program ran to the breakpoint, error message popped up said Could not get debugging iformation about graphedit.... then the computer crashed. I tried other filters provided by DX sdk, the same things happened. I do not know if there is something wrong with my computer. Thanks again.
|
|
|
|
|
We've got two classes that we use to resize standard CDialog-based classes and to show a resize handle in the lower right-hand corner of the dialog. These work fine when the class is derived from CDialog. However, if the class is derived from CAxDialogImpl we have problems instantiating the class that shows the resize handle.
The class used to show the resize handle is called CEasyStatusBar and is derived from CStatusBarCtrl. The class has a Create() method which is the first method that classes that use the CEasyStatusBar class must invoke. The Create() takes a CWnd pointer which is normally passed as the this pointer from CDialog based classes. However in the CAxDialogImpl class we are using CWnd::FromHandle(m_hWnd) to get the CWnd pointer to pass in to the Create() method. The Create() method does a few things and then invokes the CStatusBarCtrl::Create() method as follows:
BOOL IsVisible = parent->IsWindowVisible(); // parent is the CWnd pointer
DWORD ProgressBarStyle = WS_CHILD | CCS_BOTTOM | SBARS_SIZEGRIP | SBT_OWNERDRAW;
CStatusBarCtrl::Create(ProgressBarStyle, CRect(0, 0, 0, 0), parent, 1);
When it gets into the CStatusBarCtrl::Create() method an assertion failure is being generated. I debugged into this to find out where and it is performing the following:
The CStatusBarCtrl::Create() method is invoking VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_BAR_REG)). This is invoking AfxEndDeferRegisterClass() which is doing the following:
// mask off all classes that are already registered
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
fToRegister &= ~pModuleState->m_fRegisteredClasses;
if (fToRegister == 0)
return TRUE;
LONG fRegisteredClasses = 0;
// common initialization
WNDCLASS wndcls;
memset(&wndcls, 0, sizeof(WNDCLASS)); // start with NULL defaults
Wndcls.lpfnWndProc = DefWindowProc;
Wndcls.hInstance = AfxGetInstanceHandle();
The first thing the AFxGetInstanceHandle() method does is do an ASSERT(afxCurrentInstanceHandle != NULL) which is failing and causing the assertion fault. I debugged into this with one of our other classes based on CDialog and in that one, fToRegister was set to 0 so it was never getting to the AfxGetInstanceHandle() method.
Does anyone have any clues as to what could be causing our CAxDialogImpl-based class to get the above assertion failure?
-- modified at 18:46 Saturday 29th April, 2006
|
|
|
|
|
Hi,
I am designing a simple dialog application in VS.net. In the dialog class that is created, I call a class of my own, that is not derived from any MFC class. My class needs access to an Edit control in the main dialog. It looks as if my class needs a handle to the parent class, hlg, in this case the dialog window.
QUESTION:
How do I find the parent, main dialog, parent window??
I have been trying to find it while setting breakpoints in the debugger.
Thanks.
Jerry
|
|
|
|
|
jerry1211a wrote: My class needs access to an Edit control in the main dialog.
This is not advisable. What is it exactly that you are trying to do?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
for access to main dialog you can use GetParent but you said "that is not derived from any MFC class"
|
|
|
|
|
In your own class create a member to your edit control (like CEdit* m_pEdit).
Then create a function to set the member (like SetEdit(CEdit* pEdit) { m_pEdit = pEdit; } ).
Then in your own class, use m_pEdit->SetWindowText(...) or GetWindowText(...).
Does that work?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
hello
i have a VC++ 6.0 application .here i want to convert a Cstring variable(a filepath) to WORD(unsigned short)
how can i do that?
plz guide me
joy
joy
|
|
|
|
|
Why do you need to do that? A WORD representaton of a CString does not make sense.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
You can use atoi (or strtoul always forget about that too :->) to convert the string to an integer, then cast it, but it doesn't make sense to convert a filepath to a number (unless the path is a number, I guess).
- S
50 cups of coffee and you know it's on!
-- modified at 18:34 Friday 28th April, 2006
|
|
|
|
|
I'm curious whether it is possible to compile your apps for Win 3.x with VC6-8. My first idea would be to remove the WIN32 from the preprocessor definitions, but that would be too easy.
|
|
|
|
|
No, I think you would need one of:
- Visual C++ 1.52
- Borland C++ 5.02 (not Borland C++Builder)
- Open Watcom
Those are the only compilers I know of off-hand that can make 16-bit Windows apps.
|
|
|
|
|
maybe he doesn't need to keep the 16bits compatibility; only rebuild the application with a modern compiler.
I can't help since I never coded win 3. applications.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|