Solved

Access main window class from External Function

Posted on 1998-11-13
2
191 Views
Last Modified: 2013-11-20
hi folks,

   Here is the question:

UINT ComputeThreadProc (LPVOID pParam) {

   // Codes of retrieving window Controls from Main Window

   return 0;
}

   Could anyone send me a sample codes of retrieving window controls (e.g. Edit, Listbox...etc) from the main window or dialog.

Many thanks.

stephen
0
Comment
Question by:stephenkong
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 50 total points
ID: 1324671
What I would do is:

1) As the pParam, send a pointer to a CWnd, or if necessary, a structure that contains a pointer to a CWnd.
2) This CWnd is a pointer to the main window or dialog.  In the thread function, you could then use the pointer to access all of the window's edit controls, list boxes, etc... using, for example, GetDlgItem (...);

Here is an example (like you requested):

// MainWindow contains a pointer to a CWnd
UINT ComputeThreadProc (LPVOID MainWindow)
{ CWnd *mainwnd = (CWnd *) MainWindow;

  // then you can do whatever you want with it, for example:
  mainwnd->GetDlgItem (IDC_EDIT_CONTROL1)->ShowWindow (SW_SHOW);

  return 0;
}

If you have any further questions, please feel free to ask.  Thanks!
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324672
Make sure you accept or reject answers at the questions you have asked so far.  It is important to not only ask questions, but also to follow through on them!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
Hibernate methods 2 77
countEvens challenge 2 111
bigDiff challenge 17 123
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 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