|
I believe its possible. It depends if your hardware supports it though.
Yes Win32_TemperatureProbe is the correct place to start with. More information can be obtained here: MSDN[^]
If you need further help with something specific please ask.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
In addition to what Alex said, most motherboard manufacturers DON'T supply WMI providers for the chipset probes (temp, fan speed, ...).
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ok, that's why I have 0 item when I query the interafce.
maybe my motherboard does not provide WMI interface.
There is no spoon.
|
|
|
|
|
It's not the motherboard, but the drivers for the motherboard. You might want to check with the manufacturer to see if they offer any WMI Providers.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm attempting to write a "SQL Replication Watcher".
Basically I need to link into SQL somehow and determine 4 things:
1 - Is replication currently enabled
2 - Is replication currently active
3 - Are there changes on my machine waiting to be pushed
4 - Are there changes on the server waiting to be pulled
Assume that the subscriber/publisher relationship is already established and the SQL connection is completely reliable. I'm looking for very basic (ie: easy to follow) information here.
Thanks in advance!
Z - I never met a proof of concept I didn't like.
|
|
|
|
|
You should have posted this question in SQL forum. C# forum is for C# only.
As you might know replication is done through SQL Agent. There are programmatic interfaces available for controlling replication - I believe its an ActiveX lib. Google for it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
But since I'm writing it in C#, and the SQL forum is going to be primarily people familiar only with SQL (and therefore not C#) this would end up being the appropriate place.
I'll see if I can find anything using the information given. Thanks.
|
|
|
|
|
No it wouldn't. You asking about funcitonality specific to SQL Server. It doesn't matter what language your writing your tool in. Any language you use is going to use the same SQL Server Replication API.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am creating a UserControl that is a collection of Panles setup in a grid format. Each element of the grid is a Panel. I allow the user to add text to the panel in one of Nine locations described by the ContentAllingment Structure.
The Text object is nothing more than a Label control. I'm using a gradient brush to paint the background of each panel in the grid and am setting the background color or each Label control to transparent. My problem is on the initial paintof the control, all the grid boxes are transparent until I move the window or resize the control. If I choose to not set the Label control's background property to transparent, then all the Panels get painted correctly, but the Label controls llok bad because they have a flat backgournd color while it's parent Panel gas a gradient background color. My question is, why would nothing be getting painted until the control is resized or moved.
Here is the OnPaint handler override
protected override void OnPaint(PaintEventArgs e)
{
try
{
LinearGradientBrush brush;
brush = new LinearGradientBrush(
ClientRectangle.Location,
new Point(ClientRectangle.Left,ClientRectangle.Bottom),
this.BackColor,
ControlPaint.Light(this.BackColor));
e.Graphics.FillRectangle(brush, ClientRectangle);
brush.Dispose();
foreach(PanelLabel PL in LabelArray)
{
PanelLabel lb=null;
bool LabelFound=false;
foreach(Control ctrl in this.Controls)
{
if(ctrl is PanelLabel)
{
lb = (PanelLabel)ctrl;
if(lb!=null)
{
ContentAlignment CA = (ContentAlignment)lb.SimpleLocation;
if(lb.Text==PL.Text && CA==PL.SimpleLocation)
{
LabelFound=true;
break;
}
}
}
else
continue;
}
if(!LabelFound)
{
lb = new PanelLabel();
lb.Font=new Font(lb.Font,PL.TextStyle);
lb.Text=PL.Text;
lb.SimpleLocation=PL.SimpleLocation;
lb.BackColor=Color.Transparent;
}
lb.Bounds=SetLabelLocation(lb,PL.SimpleLocation,e.Graphics);
if(lb.Bounds!=Rectangle.Empty && lb.Bounds!=ClientRectangle)
this.Controls.Add(lb);
else
throw new Exception("Label bounds are empty");
}
base.OnPaint (e);
}
catch(Exception Err)
{
MessageBox.Show("On Paint Error:"+Err.Message);
}
}
Any ideas are appreciated
|
|
|
|
|
Don't I know I understood if well the problem, but and if you force the shot of the event?
protected override void OnResize(EventArgs e)
{
base.OnResize (e);
using (Graphics g = this.CreateGraphics())
{
this.OnPaint(new PaintEventArgs(g,
this.ClientRectangle));
}
}
protected override void OnMove(EventArgs e)
{
base.OnMove (e);
using (Graphics g = this.CreateGraphics())
{
this.OnPaint(new PaintEventArgs(g,
this.ClientRectangle));
}
}
Marcelo Palladino
Brazil
|
|
|
|
|
(DR["Name"] is DBNull) vs (DR["Name"] == DBNull.Value)
I am curious as to which has better performance?
Thanks.
|
|
|
|
|
Neither. DBNull is a singleton class, the sole instance of which is returned by DBNull.Value . The code generated by the is and == operators is exactly the same.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello all
I need to search about space in string i tryed indexof but i dont know the space Code.how can i do this
regards
Hay
|
|
|
|
|
int index = mystring.IndexOf(" ");
Charlie
if(!curlies){ return; }
|
|
|
|
|
I want to drag and drop files onto my usercontrol. I want to know which eventhandler to write in this case and how to get file info in that handler?
Help please
|
|
|
|
|
This is a very simple thing to accomplish. Have you searched MSDN??
Some helpers:
Control.AllowDrop - Gets or sets a value indicating whether the control can accept data that the user drags onto it.
Control.DragDrop Event - Occurs when a drag-and-drop operation is completed. The event handler receives an argument of type DragEventArgs containing data related to this event. One of the properties of DragEventArgs is Data. Use it to get the IDataObject that contains the data associated with this event. Check for file drop, and use...
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
}
Just look at this:
MSDN link[^]
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi,
A few years back I read somewhere that websites should be designed to work with 800x600 resolution monitors. I, at the time, thought that this was a good idea, and used the same pattern in my software. It made sense to design software so that everyone can use it, including those that have older PCs and smaller monitors. However, as I am far along in my current project, I am running into problems. The biggest of these is that I'm running out of space on the screen to display items. And, if the user is using a larger resolution, when they maximize the program, there is a lot of empty screen (for example my laptop's res is set to 1680x1050. A big difference from 800x600!) Perhaps it would be ok to design it to be optimized at, say, 1024x768? In that case those users with the lower resolution would just see scroll bars. My question is:
Is it ok to design software optimized on 1024x768 res and higher?
It sure would make a lot of things easier.
Thanks for your help.
Agent 86
|
|
|
|
|
You have to make sure you application is flexible for any size. Almost every decent computer out there support 1024x768 and higher. However, many user prefer to set their display to 800x600 - dont ask me why. Don't forget that a lot of people (like me) that like higher resolutions.
.NET has support for anchoring and docking. Make sure you use those properly correctly. Your application should support a variety of screen resolutions.
Agent 86 wrote: The biggest of these is that I'm running out of space on the screen to display items.
To avoid cluttering problems use collapsible panels and tab controls.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi,
I want to build a C# utility that will show a list of computers connected to a particular DCOM server. The DCOM server and clients are all written in C++.
This utility could be launched on any client or the server, and be able to tell which client's were connected to the server. I'm hoping that the server keeps a list of active DCOM connections that it has, and its something that I could read up and display in a GUI.
Any ideas on if this is possible, without resorting to packet sniffing to find out which clients are connected?
Thanks,
Kevin
|
|
|
|
|
I tried to work with the Eventpool (http://www.codeproject.com/csharp/EventPool.asp).
But I have a problem with the debugger:
...
Delegate[] delegates = del.GetInvocationList();
foreach(Delegate sink in delegates)
{
try
{
sink.DynamicInvoke(args);
}
catch(Exception e)
{
Trace.WriteLine(e.Message);
throw(e);
}
}
...
The following code is in another project:
...
private void method1(object sender, EventArgs e)
{
System.Diagnostics.Debugger.Break();
Console.WriteLine("I was in method1");
}
...
Method1 will be called by the delegate. And it works!!! You can see the text at console. But the debugger don't stopp at the line "Console.WriteLine("I was in method1");", where a breakpoint was set.
Then I tried the line "System.Diagnostics.Debugger.Break();". Now the program stops at "sink.DynamicInvoke(args);". The line is green. It seems as if the debugger can't find the sourcecode for method1.
|
|
|
|
|
This question is article specific. You might get a better answer if you post your question there.
Generaly you need to make sure that you have application in debug mode (same goes for all the other assemblies that are loaded). Also makes sure that you have latest build of all assemblies - otherwise your lines might not match up.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
In addition to what Alex Said, also make sure the assembly you are trying to debug actually what you are debugging. The assembly Debug Mode (in the project properties -> Configuration Properties -> Debugging -> Debug Mode) needs to be set to the 'Wait to attach to an external process' option. , The 'Start Application' should be the name of the 'caller' .exe. If the assembly is in the same solution as the 'caller', then it needs to be the active project in the solution.
You should also try to make sure that the assembly you are debugging is only running in a single thread (ie. the 'caller' has only instantiated one instance of the class within the assembly) for testing purposes. Otherwise you'll find that the breakpoint will get hit multiple times (hitting the F10 key to step through the code will result in you ending up on your breakoint again - albeit in a different instance)
Hope this helps,
Stefan
|
|
|
|
|
Thanks for the aswers, but it still does not work.
I had forgotten to write:
When I call the eventshelper directly, the debugger is doing fine.
When I call the eventshelper with the eventpool, the debugger don't stopps.
|
|
|
|
|
I created a Web Service that has a method that takes string arrays for ex:
public void CalculateModel(string[] stringList1, string[] stringList2)
{
//code here
}
When I add this web service as a web reference to my C++ application it generates a proxy class, in the proxy class it displays the array parameters like this:
BSTR* stringList1, int __stringList1_nSizeIs,
BSTR* stringList2, int __stringList2_nSizeIs,
Then it does the following: checks these pointers for NULL
if ( stringList1 == NULL )
return E_POINTER;
if ( stringList2 == NULL )
return E_POINTER;
So my question is how do I prevent the proxy file from adding these checks for NULL? because I do allow the user to pass in an empty string array which is defaulted to NULL on the C++ side.
Thanks
|
|
|
|
|
A check for NULL isn't going to hurt you, is it? It doesn't look like the wsdl.exe tool has an option like this.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|