Link to home
Start Free TrialLog in
Avatar of jpbourne
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

ASKER CERTIFIED SOLUTION
Avatar of plaroche
plaroche

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of plaroche
plaroche

Pleas take not that GetSafeHwnd will return a valid handle only after OnCreate for the base class has been called.
Avatar of jpbourne

ASKER

I can only see the following OnCreate statement in the entire project:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   :
}

Is this the correct place to insert the GetSafeHwnd() statement?

And BTW, your help really is appreciated.
JPB.
I tried what you suggested in the CMainFrame::OnCreate and it worked!

Thanks for your help plaroche.
JPB