How to build a buffer to deal with the accessing from multi-process?

I mean how to build the buffer? Use COM? How to do it?

Thank you.


0
fadics (34)
1/5/2005 11:14:06 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
617 Views

Similar Articles

[PageSpeed] 42

I mean there should be only one instance of the buffer to insure the
consistency of the data. How to insure exclusive of this instance?

Thank you.

"fadics" <fadics@sohu.com> д����Ϣ����
:OiZddgx8EHA.1392@tk2msftngp13.phx.gbl...
> I mean how to build the buffer? Use COM? How to do it?
>
> Thank you.
>
>


0
fadics (34)
1/6/2005 12:42:46 AM
fadics wrote:

> I mean there should be only one instance of the buffer to insure the
> consistency of the data. How to insure exclusive of this instance?
> 
> Thank you.
> 
>>I mean how to build the buffer? Use COM? How to do it?
>>
>>Thank you.

To create a shared memory buffer that can be accessed from multiple 
processes call CreateFileMapping and then call MapViewOfFile.  Each 
process should make these calls.

In CreateFileMapping you can use hFile = INVALID_HANDLE_VALUE to map the 
shared region to virtual memory.  Pass a unique string name as the 
lpName parameter.  If every process passes the same string name there 
will be only one instance of the buffer.

MapViewOfFile returns a pointer to the shared buffer.  It might be a 
different value in different processes, but it will point to the shared 
memory.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
1/6/2005 3:13:13 AM
Thanks a lot.

Is this method valid if the buffer is not for a file, for instance, a
printer?

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
??????:e9Ktl458EHA.3236@TK2MSFTNGP15.phx.gbl...
> fadics wrote:
>
> > I mean there should be only one instance of the buffer to insure the
> > consistency of the data. How to insure exclusive of this instance?
> >
> > Thank you.
> >
> >>I mean how to build the buffer? Use COM? How to do it?
> >>
> >>Thank you.
>
> To create a shared memory buffer that can be accessed from multiple
> processes call CreateFileMapping and then call MapViewOfFile.  Each
> process should make these calls.
>
> In CreateFileMapping you can use hFile = INVALID_HANDLE_VALUE to map the
> shared region to virtual memory.  Pass a unique string name as the
> lpName parameter.  If every process passes the same string name there
> will be only one instance of the buffer.
>
> MapViewOfFile returns a pointer to the shared buffer.  It might be a
> different value in different processes, but it will point to the shared
> memory.
>
> --
> Scott McPhillips [VC++ MVP]
>


0
fadics (34)
1/7/2005 3:13:53 AM
Thanks a lot.

Is this method valid if the buffer is not for a file, for instance, a
printer?

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
??????:e9Ktl458EHA.3236@TK2MSFTNGP15.phx.gbl...
> fadics wrote:
>
> > I mean there should be only one instance of the buffer to insure the
> > consistency of the data. How to insure exclusive of this instance?
> >
> > Thank you.
> >
> >>I mean how to build the buffer? Use COM? How to do it?
> >>
> >>Thank you.
>
> To create a shared memory buffer that can be accessed from multiple
> processes call CreateFileMapping and then call MapViewOfFile.  Each
> process should make these calls.
>
> In CreateFileMapping you can use hFile = INVALID_HANDLE_VALUE to map the
> shared region to virtual memory.  Pass a unique string name as the
> lpName parameter.  If every process passes the same string name there
> will be only one instance of the buffer.
>
> MapViewOfFile returns a pointer to the shared buffer.  It might be a
> different value in different processes, but it will point to the shared
> memory.
>
> --
> Scott McPhillips [VC++ MVP]
>


0
fadics (34)
1/7/2005 3:13:53 AM
fadics wrote:
> Thanks a lot.
> 
> Is this method valid if the buffer is not for a file, for instance, a
> printer?
> 

Yes, the buffer can be used for any purpose.  The FileMapping 
terminology refers to Windows' implementation of shared memory.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
1/7/2005 12:19:08 PM
Thank you.
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
??????:#uxwTOL9EHA.3336@TK2MSFTNGP11.phx.gbl...
> fadics wrote:
> > Thanks a lot.
> >
> > Is this method valid if the buffer is not for a file, for instance, a
> > printer?
> >
>
> Yes, the buffer can be used for any purpose.  The FileMapping
> terminology refers to Windows' implementation of shared memory.
>
> --
> Scott McPhillips [VC++ MVP]
>


