|
A service was mot a good choice for this application. It should stay as an application that runs from the users Startup folder. This is why:
The wallpaper is a user-specific settings, meaning that each user has their own preference for this setting. The setting, if changed by one user, is not applied to all other users on the machine, logged in or not.
Next, on Windows XP, you can have multiple people logged in at the same time, though you can only have one session active at a time.
Now, a windows service doesn't run in the context of the user(s) that is lgged in. In normally runs under the context of Local System. Further, the services each have their own desktop, or more specifically, no VISIBLE desktop. So, when your service is setting the wallpaper, it's actually doing on a desktop that you can't see.
Having said all that, it is possible to have a service interact with the desktop that's currently logged in/active. In the Service Control Manager (Administrative Tools), find your service and get the properties on it. Find the little check box that says "Allow interact with desktop". Now, this is no way guarantees that the SystemParametersInfo call will work. But if it does, the service will be changeing the wall paper for ANY user that logs in, regardless if they want it to or not. This is why it's best to leave it as a normal Windows Application and let it run out of the users Startup folder.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I agree with what Dave said. Webshots for example runs an instance on every user that wants to use the program.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Is there a way to change the forecolor/fontface/fontstyle of the column headers in a DataGrid? Maybe even the background color?
Thanks,
Mark Mokris
|
|
|
|
|
Hallo,
for launching my program when windows starts, i added an entry to
HKEY_LOCALE_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run in my setup-project.
This works fine, but if the program is loaded, if have to find out if this
was done by the user or by the operating system.
Is there a way to find out?
Thanks for your help,
Björn
|
|
|
|
|
|
Since there is no difference between the OS launching the app and a user launching the app, no.
When an application is launched out of the Run key, it is actually a request made by the Shell, to the Loader in the OS. When a user clicks on an icon in Explorer, the exact same thing happens. The Shell makes that same request to the Loader, on behalf of the user (or in othjer words, in the security context of the user).
So, no, there is no way to tell the difference...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
using System.Runtime.CompilerServices;<br />
<br />
namespace DEMONS<br />
{<br />
<br />
[ComVisible(false)]<br />
public delegate void TestEventHandler();<br />
<br />
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]<br />
public interface ControlEvents<br />
{<br />
void OnBeforeStartTest();<br />
}<br />
<br />
[ <br />
ClassInterface(ClassInterfaceType.AutoDispatch),<br />
ComSourceInterfaces(typeof(ControlEvents))<br />
]<br />
public class Demo<br />
{<br />
public event TestEventHandler OnBeforeStartTest;<br />
public void TEST()<br />
{<br />
Console.WriteLine("TEST()");<br />
<br />
if (OnBeforeStartTest != null)<br />
OnBeforeStartTest();<br />
}<br />
}<br />
}<br />
VBS:
sub OnTest2()
msgbox "VBSCRIPT OnTest"
end sub
sub obj_OnBeforeStartMigration()
msgbox "VBSCRIPT OnTest"
end sub
set obj = createobject("DEMONS.Demo")
set obj.OnBeforeStartTest = GetRef("OnTest2")
obj.TEST
--------------------------------
obj.TEST works fine (if to comment upper string). But when I leave it uncommented i receive
Microsoft VBScript runtime error: Object doesn't support this property or method: 'obj.OnBeforeStartTest'
Whats wrong to my code - VBS and .NET?
|
|
|
|
|
Hi,
Is there any method to parse a string in the same way of sscanf?
Suppose you have a string with Number1= 3 Number2 =2.58874 . I can do this by hand, like finding the = sign and then use Int32.Parse() and Double.Parse() but since I have a lot of strings with a lot of different formats this does't seem to be a good way.
So is there any better way to do this?
Thanks!
Pedro
|
|
|
|
|
Pedro S Ferreira wrote:
So is there any better way to do this?
Actually, no. You can use regular expressions to ease things a bit, but you'll still need to parse it by yourself.
HTH.
Yes, even I am blogging now!
|
|
|
|
|
I am having one grid..i want to export that grid to word..after doing only two fields r coming ie serial no: and total..product name, quantity and unitcost r not coming into the word...those three r from databasee...How can i bring those three to the word...
the code looks like this...
object fileName = "C:\\Inetpub\\wwwroot\\eBilling\\jijo.doc";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\StartOfDoc";
object oCurrentCell="\\Cell" ;
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
try
{
Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName,ref missing,ref readOnly,ref missing, ref missing, ref missing,ref missing, ref missing, ref missing,ref missing, ref missing, ref isVisible, ref missing,ref missing,ref missing);
oWordDoc.Activate();
oWordApp.Selection.TypeParagraph();
oWordDoc.Content.Delete(ref missing,ref missing);
Word.Table oTable;
Word.Range wrdRng =oWordDoc.Bookmarks.Item(ref oEndOfDoc).Range;
oTable = oWordDoc.Tables.Add(wrdRng, DataGrid1.Items.Count, 5, ref missing, ref missing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;
int i,j;
for(i=0;i
|
|
|
|
|
I personally haven't worked with Word automation that much. You might get some luck here, but ms newsgroups are probably a better place for this question. See: http://msdn.microsoft.com/newsgroups/[^]
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
am just a c# beginner and am having troubles doing this can anyone plz help?
thnx
|
|
|
|
|
hUmAnzZ wrote:
How Do I Convert Char[] to string?
One way to do this is to create a new String object by using the constructor public String(char[] value)[^] of the String Class[^]. For example:
char[] CharArray = new char[12] {'H', 'e', 'l', 'l', 'o', ' ',
'W', 'o', 'r', 'l', 'd', '!'};
string Foo = new string(CharArray);
MessageBox.Show(Foo);
Best regards
Dennis
|
|
|
|
|
string is an char array?. Im not sure but try follow
string cadena = (string)myChararray
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Hello machocr,
Please note that a string in C# may not actually be an array of characters. That is, it is not guarenteed to be contiguous in memory.
An array (of any type) in C# -will- be contiguous in memory.
Regards,
Bio.
|
|
|
|
|
Hi,
1. I want to add license to an C# dll library. How can I ensure that the user is a deveeloper or a edn user aplicaation?
The library is not a toolbar component.
2. How can I use the serial number of the .net install projects to add chaeck licensing?
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
machocr wrote:
1. I want to add license to an C# dll library. How can I ensure that the user is a deveeloper or a edn user aplicaation?
The library is not a toolbar component.
AFAIK, you can't.
machocr wrote:
2. How can I use the serial number of the .net install projects to add chaeck licensing?
Have you considered that licensing in .NET is too easy to break?
Yes, even I am blogging now!
|
|
|
|
|
Please also tell how to add images to menuitems at runtime using imagelist or any other method.....
|
|
|
|
|
|
Hi all.
Is there a way to check if a file has been digitally signed and has attached digital certificate and then if so extract it so it can be used on the code.
I know there is a tool called secutil. How can I use it from command line?
Any other ideas? Please help.
izabela
izabela
|
|
|
|
|
sillypuppy wrote:
Is there a way to check if a file has been digitally signed and has attached digital certificate and then if so extract it so it can be used on the code.
I'm not sure if I've really understood what you want to do. Maybe you can explain it a little further?
I know there is a tool called secutil. How can I use it from command line?
Yes, and if the files you want to check are indeed assemblies secutil should be the right tool to extract the public key. You can find the reference on MSDN (see Secutil Tool (Secutil.exe)[^]).
Best regards
Dennis
|
|
|
|
|
I need to check if a file is an assembly and if so need to check if it has attached a digital certificate. then I need to use the contents of the certificate in my C# code: basically need to copy the fingerprint.
How can I call Secutil from within my C# code. I have no idea how to do that?
Cheers,
izabela
|
|
|
|
|
sillypuppy wrote:
How can I call Secutil from within my C# code. I have no idea how to do that?
Sorry, I'm really short of time so this is only my first best guess: You could start secutil from your C# code and redirect its standard out stream. Of course you would then have to parse whatever you get back but it should work (see ProcessStartInfo.RedirectStandardOutput Property[^] for some code samples).
Best regards
Dennis
|
|
|
|
|
The firts tip with removeAt works fine, but ....
I want also access the container objects (Tabs) of a TabCOntrol by index and not by name for the member functions Add and Contains.
I didn't find a corresponding function to
Remove(Tab0) --> RemoveAt(Index).
// that's what I have
if (TabControl.TabPages.Contains(Tab0)) TabControl.TabPages.Add(Tab0);
// that's what I want
if (TabControl.TabPages.Contains(index)) ITabControl.TabPages.Add(index);
Does a container have an Index
Thank in advance
fracalifa
fracalifa
|
|
|
|
|
Try this:
if (TabControl.TabPages.Contains(TabControl.TabPages[index]))
ITabControl.TabPages.Add(TabControl.TabPages[index]);
www.troschuetz.de
|
|
|
|