Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MCI Pin
Tomasz Sowinski17-Oct-02 0:09
Tomasz Sowinski17-Oct-02 0:09 
GeneralRe: MCI Pin
Gian17-Oct-02 1:52
Gian17-Oct-02 1:52 
GeneralRe: MCI Pin
Steve S17-Oct-02 2:33
Steve S17-Oct-02 2:33 
GeneralSubclassing Listbox Pin
suresh_sathya16-Oct-02 22:56
suresh_sathya16-Oct-02 22:56 
GeneralRe: Subclassing Listbox Pin
Tomasz Sowinski16-Oct-02 23:26
Tomasz Sowinski16-Oct-02 23:26 
GeneralCaret not positioned in Richedit Pin
insanely42016-Oct-02 22:56
insanely42016-Oct-02 22:56 
QuestionHow to share an object on the level of the OS? Pin
Raphael Kindt16-Oct-02 21:41
Raphael Kindt16-Oct-02 21:41 
AnswerRe: How to share an object on the level of the OS? Pin
Paul M Watt16-Oct-02 22:01
mentorPaul M Watt16-Oct-02 22:01 
You can use a pointer inside of your Memory mapped file, you will just need to manager the memory yourself.

So if you create your initial object, then decide that you want to allocate 50 bytes for a string, you can place that 50 bytes anywhere in your memory mapped file, however you will need to keep track somehow that it is being used so you do not reallocate it for another pointer.

Another solution is to use your memory mapped files for you objects, and any pointers you could allocate with GlobalAlloc. This allows you to share the allocated pointers between processes, however you will need to lock the pointer in place for each process before you attempt to use it. This solution is a little more cumbersome than new, but it may be better for you than writing your own memory manager for the file mapping scheme.

One other thing, if you decide to do GlobalAlloc, you could make you one single object that is shared by all apps, in your single DLL, a global object inside of a shared data section. That would save you the trouble of setting up and deleting the memory mapped file.

You can declare a variable in a shared data section simply by declaring it like this:
<br />
#pragma comment(linker, "/SECTION:.shr,RWS")<br />
#pragma data_seg(".shr")<br />
//C: This variable is shared among all process that load this DLL now.<br />
OBJECT g_obj;<br />
#pragma data_seg()<br />


Good Luck


Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

GeneralRe: How to share an object on the level of the OS? Pin
Raphael Kindt17-Oct-02 1:31
Raphael Kindt17-Oct-02 1:31 
Questionmore than one help file???? Pin
Mistermr16-Oct-02 21:03
Mistermr16-Oct-02 21:03 
AnswerRe: more than one help file???? Pin
Tomasz Sowinski16-Oct-02 23:33
Tomasz Sowinski16-Oct-02 23:33 
GeneralTrackMouseEvent little example Pin
Joan M16-Oct-02 20:20
professionalJoan M16-Oct-02 20:20 
GeneralRe: TrackMouseEvent little example Pin
Paul M Watt16-Oct-02 21:20
mentorPaul M Watt16-Oct-02 21:20 
GeneralRe: TrackMouseEvent little example Pin
James R. Twine17-Oct-02 5:34
James R. Twine17-Oct-02 5:34 
QuestionCImageList bug.....or am I just dumb? Pin
Teknofreek16-Oct-02 20:06
Teknofreek16-Oct-02 20:06 
AnswerRe: CImageList bug.....or am I just dumb? Pin
Tomasz Sowinski16-Oct-02 23:31
Tomasz Sowinski16-Oct-02 23:31 
GeneralRe: CImageList bug.....or am I just dumb? Pin
Teknofreek17-Oct-02 10:40
Teknofreek17-Oct-02 10:40 
QuestionHow to detect whether network is available? Pin
Wenrich16-Oct-02 18:36
Wenrich16-Oct-02 18:36 
Generalvectorize a bitmap Pin
bethbyang16-Oct-02 15:34
bethbyang16-Oct-02 15:34 
GeneralRe: vectorize a bitmap Pin
Maximilien16-Oct-02 15:57
Maximilien16-Oct-02 15:57 
GeneralRe: vectorize a bitmap Pin
Anonymous17-Oct-02 16:51
Anonymous17-Oct-02 16:51 
GeneralHeeeeeeeelp: CString and /clr Pin
Doug16-Oct-02 12:50
Doug16-Oct-02 12:50 
GeneralRe: Heeeeeeeelp: CString and /clr Pin
Nish Nishant16-Oct-02 19:24
sitebuilderNish Nishant16-Oct-02 19:24 
QuestionSHAutoComplete() where art thou? Pin
Ravi Bhavnani16-Oct-02 12:15
professionalRavi Bhavnani16-Oct-02 12:15 
AnswerRe: SHAutoComplete() where art thou? Pin
Rene De La Garza16-Oct-02 13:12
Rene De La Garza16-Oct-02 13:12 

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.