0
fadics (34)
1/7/2005 1:34:13 PM
Reply:

Similar Artilces:

Outlook XP Cannot Access Exchange 5.5
Hi all, We are currently migrating our outlook clients from 2000 to XP. But with some users (1 out of 10) cannot access there mailbox, on our exchange 5.5 SP server, with Outlook XP. They get a dialog asking them for there username and password. When you type in nothing happens no error, you just have retype the password. If they use Outlook 2000 they can there mailbox just fine. I have found MS KB 297781 "You Repeatedly Receive a Prompt for Credentials When You Log On to the E-mail Server" But this seems to be only if access with a pop3 account. Is this a know problem?...

A2K-TOOLS
Hi, i want to create a form to convert several hundreds of A97 dbs to A2K. does anybody know what which routines are behind the Convert to current Database-Version in the A2K-Tools Database Utilities option. How could this be integrated in my form for the convert-loop over the a97-dbs. many thanks f=FCr helping The vast, vast majority of Access 97 databases can be opened in Access 2000 (or any later version) and saved in Access 2000 format. No, I don't have a suggestion as to how you would automate that task. There are, however, some very accomplished Access developers...

Using Access form to assign values of variables in an Excel VBA program
I have created a VBA program for Ms Excel.But,to get desired results, every time, I go into the code to change the values of variables.Is there a way to get the values of variables stored in an Access table? YOu need to do a search for ADO method (ActiveX Data Object). There are plenty of example of code on the web. You need to add two references in your VBA to use the method. from VBA menu tools - References 1) Microsoft Access XX.X object library 2) Microsfot ActiveX Data Objects X.X library Use the latest versio of the two libraries on your PC. You will make a conn...

Question about processing messages during exit
I have an MFC dialog-based app from which several threads get spawned. These threads communicate back with the main window by posting some user defined messages. When the user shuts down the app, I oftentimes have some of these user messages queued up in the messagequeue. It appears that once the quit processing starts further message dispatching halts (which makes sense) so these messages never get processed. Is there a way I could safely process these messages, perhaps by trapping the WM_QUIT and then running my own message pump to look for my user defined messages? Thanks for any ideas...

Filemaker vs. Access
Is Filemaker better than Access? I have been using Access since Access97 and find it quite easy to understand and can pretty much do anything with it. Has anyone used both? Comments please. JB All depends on what you are doing with it. My personal opinion: FileMaker is easier for some things. Access does has some powerful features that are missing in FileMaker. At the same time, a lot of users don't need the extra features. FileMaker can be frustrating at times, just because of terminology difference, if you are going from Access to FileMaker. But once you are used to one o...

Read/process in browser
We are building an intranet asp.net application where all users have Outlook 2003 or greater. Can someone point me to ways to read from an inbox from the browser (ActiveX or something better)? Thanks. -- David You might want to start by looking at the Outlook View Control; see http://www.outlookcode.com/article.aspx?id=70. Beyond that, you'll need to provide specifics on what your application intends to do, whether Microsoft Exchange is involved, etc. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administra...

