C++ Builder IDE >> How to use share meomry under a Service program?

by hawkfly » Sun, 25 Sep 2005 20:46:51 GMT

I create a ServiceApplication under BCB5 and use CreateFileMapping to alloc
some memory for comunication with a desktop-program.

I have set the value:

Interactive=true
ServiceType=win32

I use the CreateFileMapping() in OnStart event,but the desktop-program can't
share the memory.
When CreateFileMapping() be used in desktop-program ,it return null.

Please tell me how can I use CreateFileMapping() in service application?





C++ Builder IDE >> How to use share meomry under a Service program?

by Andrue Cope [TeamB] » Mon, 26 Sep 2005 16:02:39 GMT






You will increase your chances of getting useful replies if you post
your messages into the appropriate newsgroup section. .IDE deals with
questions arising from the IDE (Editor, debugger, etc). Questions on
using the API belong in .NATIVEAPI.

See how it goes today but if you don't get any useful replies repost to
there.

--
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html



Similar Threads

1. Share Information between Service and Service Manger

I have a application that run as Windows Service. I also created another 
Windows Form Application that manage the Service like MS SQL Server Service 
Manager did. Service Manager need to know some variable value in Service, 
include some massive data.

I am using the TCP Socket, is there a better way? Thanks.

2. sharing STL object across process using shared memory

3. Can ATL be used with a command line program - eg a service

Hello

I know ATL has a wizard option to create a service, but the service I am
creating doesn't need any COM support.  It does however, require access to a
database, for which I would like to use the ATL OLE DB classes.

So do I just create the _Module anyway - do I need to Init it?  Or should I
not bother with ATL for a service?

Angus Comber
 XXXX@XXXXX.COM 



4. Using program as a Service

5. Running VC program by using service

Dear all,,,,
    I want to run VC program  by using service....SO I wrote code for
creating the service.
Code is given below....

void main()
{
SC_HANDLE myService, scm;
    printf("Installing RRM Service...\n");
    scm = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);

   if (!scm)
   {
     printf("OpenSCManager fails!", GetLastError());
   }

   printf("Opened Service Control Manager...\n");

   myService = CreateService(
      scm, "rrmclient",
      "rrmclient",
      SERVICE_ALL_ACCESS,
      SERVICE_WIN32_OWN_PROCESS,
      SERVICE_DEMAND_START,
      SERVICE_ERROR_NORMAL,
      "D:\\rrmclient\\Debug\\rrmclient.exe",
      0, 0, 0, 0, 0);

   if (!myService)
   {
      printf("CreateService fails!", GetLastError());
   }
   else
   {
      printf("Service successfully installed.\n");
   }

   CloseServiceHandle(myService);
   CloseServiceHandle(scm);
}

But when I start this service...

I got error message...
Error 1053: Service could not respond to the start  or control request
in a timely fashion.....

Whats the pblem???????
Tanx to all..........

6. Add/Remove Programs: The specified service does not exist as an installed service - CSharp/C#

7. Running a web service from a Windows Service program

Hi

My application needs to get XML files from another system at irregular
intervals.  I'm looking at running a c# program on my server as a
Windows Service that uses a .Net Web Service to request the latest
files at regular intervals (maybe each hour).
As I'm new to web services I'd like to ask if this is a sensible way to
use web services? And to ask for any tips,  or maybe there's a better
way of getting files between systems.

John South

www.wherecanwego.com
Pangbourne UK

8. How to call a web service using NT Authentication from Web Service - CSharp/C#