Hi,
This may seem like a silly question, but is it possible to have a DLL just run by itself
I know that the registered DLL will be accessed at startup by it's DllMain function (and then it's xxx_Init function... or is that wrong ), and this function will lock out all other processes. So I can't just go linking the rest of my program from there.
But, is it possible to spawn a thread during the start up functions so that the program will continue to run Basically I want to just use my functions in a never ending loop in the background, so to write an EXE which just sits there calling the function seems a bit wasteful.
Thanks for your help.
Dan.

Running a DLL like an EXE
DKB
Thanks for the reply Alex.
Although, I musn't have made myself clear. I already have a service, I followed the example you gave me to make what I have now, which by the way, is a very good write-up. If it is simply the case of having the service DLL and adding the attributes to the registry, which function would I use as a sort of "main" One that I can use without locking the system, which, from what I have read, would be DllMain and xxx_Init. The write-up talks about the "application" using the service and I presumed this meant you needed an additional program to utilise the DLL.
Sorry if I have missed a bleeding obvious fact from the finger example, but this problem still eludes me.
Joao Pinto
I pretty sure XXX_Init and all other XXX commands are service and driver specific. They are set up to be called through services.exe or devices.exe. I don't think they are executed by the OS in any other fashion. What are you trying to accomplish Is it a logger If you just want something to execute and do it's work every once and a while you could try reading this post here:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=328857&SiteID=1
Lana Najm
Yeah, I guess it runs like a logger. Starts up, periodically sends a request to a website while constantly being aware of key press events (makes it sound like some hacker keystroke logger, which it isn't). That's basically all it needs to do. The time for the period can be anything from 1 minute to 1 hour.
I've looked at the articles written by Lao K, which are excellent, and I would like to use something like CeSetUserNotificationEx. But this looks like it'll only work to run another application, not just jump to a function after the specified time. Ideally, I would like it to jump to the routine even if the device had turned itself off (after 3 minutes or whatever), but I don't know if that is possible at all. For now I'm playing to just keep the whole device from turning off, but turn off the screen (which I think is possible).
And apart from that, I have it running on startup by have an executable in the StartUp folder which contains one line, RegisterService(...); . This seems to work fine, and doesn't really bother me at all. I'll need an executable at StartUp later on anyway, to automatically turn on the GPRS and load some other DLL files.
Does this sound like I'm doing things pretty standard... or is this just some very unorthadox way to do things. It's very hard to tell with the limited articles for Windows CE development.
Dan.
Free Hall