Click here to Skip to main content
15,917,061 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateDialogIndirect ToolWindow problem ? Pin
Christian Graus2-Sep-01 19:53
protectorChristian Graus2-Sep-01 19:53 
GeneralText Area In Win32 Pin
2-Sep-01 18:36
suss2-Sep-01 18:36 
GeneralRe: Text Area In Win32 Pin
Christian Graus2-Sep-01 18:43
protectorChristian Graus2-Sep-01 18:43 
GeneralCListCtrl - 2 Pin
Shankar Chandra Bose2-Sep-01 14:45
Shankar Chandra Bose2-Sep-01 14:45 
GeneralRe: CListCtrl - 2 Pin
Ben Burnett2-Sep-01 19:24
Ben Burnett2-Sep-01 19:24 
GeneralPost Message. Pin
John Uhlenbrock2-Sep-01 14:06
John Uhlenbrock2-Sep-01 14:06 
GeneralRe: Post Message. Pin
Michael Dunn2-Sep-01 15:08
sitebuilderMichael Dunn2-Sep-01 15:08 
GeneralRe: Post Message. Pin
Matt Gullett2-Sep-01 16:00
Matt Gullett2-Sep-01 16:00 
Assuming the target window is in the same process, you can send a CString via PostMessage like this:

void SendTextToWindow(HWND hwndTarget, UINT uiMessage, LPCSTR lpszText);
{
     CString* pText = new CString;
     (*pText) = lpszText;

     ::PostMessage(hwndTarget, uiMessage, (WPARAM)pText, 0);
}


Then, in the message handler for uiMessage,

LRESULT OnSomeMessage(WPARAM wParam, LPARAM lParam)
{
     CString* pText = (CString*)wParam;
     ASSERT(pText);

     // do something with pText

     delete pText;

     return 0;
}


I have used this, but I do not recommend it because there is a potential that the message could not make it to the target window and thus the CString never be destroyed. Also, this only works if the target window is in the same process. Ultimately, if you really need to do this often, I would recommend creating a manager class (something line CStringMessageManager), and have it be responspilble for deleting CString objects created and passed via PostMessage.
GeneralRe: Post Message. Pin
Matt Gullett2-Sep-01 17:58
Matt Gullett2-Sep-01 17:58 
GeneralSimple DLL, Simple DLL, Simple DLL , P L E A S E !!! Pin
2-Sep-01 9:05
suss2-Sep-01 9:05 
GeneralRe: Simple DLL, Simple DLL, Simple DLL , P L E A S E !!! Pin
Mukkie2-Sep-01 10:44
Mukkie2-Sep-01 10:44 
GeneralThank you ! Pin
3-Sep-01 0:15
suss3-Sep-01 0:15 
GeneralRe: Thank you ! Pin
Mukkie3-Sep-01 12:35
Mukkie3-Sep-01 12:35 
GeneralRe: Thank you ! Pin
3-Sep-01 21:52
suss3-Sep-01 21:52 
GeneralRe: Simple DLL, Simple DLL, Simple DLL , P L E A S E !!! Pin
Jim A. Johnson2-Sep-01 13:21
Jim A. Johnson2-Sep-01 13:21 
Generalabout COleServerItem Pin
Maer7272-Sep-01 5:31
Maer7272-Sep-01 5:31 
Generalabout COleClientItem Pin
Maer7272-Sep-01 5:29
Maer7272-Sep-01 5:29 
GeneralBefore The System Pin
The_Server2-Sep-01 2:32
The_Server2-Sep-01 2:32 
GeneralRe: Before The System Pin
Anders Molin2-Sep-01 2:48
professionalAnders Molin2-Sep-01 2:48 
GeneralRe: Before The System Pin
The_Server2-Sep-01 10:50
The_Server2-Sep-01 10:50 
GeneralRe: Before The System Pin
2-Sep-01 3:10
suss2-Sep-01 3:10 
GeneralRe: Before The System Pin
The_Server2-Sep-01 10:52
The_Server2-Sep-01 10:52 
GeneralRe: Before The System Pin
Mukkie2-Sep-01 10:48
Mukkie2-Sep-01 10:48 
GeneralRe: Before The System Pin
| mProject |2-Oct-01 0:54
| mProject |2-Oct-01 0:54 
GeneralRe: Before The System Pin
Manish Pansiniya28-Oct-04 6:32
Manish Pansiniya28-Oct-04 6:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.