jpbourne
asked on
Urgent help needed - handle to application window
Hi,
HELP!! I am new to MFC programming and I'm really struggling with what seems like a really simple problem.
Ok, I have created an application using AppWizard. I have now started adding functionality to the application (the app will control a TWAIN complient scanner, and perform some image processing techniques). The code that is supplied with the TWAIN SDK uses the handle to window value (hwnd). The problem I have is obtaining this value when using MFC. I have tried everything I can think of, and desperately need some help.
I have tried: CWnd m_hWnd - no luck. I can't get FindWindow to work either.
Any help would be greatly appreciated.
Thanks,
J.P.Bourne
HELP!! I am new to MFC programming and I'm really struggling with what seems like a really simple problem.
Ok, I have created an application using AppWizard. I have now started adding functionality to the application (the app will control a TWAIN complient scanner, and perform some image processing techniques). The code that is supplied with the TWAIN SDK uses the handle to window value (hwnd). The problem I have is obtaining this value when using MFC. I have tried everything I can think of, and desperately need some help.
I have tried: CWnd m_hWnd - no luck. I can't get FindWindow to work either.
Any help would be greatly appreciated.
Thanks,
J.P.Bourne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Pleas take not that GetSafeHwnd will return a valid handle only after OnCreate for the base class has been called.
ASKER
I can only see the following OnCreate statement in the entire project:
int CMainFrame::OnCreate(LPCRE ATESTRUCT lpCreateStruct)
{
:
}
Is this the correct place to insert the GetSafeHwnd() statement?
And BTW, your help really is appreciated.
JPB.
int CMainFrame::OnCreate(LPCRE
{
:
}
Is this the correct place to insert the GetSafeHwnd() statement?
And BTW, your help really is appreciated.
JPB.
ASKER
I tried what you suggested in the CMainFrame::OnCreate and it worked!
Thanks for your help plaroche.
JPB
Thanks for your help plaroche.
JPB