Click here to Skip to main content
15,923,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCLabel control with property sheet question Pin
DalTXColtsFan11-Nov-02 12:53
sussDalTXColtsFan11-Nov-02 12:53 
GeneralCSocket::Receive (from more than one computer) Pin
Walote11-Nov-02 10:47
Walote11-Nov-02 10:47 
GeneralCString from a UI Thread Pin
Anonymous11-Nov-02 10:25
Anonymous11-Nov-02 10:25 
GeneralRe: CString from a UI Thread Pin
dabs11-Nov-02 10:39
dabs11-Nov-02 10:39 
GeneralRe: CString from a UI Thread Pin
Anonymous11-Nov-02 10:45
Anonymous11-Nov-02 10:45 
GeneralThis seemed to fix it.. weird Pin
Anonymous11-Nov-02 10:59
Anonymous11-Nov-02 10:59 
GeneralRe: Its not fixed Pin
Anonymous11-Nov-02 11:26
Anonymous11-Nov-02 11:26 
GeneralRe: CString from a UI Thread Pin
Swinefeaster11-Nov-02 14:07
Swinefeaster11-Nov-02 14:07 
I know exactly what your problem is! Smile | :)

You can't use pointers to objects with a PostMessage(), because PostMessage() does not hang the calling thread and wait until the receiving thread processes the message, unlike SendMessage(). What happens is that the CString object in your calling thread gets destroyed before the receiving thread gets a chance to access the strings contents.

The solution to this is kind of a pain. You need to create a central map / list container that holds a bunch of strings, and then pass handles (or even pointers) to those strings in your messages. Then you delete the string once you receive the message, or perhaps after some time.

Hope this helps!

swine

Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
GeneralRe: CString from a UI Thread Pin
peterchen11-Nov-02 14:18
peterchen11-Nov-02 14:18 
GeneralRe: CString from a UI Thread Pin
Anonymous11-Nov-02 14:56
Anonymous11-Nov-02 14:56 
GeneralRe: CString from a UI Thread Pin
Swinefeaster13-Nov-02 13:28
Swinefeaster13-Nov-02 13:28 
QuestionHow to check if my PopUp menu is shown? Pin
Daniel Strigl11-Nov-02 10:15
Daniel Strigl11-Nov-02 10:15 
AnswerRe: How to check if my PopUp menu is shown? Pin
567890123411-Nov-02 21:07
567890123411-Nov-02 21:07 
GeneralView Class information Pin
act_x11-Nov-02 10:13
act_x11-Nov-02 10:13 
GeneralRe: View Class information Pin
Dave Bryant11-Nov-02 13:22
Dave Bryant11-Nov-02 13:22 
GeneralShellExecute / Multi-Instances Pin
JoeSox11-Nov-02 10:10
JoeSox11-Nov-02 10:10 
GeneralRe: ShellExecute / Multi-Instances Pin
dabs11-Nov-02 11:06
dabs11-Nov-02 11:06 
GeneralRe: ShellExecute / Multi-Instances Pin
JoeSox12-Nov-02 3:58
JoeSox12-Nov-02 3:58 
GeneralDesign Recommendation. Warning - long-g-g. Pin
11-Nov-02 9:43
suss11-Nov-02 9:43 
QuestionWhich font is it using? Pin
ed987111-Nov-02 9:26
ed987111-Nov-02 9:26 
AnswerRe: Which font is it using? Pin
Dave Bryant11-Nov-02 9:57
Dave Bryant11-Nov-02 9:57 
GeneralSTL rambling... Function object adaptors .. Pin
Maximilien11-Nov-02 9:21
Maximilien11-Nov-02 9:21 
GeneralRe: STL rambling... Function object adaptors .. Pin
Daniel Turini11-Nov-02 9:42
Daniel Turini11-Nov-02 9:42 
GeneralRe: STL rambling... Function object adaptors .. Pin
Maximilien11-Nov-02 10:02
Maximilien11-Nov-02 10:02 
GeneralRe: STL rambling... Function object adaptors .. Pin
peterchen11-Nov-02 9:50
peterchen11-Nov-02 9:50 

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.