|
Yap i got that
Thare is not more blue lines now
but it will not run
|
|
|
|
|
Hi Everyone,
I have a vb6 application written as a service that interacts with the desktop. The service is designed to control a system that is never logged into by a user.
A function in the service is to enumerate the attached monitor(s) and configure the width, height and rotation based on settings read from an xml file.
The function works if a user is logged in but when the service runs and no user is logged on it fails to a) enumerate the display devices and monitors and b) configure the display settings using these two functions.
The idea is for the service to configure the display settings without having to logon to the computer to perform this task manually.
I think I'm running into problems with winlogon and perhaps the different state when no user is logged in. Does anyone have any information which could assist with getting these functions to work when no user is logged on?
Thanks,
Ben
|
|
|
|
|
Hi,
AFAIK services by default run without user interaction, without desktop, and hence without screen settings. However there is a flag somewhere that allows user interaction, so it is my guess you should enable that, then proceed. Don't ask me any details though.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
The Service is already set to "Allow service to interact with desktop" - this setting is on the Logon tab of the services mmc.
|
|
|
|
|
Services run under a different desktop, not the one users see. You're actually changing the display settings for a desktop that you can never see.
Like Luc said, you have to turn on the option to allow your service to interact with the user desktop. The problem is, since a user never logs in, who's going to see the settings?
|
|
|
|
|
The Service is already set to "Allow service to interact with desktop".
When calling ChangeDisplaySettingsEx I'm using two options that make it permanent and store it in the registry which in effect means it's set globally - including at Winlogon/Screensaver/Default.
When ChangeDisplaySettingsEx runs successfully, you can logoff or even reboot and the settings are still applied.
|
|
|
|
|
lbitben wrote: When ChangeDisplaySettingsEx runs successfully, you can logoff or even reboot and the settings are still applied.
OK, so is the problem solved or do you still have it? If not, then change the service so it's using a user account to login instead of running under LocalSystem. I doubt it's going to work, but it's worth a short.
Other than that, you cannot force those functions to work as you want. You're going to have to find some other method to do what you want. Information on doing this is probably going to be scarce considering noone ever uses those functions from a service.
|
|
|
|
|
I've managed to get EnumDisplaySettingsEx working and it is now enumerating the display adapters and available configurations. I am now trying to get ChangeDisplaySettingsEx working so that it will configure the display.
ChangeDisplaySettingsEx exits with: -1 which is DISP_CHANGE_FAILED, The display driver failed the specified graphics mode.
I have already confirmed the settings I am trying to apply are valid and they work if a user account is logged in when the service runs and attempts to configure the display adapter, but not when a user isn't logged in.
|
|
|
|
|
Is the user account you tested it under an Admin?
|
|
|
|
|
the user account being used is the Administrator account.
|
|
|
|
|
In that case, that's about as far as you can take it. It woujld appera that the function is just not going to work properly from a service.
|
|
|
|
|
'Remaining Text Does Not appear to be a part of the Formula'
getting this error when passing String Data from Vb.net form to Crystal report in VS 2008 , numeric value works fine
this is the code which i am using to pass the value to Formula Field
objReport.DataDefinition.FormulaFields(0).Text = "Company_Name ='" & gCompany_Name & "'"
|
|
|
|
|
Can you put a breakpoint/debug statement/watch on that line and tell us the value of the variable gCompany_Name ?
I are Troll
|
|
|
|
|
|
Error in Formula <ID>.
'Company_Name ='Company Name"
The reamining Text Does Not appear ......
|
|
|
|
|
I'm not using Crystal myself, but could this be a quote-mismatch?
'Company_Name ='Company Name"
How about this?
Company_Name = "" & "Company Name"
I are Troll
|
|
|
|
|
hi experts
i have created one application in vb.net c# and i add new item form2
and i want to set form2 for debug but only form1 is debug when i run this application i want to set from2 for debug
|
|
|
|
|
Set Form2 as start-up form?
|
|
|
|
|
paya1pa wrote: i have created one application in vb.net c#
What?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
paya1pa wrote: i have created one application in vb.net c#
You are therefore a genius. Stop programming, and start doing lectures, writing books, etc.
It's not possible to write an app in VB.NET AND C#, unless the languages are seperated through dlls.
paya1pa wrote: and i want to set form2 for debug but only form1 is debug when i run this application i want to set from2 for debug
Not true. If you debug, you debug the whole application. Perhaps you need to explain more, because nothing you've said makes any sense.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ok, so I should know this but I just do not know how to create a global variable in VB.NET i am more used to programming in VB6 and am still adjusting to .NET, so I need to ask how do I create a global variable?
I understand that it would be placed after the Public Class (project name) line but then how Would the syntax be for creating a global variable??? I also already know that I should try to not use global variables but I just am writing a very simple program so dont worry I do know that Global variables sometimes are not the best to use.
Thanks.
|
|
|
|
|
Well, for starters, global variables are nearly always bad. But, if you need one, it's just a shared variable ( which is the same as static in C# ). The difference is, it needs to exist in a class, you can't just create a variable in space somewhere. Other than that, it's the same thing. The keyword is 'shared', not 'static' in VB, and I don't know enough VB to give it to you beyond that, but if you google VB.NET shared, you should find examples.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Okay so I looked it up on google but didn't find any good examples of the syntax for global variables in VB.NET
i am trying to do this:
Public class Invest '(invest being my project name)
'then create a global variable, as Christian said I tried using the shared function but still dont know the proper syntax
Shared Dim iCount as Integer = txtAge.text
I know the line of code i just posted is incorrect but I dont know the proper syntax for declaring global variables
can someone tell me what I am doing wrong???
|
|
|
|
|
Does VB.NET really magically turn your textbox text into an int ? What happens when it fails, does it throw an exception ? VB is so nasty.
I found this with google:
Public Shared ReadOnly Property DBName() As String
Get
Return "FunnyNumbers_DB_for_the_auditors_only"
End Get
End Property
I presume the readonly is optional. I also assume you can use the same syntax for variables as for properties.
A shared variable is initialised when the program starts, I believe. At a minimum, you can't know when it is initialised, so you can't know what the value of txtAge.text will be when it is initialised. I assume you have only one instance of this textbox, you should handle the lost focus or text changed events to update this value.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You really shouldn't be creating "global" variables in the first place. If you do, it's a sign that you may have a problem with your class structure and are violating encapsulation rules.
Public Class MyGlobals
Shared Public someVar As Integer
End Class
And to get at it's value:
MyGlobals.someVar = 30
You would also be advised that it's better to wrap the variable in a Property to control access to the variable and do validation on any set attempts.
|
|
|
|