Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Direct assignment works in most cases( I have personally tried and succeeded in doing so in VC6 and Visual Studio 8)that is:

CString s="hello";
LPCTSTR p = s;
Posted
Updated 13-Apr-10 2:15am
v5

By deleting your OP it is not easy to find the problem, your code for the question was
kartikdasani wrote:
C++
CString p;
m_editbox->GetWindowText(p);
CWND *c = FindWindow(NULL,p);

Also the title is no lucky choice, because I think the problem is not the conversion from CString to LPCTSTR.

The call to FindWindow() is correct, when it is inside a CWnd derived class. But you should look at the description of CWnd::FindWindow() it will only find top-level windows, not child windows.

As <removed class="Error">CPallini already posted, give us more details.
 
Share this answer
 
As it stands your code doesn't even compile (FindWindow returns a HWND).
Please post your actual code, and state clearly what do you get (and what you expect).

BTW: please modify your original post instead of adding fake answers.
:)
 
Share this answer
 
I suggest you read this excellent article[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900