GetDlgItem extension and pointer passing 
Author Message
 GetDlgItem extension and pointer passing

I want to outsource two major functions to general functions outside my
existing classes:

1.) GetDlgItem(....)->GetWindowText(.......);
should be callable as:

.... = XGetDlgItem(....);

and

2.) GetDlgItem(....)->SetWindowText(.......);
should beo callable as

XSetWindowText(.........);

For that I have to specify appropriate parameters especially an
additional hWnD paramter like:

CString XGetDlgItem(HWND hWnd, int inID);

and

XSetDlgItem(HWND hWnd,int inID, char *inText);

but how do I get the hWnd from inside the calling function (not the
called !).

CString tmp = XGetDlgItem(this, IDC_XXXX1);

doesn't work !

Any help is appreciated
Monica

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Thu, 18 Apr 2002 02:00:00 GMT  
 GetDlgItem extension and pointer passing

Quote:

> I want to outsource two major functions to general functions outside my
> existing classes:

> 1.) GetDlgItem(....)->GetWindowText(.......);
> should be callable as:

> .... = XGetDlgItem(....);

> and

> 2.) GetDlgItem(....)->SetWindowText(.......);
> should beo callable as

> XSetWindowText(.........);

> For that I have to specify appropriate parameters especially an
> additional hWnD paramter like:

> CString XGetDlgItem(HWND hWnd, int inID);

> and

> XSetDlgItem(HWND hWnd,int inID, char *inText);

> but how do I get the hWnd from inside the calling function (not the
> called !).

> CString tmp = XGetDlgItem(this, IDC_XXXX1);

> doesn't work !

> Any help is appreciated
> Monica

> Sent via Deja.com http://www.deja.com/
> Before you buy.

The 'this' pointer is not an HWND!  It is a pointer to a class derived from
CWnd.  You probably want to change the XGetDlgItem parameter to CWnd* pWnd.
Then the generic function can use pWnd->GetDlgItem, using the MFC version of
GetDlgItem instead of the Win32 version.

--
Scott McPhillips [VC++ MVP]



Thu, 18 Apr 2002 02:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. GetDlgItem extension and pointer passing

2. passing MFC (AFX?) pointers into managed extensions

3. GetDlgItem returned pointer requires delete?

4. Getting Permanent Pointer from "GetDlgItem(nID)"

5. Passing by Reference Or Passing by Pointer

6. passing a pointer to a pointer

7. Passing pointers to arrays of pointers....

8. Passing a Pointer to Pointer to an Interface

9. Passing LOGON_USER et al from one ISAPI extension to another - help needed

10. ISAPI Extension DLL: redirecting and passing form-data

11. How I can Get Pointer of CMyApp in mfc Extension Dll

12. Passing managed pointer to unmanged API

 

 
Powered by phpBB® Forum Software