|
Thanks a lot everyone.
I got my answer and now I can successfully see service in windows service.
Once again
Thanks
|
|
|
|
|
hi
i want to open a new window and send a url address to it for browsing.
wat can i do?
** some thing like href tag with target=_blank **
thanks
|
|
|
|
|
If you mean from a web page, you can't do that. Please ask in the Web Development[^] forum.
If you are automating Internet Explorer (perhaps using the AxWebBrowser control or the InternetExplorer class), you can call Navigate2 with the correct parameters like so:
object url = "http://mydomain.com";
object name = "_blank";
object missing = Missing.Value;
axWebBrowser1.Navigate2(ref url, ref missing, ref name, ref missing, ref missing); If neither of these answer your question, please be specific in your request. Your question is, I must say, rather vague. Please provide as much information as you can that's relevant to your problems and questions.
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 to agree that your question is rather vague.
In case you are talking about automating IE from a windows form you could also take a look at the System.Diagnostics namespace. A couple of straight-forward examples:
Example 1:
Process.Start("IExplore.exe", "www.codeProject.com");
Example 2:
ProcessStartInfo <code>startInfo </code>= new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.codeProject.com";
Process.Start(startInfo);
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi,
I am trying to get the windowstate of a window based on its process id.
Below is what I tried... But the GetWindowPlacement method returns false most of the times inspite of the length of the windowplacvement object being initialized. Even if the method returns true, its showCmd is always NORMAL. While testing my window was always MAXIMIZED!
Can anyone point what I am missing...?
Can anyone explain how the window state is maintained. ......
Thanks!
FormWindowState GetWindowState(int processID)
{
FormWindowState formWindowState = FormWindowState.Normal;
WINDOWPLACEMENT windowPlacement = new WINDOWPLACEMENT();
//If there is not proces by this ID, then return Minimized.
uint processHandle = (uint)Process.GetProcessById(processID).Handle;
if ( processHandle.Equals(0) )
{
return FormWindowState.Minimized;
}
windowPlacement.length = Marshal.SizeOf(windowPlacement);
bool test = Win32Wrapper.GetWindowPlacement(processHandle,ref windowPlacement);
if ( windowPlacement.showCmd == SHOW_STATE.SW_SHOWMINIMIZED )
{
formWindowState = FormWindowState.Minimized;
}
else if ( windowPlacement.showCmd == SHOW_STATE.SW_SHOWMAXIMIZED )
{
formWindowState = FormWindowState.Maximized;
}
}
|
|
|
|
|
Sheela Krishnan wrote:
I am trying to get the windowstate of a window based on its process id.
Below is what I tried... But the GetWindowPlacement method returns false most of the times inspite of the length of the windowplacvement object being initialized. Even if the method returns true, its showCmd is always NORMAL. While testing my window was always MAXIMIZED!
Assuming that Win32Wrapper.GetWindowPlacement() indeed does only encapsulate the native Win32 call, you're simply passing the wrong value. GetWindowPlacement()[^] expects a handle to a window, not to a process. If you're interested in the state of the main window of a process you can use the Process.MainWindowHandle Property[^] to obtain the correct handle.
Best regards
Dennis
|
|
|
|
|
Why when I deriving my own TabControl I am loosing ability to drop other controls from the toolbox on my derived tab control in design mode. Same thing if derive may PropertyPage. In MFC I was able create several dialogs in design mode than dynamicaly connect them to the PropertySheet. How to do somthing similar in C#.
Thanks
Alex.
|
|
|
|
|
Alex_Y wrote:
Why when I deriving my own TabControl I am loosing ability to drop other controls from the toolbox on my derived tab control in design mode.
Hmmm. I thought the only thing you can do with a TabControl is add TabPages. Then you can drop controls onto the TabPage.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
What if want to derive my own Pages? My question is true if deriving TabControl and/or Pages after that I can only manualy create/locate controls on the pages. Because may be I missing something. Why design mode can't handle derived classes. I could understand when control is simple like editbox on which I don't need to drop anything, but in TabControl main purpose is to hold other controls.
Thanks,
Alex.
|
|
|
|
|
Alex_Y wrote:
What if want to derive my own Pages?
Ah, ok. Then, you'd have to implement in your derived class the class and property attributes that are required to support the designer. However, I suspect you'll still run into problems because I don't know how you can tell the designer to add your tab pages and not the TabPage class. I guess that's a question for someone who knows the designer really well.
Still, it seems that if you make your MyTabPage class designer compliant and add it to the toolbox, you should be able to drop them onto the TabControl.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Also I noticed anything you drop on MyTab it became not a member of MyTab it always became a member of form which hold's MyTab.
Other issue if I create MyTab and manualy add MyPage after that in form design you can't drop on that page it is locked, but if you add another page which is not MyPage type it is no problem to drop on that default type page.
While I play with all that experiments designer was always trying to analyze content of MyTab and recreate all content one more time in the Form class. So as result I got instead of two pages which I had in MyTab but four two from Form + two from MyTab.
Thanks.
Alex
|
|
|
|
|
Hi... i am a student and i am currently working on an Address book in C#. The address book is supposed to create a fancy business card and then save it to a JPG file. The business card is created in the program within a panel with a background picture and transparent textboxes. I would like to make an option for the user to let them save the business card to a JPG file. is that possible? As mylecturers couldn`t help me about this.
Thanks
|
|
|
|
|
You mean you want to take a screenshot and not have to generate the picture yourself? Either are possible. To take a screenshot of a particular client region of a control (or even the whole control), you need to P/Invoke bitblt from gdi.dll and related functions. Read Image Capture[^] for more information, or search[^] for "bitblt" or "screenshot" here on Code Project in the appropriate categories (like "C#" and ".NET").
In .NET 2.0, a new method[^] - Control.DrawToBitmap - has been added which will make this easier (by encapsulating the functionality from above).
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 would like a place holder class btween my Screen Form and Windows Form. So, I create MyBaseForm class that inherits from System.Windows.Forms.Form. Then I create MYScreenForm class that inherits from MyBaseForm. However, at design time, I am not able to see the MyScreenForm. It gives the following error:
Request for the permission to type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeytoken=.... failed.
Thus, I am not able todesign my screen visually.
Note that I can place any controls programmatically and the code compiles and runs.
Appreciate any explanations / help
|
|
|
|
|
From where is your code running? A FileIOPermission is a code access security permission class that is granted, by default, to all code run from your machine. If your code is running from the intranet or Internet, it is granted even fewer permissions.
For a good overview of Code Access Security in .NET, read Understanding .NET Code Access Security[^] here on Code Project.
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]
|
|
|
|
|
The application is not even running!
This error occurs at design time in the Visual Studio. Both classes -- MyBaseForm and MyScreenForm -- are in the same project. In the Solution explorer I click on the MyScreenForm (which inherits from MyBaseForm) to view it in design mode in order to add some controls. Instead of showing the form, this error appears.
Thanks
|
|
|
|
|
But the code is running, actually. Notice that when you try to create an inheritted form VS.NET will complain if the assembly that contains the would-be parent form is not compiled yet?
If your target location for the assembly is on a network share, for example - even if the drive is mapped - you will most like get a SecurityException because the FileIOPermission isn't granted, by default, to anything but FullTrust code which is only given, by default, to the "My Computer" zone.
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 Heath,
When I wrote "It is not even running" I meant I did not even execute. Yes, it is running.
The problem I am referring to occurs at design time - not at run time. Since I am not executing the code, I thought the IO error should not have occured. However, VS IDE probably is trying to execute the MyBaseForm code so as to display the form in design mode. So, this morning I changed the security to FullTrust - for the module that contains MyBaseForm. However, when tried to view MyScreenForm in design mode, it still did not work.
Request help.
Thanks once again.
Snnn
|
|
|
|
|
Again, the code is actually executing in design mode and serializes to a source file. Depending on what yo'ure trying to do an when, Code Access Security can prevent an application from running (it verifies that an application has the necessary minimal permission set) or from performing a certain action while running (if you demand a certain permission).
Please read that CAS article I posted in my previous reply.
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 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,
|
|
|
|