473,766 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service calling EnumChildWindow s

Can I use EnumchildWindow s from a windows service to find the IE windows and
Solitaire windows belonging to the logged on user?

And if so then I'll need to know what call to use to get the users desktop
window handle to enum them - Assuming GetDesktopWindo w doesn't at this point.

I can do all this in a Forms application (trying to convert to service) but
as a service it simply doesn't think there are any of those windows open.
Nov 5 '07 #1
2 2290
>Can I use EnumchildWindow s from a windows service to find the IE windows and
Solitaire windows belonging to the logged on user?
It depends on your OS and some other factors.

Why do you want to do this from a service?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 6 '07 #2
I have gotten past this one. I'm not sure why it wasn't working before but
I've found that I need to reboot "A LOT" when developing a windows service.
All the building, installing, uninstalling, rebuilding, etc., just corrupts
the system and the service doesn't work as expected until a reboot. This is
on a brand new install too using .NET 2003.

Now my next problem is I need the service to "Allow interaction with
desktop". I have found most of the solution to do this. BUT, there is
something missing...
In the installer module I have coded it to enter all registry entries - and
for now I have given myself permission to the
HKLM\System\Cur rentControlSet\ Enum\Root node to enter the LEGACY_XXXXXXX
keys/values WHERE XXXXXXX is my service name.
I have obtained these entries by manually setting the service to "Allow
Interaction with desktop". But there is one setting not in this node or the
Service node that needs to be addressed. After install everything looks just
as I expect and looks like it should work - right? Wrong!
I still have to go the the service manager, uncheck the option, save,
re-check the option, save, and then the service works as expected. So my
question is: Is there a better way to set the "Allow Service to interact
with desktop"? Or does anyone have the faintest idea what else needs to
happen before this will work properly. It's the same problem as before -
there are no windows found - just like if the option was not set.
"Mattias Sjögren" wrote:
>
Can I use EnumchildWindow s from a windows service to find the IE windows and
Solitaire windows belonging to the logged on user?

It depends on your OS and some other factors.

Why do you want to do this from a service?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7512
by: SectorUnknown | last post by:
I've written a Python script that runs a MS Windows program using popen. However, at the end of the Windows program, a dialog box appears and asks for the user to click on OK. Is there a way to have Python set focus on the dialog box and click OK so my script can continue? Does anyone have an example?
1
3288
by: bob | last post by:
I have created a simple Windows service in VB.Net which installs fine using InstallUtil.exe to install it to, for example "c:\test", or "c:\Windows\YellowBanana", but if I install it to "c:\Program Files\Test" it installs ok but will not start (no useful error message is given other than the usual annoying suggestion about having sufficient privileges). The problem only seems to happen with spaces, not long filenames. I have found a...
9
7272
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service stopping. Please advise how to stop the service. Thanks, SP
3
2570
by: aspirit | last post by:
hello Is it possible (and how) to enum all windows on desktop in c# ? I need this to write a program which closes miscelanious windows with various titles.
3
8546
by: Gary | last post by:
I am using VS.Net 2002 with windows 2000 advanced server and windows 2000 professional. I have a requirement to use windows service with a GUI. I want to show my own User Interface(Dialog) to get user input, before windows login screen. For that I have created a windows service, in the onstart event of this service, I am calling a vb.net exe, which has windows form. But it throws error bcoz of the form. I even tried by calling a vb.net...
3
10124
by: John F | last post by:
I have a question about EnumChildWindows(). Currently I'm using this API function to iterate through all the controls in another application. In my call back function I call SendMessage() and pass WM_GETTEXT to return the text in each child control. Everything works perfectly. My question pertains to the Z-Order and expectations. Currently I take all the values I pull out of this 3rd party app and populate a string array. On my...
1
15104
by: TJ | last post by:
I created a windows service using VS2005. I created/adjusted the install class using the designer controls. I set the user to be 'local system'. I installed the service using the VS2005 cmd console (installutil.exe). The service shows up fine in my services snap-in. I can start and stop it just fine and it works great when I start it. I can open a command window and type: net start "My Service" and net stop "My Service" and it works...
41
11660
by: pbd22 | last post by:
Hi. I know my windows service works when i run it in debug mode on my dev machine. It also works in release mode on my dev machine. But, when I move the service to a production server, it exits immediately with a start/stop/nothing to do error. What could be wrong?
0
1202
by: Emilio | last post by:
Good morning to everyone, I've tested this "format" od this code to enumerate some controls in a window and it works fine. Private Delegate Function EnumChildProcDelegate _ (ByVal hWnd As IntPtr, _ ByVal lParam As Integer) As Boolean Private Declare Function EnumChildWindows Lib "user32" _
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.