|
I need to run the program on a win7 machine again to see the message. I have a win8.1 machine.
Give me a day to do this, time to go home.
|
|
|
|
|
Guess my idea to just write a program to disable win10 upgrades was not a good idea.
Just FYI, the 2nd key is what the group policy does from what I read.
I can't access the LocalMachine Key, I just get a null back.
I did the click run as administrator.
Logged in as administrator.
I really don't want to manually adjust every computer in the office.
Guess Microsoft really tightened up the security which is good.
public static bool tweak_registry()
{
bool pValue = false;
const string subKey1 = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade";
const string keyName1 = "AllowOSUpgrade";
const string keyName2 = "DisableOSUpgrade";
try
{
using (var _key = Registry.LocalMachine.OpenSubKey(subKey1, true))
{
_key.SetValue(keyName1, 0, RegistryValueKind.DWord);
_key.SetValue(keyName2, 1, RegistryValueKind.DWord);
}
pValue = true;
}
catch (Exception ex)
{
pValue = false;
if (ex.Message == "Attempted to perform an unauthorized operation.")
{
Console.WriteLine("");
Console.WriteLine("You must be an adminsitrator to perform this task!");
Console.WriteLine("Right Click on the program and select 'Run as Administrator'");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
System.Environment.Exit(-1);
}
else
{
Console.WriteLine("ERROR: " + ex.Message);
Console.ReadKey();
}
}
return pValue;
}
|
|
|
|
|
Visual Studio? You have "AnyCPU as target?
As far as I know to access the registry with "AnyCPU" you need to take care of 32 and 64bit on the SOFTWARE key.
|
|
|
|
|
I just ran into that with running dsim, seems there's 2 of them.
I'll look into that!
Thanks
|
|
|
|
|
I didn't know that Any CPU had 2 different views of the registry, and calling programs like DSIM.
So I got that part working now for file execution and registry, but even elevating the UAC didn't allow me to edit that value and add a key.
Thanks for pointing that out to me!
|
|
|
|
|
Well I got 80% of what I wanted. Deployed it today on 14 machines. Just took 30 minutes.
The console program was a good experience for me. At least removing the updates was easy.
|
|
|
|
|
|
can I kowth the way to make slide panel dotnetbar tutorial c#
sliding pannel effects.... 
|
|
|
|
|
What's a dotnetbar?
This space for rent
|
|
|
|
|
An Internet Cafe in Yorkshire?
(Do T'Net Bar)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I'm trying to work out why here, but I am stuck and also have no GoogleFu luck on Friday
I have a datagridview which I attach a combo box to a specific cell with the following code.
private void dg_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
DataGridView dg = sender as DataGridView;
DataGridViewComboBoxColumn combo = dg.Columns[0] as DataGridViewComboBoxColumn;
LogManager.Instance.Logger("Policy SI").Info("Edit Control Showing");
if (dg.CurrentCellAddress.X == combo.DisplayIndex)
{
LogManager.Instance.Logger("Policy SI").Info("We have a combo");
cb = e.Control as ComboBox;
if (cb != null)
{
cb.SelectedIndexChanged -= new EventHandler(cb_SelectedIndexChanged);
cb.DropDownStyle = ComboBoxStyle.DropDown;
cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
}
}
}
the SelectedIndexChanged event takes a copy of the selected value's text.
private void cb_SelectedIndexChanged(object sender, EventArgs e)
{
originalDescription = cb.Text;
}
This works great, for all the grids that the edit control showing event is subscribed too, but while tracing another problem I have noticed that when I am getting the row out of the combo box's datasource which is a bindinglist and reading the information to pass back to the database. with the following simplified event below. Each property that I read then fires the selected index event of the combobox.
private void dg_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
DataGridView dgB = sender as DataGridView;
if (dgB.CurrentRow.IsNewRow == true)
{
LogManager.Instance.Logger("Policy SI").Info("New Row ");
return;
}
if (e.ColumnIndex == 0)
{
LogManager.Instance.Logger("Policy SI").Info("Validating Col 1");
string newDescription = string.Empty;
newDescription = e.FormattedValue.ToString();
quoteTemplate = valuablesBinding.FirstOrDefault(p => p.Description == originalDescription || p.Description == policySumInsured.Description);
policySumInsured.ItemNo = (int)quoteTemplate.ItemNo;
policySumInsured.Description = quoteTemplate.Description;
policySumInsured.Section = quoteTemplate.Section;
}
else
{
if (e.ColumnIndex == 1)
{
}
}
}
Hopefully this all makes and sense and someone could possibley shed some light on why it keeps firing the cb_selectedIndexChanged event.
Thanks
Simon
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Maybe (probably) the following Setters
Simon_Whale wrote: policySumInsured.ItemNo = (int)quoteTemplate.ItemNo;
policySumInsured.Description = quoteTemplate.Description;
policySumInsured.Section = quoteTemplate.Section;
cause INotifyPropertyChanged to be called, and (depending on the chain of events that are raised afterwards) this affects your binding list and/or cb.SelectedIndexChanged.
...just a guess...
|
|
|
|
|
Hello Fellow Coders
I need your assistance on how I can copy files from one of our servers on the network to folders on two other servers on the same network.
Please provide sample code if possible
|
|
|
|
|
So basically, you want us to write your code for you? If we provide assistance, shouldn't you be able to do that by yourself?
There are many ways, and they all depend on what you are trying to achieve. You could use FTP. You can use shared paths to copy to (a really bad idea). You can use something like TCP with a client/server infrastructure. Without knowing more about what you are trying to copy and what the constraints are, it's hard to be any more specific than that.
This space for rent
|
|
|
|
|
Thanks Pete for the quick Response
With some assistance I will be able to do it myself.
With this below Line of code(in vb.net) I am able to copy files from one server to another.The issue is that this copy all Files that are in the source directory folder to destination folder while i just want specific files with extension .txt
below is the code am using
My.Computer.FileSystem.CopyDirectory("\\192.16.0.15\c$\Txxx\", "\\192.16.109.176\D$\d", True)
Is there a way I can be able to just copy only text files and after copying I move the files copied to a backup folder and then delete them
In Vb.net or C# is okay for me
Thanks in advance
|
|
|
|
|
You'd effectively need two operations. The first one is to use Directory.GetFiles[^] to get all the files in a particular directory (or directory structure) that have the .txt extension. Then you would need to iterate over each filename and use File.Copy[^] to copy the files over.
This space for rent
|
|
|
|
|
Hello Pete,
Thank you so much for your Assistance
I am working on your proposed solution and will let you know
|
|
|
|
|
Thanks Pete,
It worked perfectly.Also I realized the folder I was trying to copy from wasn't shared.
Thanks again
|
|
|
|
|
Nicely done.
This space for rent
|
|
|
|
|
I am trying to communicate with a TurnStile but cant understand how that build their commands.
This is example of command:
[^]
The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards?
CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result.
Anyone can help me with that CRC15 calculation?
Regards // Maw
|
|
|
|
|
MaWeRic wrote: Is that really correct? Shouldn't it be A0 05? Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all that weird.
As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..)
You should be able to plug that in already available crc code.
|
|
|
|
|
HeyyThanks!
If I try this calculator :
[^]
I try calculate : 05A0
Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that?
Edit: I guess I should send it as 1F4A as documentation says?
I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn
I goggled Little and big endians and I guess little endians means sending reversed order?
//Henrik
|
|
|
|
|
Yes that's probably little endian again.
|
|
|
|
|
Hello,
I am using 'FileSystemWatcher.enableraiseevents' to get the events when a directory, or file in a directory changes.
Initially I have enabled the component and was working properly.
After some time it stopped detecting events, when I check the 'EnableRaisingEvents' it was set to 'False'. In my code I am not setting it to false anywhere.
Is there any possibilities that 'EnableRaisingEvents' sets to 'False' automatically ?
Or what is the cause for my error ?
Please help me.
|
|
|
|