|
|
For some reason the forward and back buttons on my mouse don't work when I embed the AxWebBrower control into a windows forms project. I am using Visual Studio 2003 and framework 1.1.
The mouse buttons work with IE so I know that the problem is not the mouse...
I've tried catching the onclick and onmousedown events but have had no luck.
Does anyone out there know how to get this to work?
|
|
|
|
|
hello,
i want to get access to an actual shown html page in the internet explorer. does anyone know how i can realize this or give me some keywords i have to search at google?
i want to read the html page and then dynamically change the shown content. maybe this could be made with com?
thanks for some help!
|
|
|
|
|
Use tlbimp.exe to create a COM interop assembly from shdocvw.dll, or - in VS.NET - right-click on your project and click Add Reference. Click on the COM tab and find "Microsoft Internet Controls". Double-click to add an interop assembly to your project. Also repeat this process for mshtml.dll, or "Microsoft HTML Object Library". Add the following to the top of your source file:
using SHDocVw;
using mshtml;
In your code, instantiate the InternetExplorerClass , which will either create a new instance of IE if one doesn't exist or use an existing instance. Cast the Document property to IHTMLDocument2 (typically, which implements most properties and methods you're probably interested in) and walk the DOM similar to how you would in DHTML scripting (although you'll have to cast objects to certain interfaces at times, since different versions of interfaces implement different properties and methods.
InternetExplorerClass ie = new InternetExplorerClass;
IHTMLDocument3 doc = ie.Document as IHTMLDocument3;
if (doc != null)
{
IHTMLElement e = doc.getElementById("table1");
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello:
I have a class where I’m using session variables, notwithstanding when I compile Project it’s sending me this error: “Name ‘session’ doesn’t exist in class or namespace ‘WUC_CreDes.Class1’”.
Does it mean that it is not permitted to me using session variables into a class?
This is my code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WUC_CreDes
{
public class Class1
{
public static bool No_PostBack()
{
Session["par1"] = "";
return false;
}
}
}
Thank you in advance for your help.
A.L.
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
It's not possible to do what you're trying to do. The Session property is a member of the System.Web.UI.Page class.
In order to have access to the Session maintained between IIS and a client's browser you need a class that inherits from the System.Web.UI.Page. Further, it needs to be running in IIS to handle the application request and maintain the communication to the client.
Your code should look like this at the top:
<br />
public class Class1 : System.Web.UI.Page<br />
{<br />
....<br />
|
|
|
|
|
I knew it.
And it's not working
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
Actually, session is part of the HttpContext the page property is just a reference to that.
HttpContext.Current.Session should give you the session for that request as long as you are running in an ASP.Net environment.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Thanks you Andy.
Now it’s working.
Instead of:
Session["par1"] = "";
I use
HttpContext.Current.Session["par1"] = "";
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
I am having a problem to print a correct size. I tried to use PrintPreviewCtrl(for print preview) and it showed perfect size on preview that I wanted. But when I tried to print and it went to shrink itself. I cant figure it out what did it went wrong. I tried different methods but no luck!!!
public void CustomPreviewDialog()
{
printPreviewDocument = new PrintDocument();
printPreviewDocument.DefaultPageSettings.Landscape = false;
PrintPreviewCtrl = new PrintPreviewControl();
PrintPreviewCtrl.Enabled = true;
PrintPreviewCtrl.AutoZoom = true;
PrintPreviewCtrl.Name = "Detail Preview Page";
PrintPreviewCtrl.Dock = DockStyle.Fill;
PrintPreviewCtrl.UseAntiAlias = true;
PrintPreviewCtrl.StartPage = 0;
panelPrintPreview.Controls.Add(this.PrintPreviewCtrl);
PrintPreviewCtrl.Document = printPreviewDocument;
PrintPreviewCtrl.Document.PrintPage += new PrintPageEventHandler(Part_PreviewPage);
PrintPreviewCtrl.Document.Print();
}
private void Part_PreviewPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
if(m_printSurfaceViewList.Count <= 0 )//it tell you how many lists
{
return;
}
e.HasMorePages = true;
if(m_nPage < m_printSurfaceViewList.Count)
((CSurfacePanelViewCtrl)m_printSurfaceViewList[m_nPage]).SurfacePanelView.DrawPrintView(e.Graphics);//CSurfacePanelViewCtrl is a panel with using control form
m_nPage++;
if(m_nPage > m_printSurfaceViewList.Count-1)
{
e.HasMorePages = false;
}
}
|
|
|
|
|
When my program starts, I want to check if it's already running. If it is running, I want to show it and bring it to the foreground. I know multiple ways of checking if my program is already running by using the Process class or Mutex class. However, my main problem comes when trying to get my program to show itself.
I'm using a NotifyIcon and ShowInTaskBar is set to false. When my program is minimized to the system tray and the second process starts and uses the Process class to get the MainWindowHandle of the 1st process, it returns 0. I experimented with it and found that if I kept my program in the taskbar by setting ShowInTaskbar to true, it would have a non-zero MainWindowHandle I can use. But, I don't want it in the taskbar.
So, how can reactivate my already running program if I try to start a 2nd instance of it when the MainWindowHandle is 0? I probably could save the window handle to a file (suck!) and use it when a second instance starts.
Help please?
|
|
|
|
|
There are 2 ways I would go about this:
The graceful way would be to use remoting. In your code that checks for a single instance you would set up remoting to communicate with the running instance of your program and call a method in that instance to bring itself to the foreground. Remoting is ideal for communicating locally across application and process boundaries. The only drawback is that you need a network card to avoid problems.
In the case that you can't guarantee your client's will have a NIC you can use Windows API. You need to call the Activate Window API.
Here's a quick intro into that API.
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=711
|
|
|
|
|
I need to have a timer that halts my program for 2 seconds (2000 milli secs). I have a GUI program calling a class which is firing my custum events. I need to stop the program for 2 seconds after each event..and resume soon after the 2 seconds. does any one have a clue
Thanks...
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
Create a timer in your class. You'll to subscribe to the timer's Elapsed event and have code to start and stop the timer.
<br />
class MyClass<br />
{<br />
<br />
System.Timers.Timer _timer;<br />
private void SetupTimer()<br />
{<br />
_timer = new System.Timers.Timer(2000);<br />
_timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);<br />
}<br />
<br />
private void PauseApp()<br />
{<br />
_timer.Enabled = true;<br />
}<br />
<br />
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)<br />
{<br />
_timer.Enabled = false;<br />
}<br />
<br />
}<br />
|
|
|
|
|
Guys this code is great for what I'm trying to do - basicly I have a for loop, and I need a timed pause in execution inside the loop - I'm trying to implement this code, but I don't know how to subscribe to the elapsed event, or start/stop the timer.
I appreciate anything you can add!
Thanks in advance,
Joe
|
|
|
|
|
u can be ease use the threads in this thing
using System.Threading;<br />
and in timer Elabsed event or tick event just place this line Thread.Sleep(int milli second);<br />
Thread.sleep(2000);
ByMindOnlyYouCanDoIt
|
|
|
|
|
You shold not do that. It's a bad idea. If you call Thread.sleep(...) you'll lock up the main thread (probably your UI thred) for 2 seconds. You should NEVER break a user's access to your main thread for long running processes, especially in this case where it happens often as in your post. If you do, your app will seem to lock up to the user. Instead, if you use the timer with threading you will prevent the main thread from being locked, and you have the ability to enable and disable specific items (buttons etc...) accordingly. You always want to allow user interaction, even if you have to lock down controls and there's nothing enabled to interact with.
|
|
|
|
|
Doesn't the System.Threading timer start on a new thread itself?
/\ |_ E X E GG
|
|
|
|
|
Yes, when you create a new thread. That's not true when you call Thread.Sleep(...). That takes action on the thread from which the code is executed.
|
|
|
|
|
First and foremost, thanks for helping out.
The System.Threading in my case is a little out of question, since the user will be observing the UI for information from a (particularly compute intensive) class. Halting the main thread for 2 seconds would make it even more slower. Timers make more sense. However how much I tried before, I couldn't even make them work....Now its OK..thanks to you guys
Thanks!!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
Hello everyone,
I wrote a little application designed to lay some crucial data on Top of all other Windows. Basically, I am using a window with FrameBorderLayout.None and a single Label which is updated regularly. Frame and Label have a White background and the TransparencyKey is set to White.
For me, this is perfect - I lose only very little space on my Desktop, no additional entry in my Taskbar and still I get all the info necessary.
There only is ONE drawback: Some mechanism is applying anti-aliasing to my label's text, which is quite disturbing.
Is there any way to disable anti-aliasing (I tried turning it off in the display properties, which did not solve my problem) or another approach to get "Text only"?
Cheers
Sid
|
|
|
|
|
You can draw the text on the Label yourself. Handle the Paint event of the Label - or, better yet, extend the Label class and override OnPaint for even more control. Set the Graphics.SmoeethingMode to SmoothingMode.None and draw the text yourself:
public class TextLabel : Label
{
public TextLabel()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer |
ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.None;
g.DrawString(Text, Font, new SolidBrush(ForeColor), new PointF(0f, 0f));
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi all
I was wondering if there's any limit to the windows controls? I recieve the following error "Error creating window handle." while trying to databind a treeview to textbox.
Thanks ppl
|
|
|
|
|
Yes there is a limit to the number of handles in Windows and Windows NT, the former being much lower but still impractical to ever reach. This is most likely not your problem.
The problem is, most likely, that a TextBox is not a container control. The use of "databind" is also not possible in this context, since neither represents data.
Please post relevent code so that we can help you diagnose the problem you're having, since the discription you've given doesn't have nearly enough information to form any decent diagnosis.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Ok here's the code where it happens
This works fine
"this.textBox_ClsId.DataBindings.Add(new Binding("Text", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));
this.textBox_ClsIdentifier.DataBindings.Add(new Binding("Text", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));
this.textBox_ClsDescription.DataBindings.Add(new Binding("Text", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));
this.textBox_ClsVersion.DataBindings.Add(new Binding("Text", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));"
This is the only line giving me the error "//this.textBox_ClsExtends.DataBindings.Add(new Binding("Text", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));"
This is also working fine
"this.checkBox_ClsAbstract.DataBindings.Add(new Binding("Checked", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));
this.checkBox_ClsNew.DataBindings.Add(new Binding("Checked", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));
this.checkBox_ClsSealed.DataBindings.Add(new Binding("Checked", ((DataSource)this.treeView_WorkView.SelectedNode.Tag), "Datamember"));"
thanks
|
|
|
|