|
Thanks Heath for your reply.
I have gone through the CAS article you had suggested. It is very informative. However, I have to still go through it a couple of times before I can digest.
The impression I got is that CAS is for stopping unauthorized user to execute the code. However, the problem I have been facing is at design time. For the problem to be easily understood, I have created a small project. I am attaching a zip file of the project. This project successfully compiles. You can execute the same. But to observe the current problem, do the following:
Open the solution in VS 2003. This contains a Test project. This contains three forms - FrmMain, CSIBaseForm, FrmUser. FrmUser inhertis from CSIBaseForm which in turn inherits from System.Windows.Forms.Form. I double click on the FrmUser form to view it in design mode. It does not show.
Could you tell me what the problem is and what I should do to overcome it?
There does not seem to be a way of attaching the zip file here. I shall send it directly to your e-mail address.
Thanks.
|
|
|
|
|
I wish to find a general method for retriving fan's properties such as speed as well as CPU temperature, how could I go about doing it?
I tried to use win32_fan but it doesn't give me back anything.
|
|
|
|
|
Please post some sample code for how you used Win32_Fan. It's also possible that your drivers don't expose data correctly for the WMI class to view. You need to be sure your motherboard drivers are installed correctly and that they even expose the data you want. If they don't, there may be no practical way of getting it, short of knowing the details specs for the fan and writing assembler to get such information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
This is the coding I used... I work fine for other properties such as processor though.
ManagementObjectSearcher Fan = new ManagementObjectSearcher("Select * from Win32_Fan");
foreach(ManagementObject item in Fan.Get())
{
Text.WriteLine("<activecooling> {0} ",item.GetPropertyValue("ActiveCooling"));
Text.WriteLine("<description> {0} ",item.GetPropertyValue("Description"));
Text.WriteLine("<deviceid> {0} ",item.GetPropertyValue("DeviceID"));
Text.WriteLine("<name> {0} ",item.GetPropertyValue("Name"));
Text.WriteLine("<status> {0} ",item.GetPropertyValue("Status"));
Text.WriteLine("<variablespeed> {0} ",item.GetPropertyValue("VariableSpeed"));
Text.WriteLine("");
}
|
|
|
|
|
When you step through (debug) your code, do you get any results with Fan.Get() ? If not, then the problem is as I suspect: information about your CPU fan is not available.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I didn't get anything... I had tried with some other freeware program too but it didn't come up, perhaps it is like you said that the information is not available, however I had tried with several other computer and it didn't come up.... should I do programming on bios level or something like that?
Thank yah,
|
|
|
|
|
That may not help. The fan itself just may not provide any sort of metrics. I recommend you crack open the case, remove the fan carefully if necessary, and get any information off of it you can - like make, model, etc. See if you can find any hardware specs for it on the manufacturer's site before you start with low-level programming that 1) can be complicated, and 2) really isn't a job for .NET at this point. Sure, you could P/Invoke lots of APIs and define lots of structs and enums for interop, but 1) it would be specific to your fan (otherwise the Win32_Fan WMI class would probably give you what you need), and 2) may not work anyway because the fan itself doesn't provide metrics.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank a lot for your help...
Too bad that I am using a laptop and doesn't want to mess around with cracking it too much, I am really bad at assemble things back.
Thank you,
|
|
|
|
|
Ah, if it's a laptop I wouldn't recommend it. Most desktops are easy to open, often times with just the click of a button. Sorry.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a simple Win Forms app that has a data grid on it. I have an access database with a Date/Time field in it that have values like 10/21/2004 10:32 PM. When the data is displayed in thr grid it comes out with just the date. I have tried adding a table style with the format specifier as {0:f} and {0:F} at design time and runtime with no change. I have done this same thing with SQL as the backend and have not had this problem. Has anyone else encountered this?
|
|
|
|
|
The DataGridTextBoxColumn.Format property takes a format specifier without the curly braces and without the indexer, so that you'd specify just "f" or "F". Read the documentation[^] for the property for more information.
If that doesn't work, make sure that the DataGridTableStyle.MappingName matches the DataTable
(or class name if binding against an array of types...just FYI) whether your set DataGrid.DataSource to a DataSet or a DataTable . It is far more robust, BTW, to bind a DataSet and set the DataGrid.DataMember to the table name.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for the info. Changing the format specifier to just f do not fix it, but your suggestion for the mapping name did the trick. Thanks!
|
|
|
|
|
|
Can you explain what you mean by a "UI thread" please?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
User Interface thread. Not Worker thread.
|
|
|
|
|
Alex_Y wrote:
User Interface thread. Not Worker thread.
When you create a Windows Forms application and run it, it always has a UI thread. Otherwise your application wouldn't be able to handle any UI-related events (see also Multithreaded Windows Forms Control Sample[^]). Besides having a message queue[^] and owning windows[^] it is just a normal thread and you should normally not need to create another thread with a message pump (although it is possible by calling Application.Run()[^]). If you want to manipulate the UI from a thread other than the UI thread to need to marshal the call to the UI thread (see Updating the UI from a Secondary Thread[^]).
Best regards
Dennis
|
|
|
|
|
I am little confused. How I can use resources in C#. I want to have some file where like in *.rc I can put all my strings. I do delopment for several languages.
Thanks
Alex.
|
|
|
|
|
.NET uses .ResX files by default, but the system is flexible and extensible. I encourage you to read Resources in Applications[^] in the .NET Framework SDK. This explains how to create .ResX files (XML files, which can also describe more than just strings by any string-convertible type), compile them (resgen.exe), and use them (the ResourceManager class, or a derivative).
You should also read Working with Resource Files[^] in the Visual Studio .NET product documentation that describes how VS.NET makes it easy to localize your libraries and applications.
Some improvements are being made for Visual Studio 2005. Read my blog entry[^] for details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks. I just thought that there is something which build in IDE like resource view in VS6.
Thanks.
Alex
|
|
|
|
|
|
In c and c++, i can use the shell function
UINT WinExec(
LPCSTR lpCmdLine,
UINT uCmdShow
);
to execute an application, open files and even open URL
is there an equivalent method i can use in .NET for c# that i can use?
|
|
|
|
|
Check out the Process class and it's Start method
|
|
|
|
|
|
Hello,
In a windows application I want to save the users username and password to remember in subsequent openings.
Where do you recommend me to stare the information. In registry or isolated storage??
|
|
|
|
|
cezeri wrote:
In a windows application I want to save the users username and password to remember in subsequent openings.
Is there only one user of the software per machine? Then I think isolated storage is better. If there are multiple users, then possibly the registry, under CurrentUser.
Are you encrypting the username and password, wherever you store it?
And I guess this begs the question, why have a separate login for your application, rather than using windows authentication? I mean, if the user has successfully logged in to Windows, why does he need to log in again to your app?
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|