?
Solved

Urgent help needed - handle to application window

Posted on 1998-11-30
4
Medium Priority
?
228 Views
Last Modified: 2013-11-20
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

0
Comment
Question by:jpbourne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 200 total points
ID: 1325520
This all depends on what window will handle the driver's notifications.

From any CWnd derived class you get the handle to it with:

GetSafeHwnd();
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1325521
Pleas take not that GetSafeHwnd will return a valid handle only after OnCreate for the base class has been called.
0
 

Author Comment

by:jpbourne
ID: 1325522
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.
0
 

Author Comment

by:jpbourne
ID: 1325523
I tried what you suggested in the CMainFrame::OnCreate and it worked!

Thanks for your help plaroche.
JPB
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question