Click here to Skip to main content
16,006,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion about determing type of control at runtime Pin
MarcoNedwig4-Jun-03 1:00
MarcoNedwig4-Jun-03 1:00 
GeneralRe: Question about determing type of control at runtime Pin
Hans Ruck4-Jun-03 1:44
Hans Ruck4-Jun-03 1:44 
GeneralRe: Question about determing type of control at runtime Pin
Anonymous6-Jun-03 4:13
Anonymous6-Jun-03 4:13 
GeneralRe: Question about determing type of control at runtime Pin
codecharmer28-Mar-04 15:28
codecharmer28-Mar-04 15:28 
GeneralMessage Pin
Rage4-Jun-03 0:59
professionalRage4-Jun-03 0:59 
GeneralRe: Message Pin
jhwurmbach4-Jun-03 1:14
jhwurmbach4-Jun-03 1:14 
GeneralRe: Message Pin
Anonymous4-Jun-03 2:01
Anonymous4-Jun-03 2:01 
GeneralRe: Message Pin
peterchen4-Jun-03 2:40
peterchen4-Jun-03 2:40 
jhwurmbach is basically right:

The adress space is different between processes (i.e. the same virtual address refers to different physical locations, and you might not even have access rights to that location)

A typical solution would be a memory mapped file (relatively easy to create, yet quite flexible).

Another option is a WM_COPYDATA message. You will receive a copy of the data (but this is valid only while the message is processed, so create your own copy on the client side)

for a CString:
Sender:
CString myString = ...
COPYDATASTRUCT cds;
cds.dwData = 0; // or some ID of your own
cds.cbSize = (myString.GetLength()+1) * sizeof(TCHAR);
cds.lpData = (LPCTSTR) myString;
::SendMessage(hwndReceiver, WM_COPYDATA, (WPARAM) hwndSender, (LPARAM) &cds);
Receiver - WM_COPYDATA handler:
HWND sender = (HWND) wParam; // just to verify *who* sends you some data
COPYDATASTRUCT & cds = *(COPYDATASTRUCT *)cds.lpData;
CString receivedString = (LPCTSTR) cds.lpData;


Note: this does not handle passing from UNICODE app to ASCII/MBCS app (or vice versa) correctly







"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS

sighist | Agile Programming | doxygen

GeneralRe: Message Pin
Rage4-Jun-03 3:23
professionalRage4-Jun-03 3:23 
GeneralRe: Message Pin
Magnus Westin4-Jun-03 3:38
Magnus Westin4-Jun-03 3:38 
GeneralRe: Message Pin
jhwurmbach4-Jun-03 4:05
jhwurmbach4-Jun-03 4:05 
GeneralRe: Message Pin
peterchen4-Jun-03 3:58
peterchen4-Jun-03 3:58 
GeneralRe: Message Pin
Peter Weyzen4-Jun-03 9:32
Peter Weyzen4-Jun-03 9:32 
GeneralDefining operator << Pin
Shah Shehpori4-Jun-03 0:45
sussShah Shehpori4-Jun-03 0:45 
GeneralRe: Defining operator << Pin
Magnus Westin4-Jun-03 2:48
Magnus Westin4-Jun-03 2:48 
GeneralRe: Defining operator << Pin
Mike Nordell4-Jun-03 2:49
Mike Nordell4-Jun-03 2:49 
GeneralModifying window style Pin
Zizilamoroso4-Jun-03 0:19
Zizilamoroso4-Jun-03 0:19 
GeneralRe: Modifying window style Pin
Hans Ruck4-Jun-03 0:39
Hans Ruck4-Jun-03 0:39 
GeneralRe: Modifying window style Pin
Zizilamoroso4-Jun-03 1:28
Zizilamoroso4-Jun-03 1:28 
Generalembedding window into dialog Pin
Jump_Around4-Jun-03 0:17
Jump_Around4-Jun-03 0:17 
GeneralControlling Access To Temporary File Pin
Poul Haahr Klemmensen3-Jun-03 23:36
Poul Haahr Klemmensen3-Jun-03 23:36 
GeneralRe: Controlling Access To Temporary File Pin
BhaskarBora4-Jun-03 1:18
BhaskarBora4-Jun-03 1:18 
GeneralRe: Controlling Access To Temporary File Pin
Neville Franks4-Jun-03 2:47
Neville Franks4-Jun-03 2:47 
GeneralRe: Controlling Access To Temporary File Pin
BhaskarBora4-Jun-03 21:07
BhaskarBora4-Jun-03 21:07 
GeneralRe: Controlling Access To Temporary File Pin
Neville Franks4-Jun-03 2:58
Neville Franks4-Jun-03 2:58 

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.