can I change the applied sales process?
I have several opportunities which had the wrong sales process applied to them. Is it possible to go in and apply the appropriate sales process, instead? (currently, if I go to "apply rule," the list is empty...) Thanks! aaron OK... So, the best I have is to close the opportunity and start over. Am I missing something better? "scootertig" wrote: > I have several opportunities which had the wrong sales process applied to > them. Is it possible to go in and apply the appropriate sales process, > instead? (currently, if I go to "apply rule," t...

HELP!!! How do you create a query crieria for multi values??
Hello all, please hyelp, its an emergency!!! Need to create a query where one of the searches is male or female, how do I allow user to enter both as the search options?? Also how do I convert tix boxes into a query criteria (e.g. serach for all ticked) Thanks so much for your help ...

Multi-condition SUMIF
Here's my issue: I need to sum a column only if 2 conditions are true in two other columns. Here's the set up: Con1 Con2 $ A X 100 A 200 B 300 B X 400 So, what I'd like to do is sum column $ when the value in the Con1 column = A AND the value in the Con2 column = X. I know that I can just create a composite column, but I was trying to avoid doing that. Any suggestions? Thanks, Manuel If I understand your post right, you could do something along the lines of: =IF(AND(A2="A"...

Serialised Gift Certificates in Multi-store environment
Hi - new implementation in 30 stores with Store Operations and HQ. We have uniquely numbered gift certificates (GC) that can be sold for any dollar amount in any of our stores and redeemed in any stores. In RMS we cannot see the sold serial numbers in any other store except the one that the GC was sold from. Am I missing something, or can serialised GC only be sold /redeemed in the same store? Thanks, Kerri. Kerri, Correct, the cert is only redeemable at the selling store. There are many add-ins that will do what you want; http://web.givex.com/rms/ http://tinyurl.com/cdp6m http://ww...

Filling LIstBox with Access users names
Hi Does anyone know how to fill a listbox withthe login names of Database users when Access security has been implemented, i want to be able to delete a user from the system using the listbox to select the user to delete. Many thanks Stuart -- Message posted via http://www.accessmonster.com You can cycle on the Users collection: For Each x In DBEngine.Workspaces(0).Users ... Next x It would be a matter to append the user name to a list of values. Hoping it may help, Vanderghast, Access MVP "Stuart Jack via AccessMonster.com" <u31758@uw...

[Visual C++] Question on LNK 2001 Errors while Building EXE
Hello? I'm June from S.Korea. I'm sorry if I am at a wrong place for my question. I'm practicing echo client code. Below is what I copied from a textbook. The problem is, there're 0 error, 0 warning at compiling. But There're 10 errors at Building EXE files. How can I troubleshoot them? I already #included winsock2.h, which has the definition for the functions listed in the 10 error messages.And the help says the linker doesn't find definition for the functions listed. Thanks for reading and still I'm not sure if I'm at a right place to ask. But hope you will h...

Data from Excel to Access Table
Hello, I have this code setup in Excel but I want to be able to upload multiple rows at one time. Is there a way to incorporate this into my code? Also, is there a way to upload cells that are blank as well? Right now it won't allow me to upload cells that are blank. Can this be done? Sub UploadData() Dim MyCn As ADODB.Connection Dim SQLStr As String Set MyCn = New ADODB.Connection MyCn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & _ "DBQ=\\Bcar1\bcar-net\Quality-ISO\Quality-Control\BC-Quality-Control\BC QA mdb\BC Quality Action Database.mdb;SystemDB=\...

Data entry slow in an Access project
I am using a form for data entry in an Access 2003 project. The back-end data is on a remote server reached over the internet. The data source for the form is a table with 3200 records. The form also displays 6 sub-forms which display data from child tables of the main table. There is a 3-4 second delay when the user moves from one field to another on the form after modifying an existing record or entering data for a new record. During the delay, the status bar below displays a 'Calculating' message. The table is not actually updated until the user moves to a different record ...

Process multiple Vouchers from One customer
Is there a recommended way to process multiple gift vouchers from one customer? Now we process one voucher and put trans. balance on account then process next gift voucher toward reaming trans. balance. Repeat this until balance is cleared. Any suggestions? Dave Dave - in SO manager go to database - tender types - select your gift voucher tender then click properties - check mark "allow multiple entries" so that more than one gift voucher tender can be accepted in the same transaction. I think this is what you're looking for, but if I misunderstood your question, plea...

Access Coding from 2003 to 2007
Is there an easy way to find conversion code from Access 2003 to Access 2007 we are currently in the conversion process but not all of our coding is working how we need it to. They all worked in 2003 properly. What's not working? It should be relatively straightforward if you have used only the core libraries (VBA, Access, and DAO), your database is in a trusted location, and you are not too tied to menus/toolbars Generic conversion info: http://allenbrowne.com/Access2007.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - ht...

Changing Format of Access Field via Query?
HI all, Here is what i have, two Oracle tables across multiple schemas that I cannot change the actual format in the table. One table has the field = Text The other table has the field = Number/Decimal/10 Precision I need to link these two together to run some data and currently I have been making a temp table and changing the TEXT one to a NUMBER but am wondering if there is a way to change the Format of the TEXT one to a Number in a query which would save me from having to always be making a TEMP TABLE. Thanks in advance for any help you can give.. Aaron Try using an aliased column lik...

Microsoft Access has a problem
I do work for a company which runs Microsof Access on a Terminal Server. Weeks can go by without any problems and then we have a few days where they get the "Microsoft Access has a problem" screen whenever an database is opened. If autostart is disabled and the code behind a form loading is run step by step all is well, but I am wondering if anyone else has had a similar problem. Many thanks Peter Kinsman Dear Peter, 1. Do you have good backups and backup schedule? 2. Could you mention the version of Access that you are running? 2B. What is your structure? Front end on...

access 97 begins without instructions, Why?
My office 97 Access Program begins automatically and it just began to happen. Is there someway to make this from happening? It is very frustrating when your logging into the computer and all of a sudden access 97 starts to run .. dusty68 <dusty68@discussions.microsoft.com> wrote: >My office 97 Access Program begins automatically and it just began to happen. > >Is there someway to make this from happening? It is very frustrating when >your logging into the computer and all of a sudden access 97 starts to run .. Check your Start >> All Programs >&g...

Access 97 "Unrecognized Database Format"
After our Novell Server crashed last week, all of the files had to be restored from backup. Some of the Access 97 databases will not open now. The error states "Unrecognized Database Format". The files in question have an .Mde file extension. Any suggestions? Thank you, Sandy M. "Sandy M." <Sandy.Mullen@emersonprocess.com> wrote in message news:0c9901c36d71$e28d9f10$a501280a@phx.gbl... > After our Novell Server crashed last week, all of > the files had to be restored from backup. > > Some of the Access 97 databases will not open now. > > The e...

Multi Manufactured Products
Hi: Hoping that someone can help. I have to determine the manufactured product cost of our 16 products (expected to rise to 20 in the near future). Each product can use between 4 to 7 types of raw materials from a possible 21 types. Additionally each product can be sold in 6 size of packaging and overhead costs have to be considered for 12 departments What is the best approach for such a costing. You may want to experiment with this: Layout your data kind of like this: C1:X1 headers for each cost center (raw material or dept overhead) C2:X2 Unit cost for each cost center A3:Axx Each of...

MS Exchange problem
Hi We are using Windows 2003 Server and MS Exchange 2003. I get the following message when i tried to access system manager of MS Exchange 2003. "Access is denied, Facility Win32, ID No: c0070005, Exchange System Manager" click ok and it quits. Similarly, I cannot access "Active Directory Users & Computers", it runs ok but when I click on a User object or any object for that matter I get; "Microsoft Active Directory - Exchange Extension, Access is denied, Facility Win32, ID No: c0070005, Exchange System Manager" I click ok then the MMC quits. This ...

How can I open an Access adp file from excel?
I am basically tryi8ng open the database of aan *adp project to be able to manunally work on the tables. Ultematerly I would like to upsize the data base to sql. Wen we double click to open the *adp using access, the application opens, but we can't work the menus to access the database. I understand the *.adp can be opened from excel. In any case, how can we get to the tables? We'd like to re-write the front end, but wopuld like to safe the db design time. Thanks ...

Slow MS Access DB over WAN
We have an MS Access 2000 application run over a WAN (wintel server). It is built with a frontend on the users machine and backend on the shared drive of the server. The shared drive is near the root (2 folders away), is accessed by 50 or less people running Access 2000 to 2003 over the WAN, the backend is less than 50 MBs in size, and has only 150,000 records in it. The DB runs exceptionally slow! Just opening forms or reports can take two minutes each! Very frustrating! We have followed Microsoft's recommendations for building this thing but is so slow that it is not very useable. ...

Pivot Table Processing
I am using a pivot table to show the amount of product that is being used in a month. What I would like to do is color code any month that has less than 20 days usage in any month. This is part of a table that I am using: Product Days Qty Orderld Month 1234 23 12 60 1 2345 26 90 60 1 9586 18 85 60 2 4759 21 65 60 3 2589 12 34 60 4 2589 23 56 60 5 1234 10 89 60 6 1234 23 12 60 ...