|
AxSHDocVw.AxWebBrowser axWebBrowser1;
I am making a web editor(wysiwyg editor).
My program has a toolStrip and axWebBrowser control
When I want to change the font of the webbrowser, select my comboBox on toolStrip, it make the font change but the FOCUS Remain in Font ComboBox.
I want give the focus to axWebBrowser programmically.
here is the code that executed when the ComboBox SelectedIndex changed
case 32:
doc1.execCommand("FontSize", false, (object) ((ToolStripComboBox)sender).SelectedItem.ToString().Split('(',')')[1]);
Win32.SetForegroundWindow(axWebBrowser1.Handle);
Win32.SetFocus(new System.Runtime.InteropServices.HandleRef(null, axWebBrowser1.Handle));
please take care of my question. thanks a lot.
|
|
|
|
|
Hello,
Have you tried:
axWebBrowser1.Focus();
It worked for me. Hope it helps.
Jason.
|
|
|
|
|
Hi All,
I'm using VS C# 08 EXPRESS EDITION / WINDOWS FORMS APP. Now, I would like to know if there is a way to publish my prject as a standalone application (where there is just one .EXE file THAT IS THE ACTUAL PROGRAM ITSELF) or where it publishes the project as JUST ON INSTALLATION FILE. I am really getting sick and tired of these files that VS produces (Application Files Folder, Setup.exe, Project Manifest file). I have had no luck in finding a solution to my problem. Can anybody please offer any advice/tutorial etc... i'd appreciate any help i can get on this thanks for reading.
regards,
j.t.
|
|
|
|
|
You always can, its the .exe in the bin\Debug\ folder...
|
|
|
|
|
You should rather compile in Release mode, and use the file in the bin\Release folder.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Oh.....That's.......Awesome! Thanks for that buddy!
You've made my day!
j.t.
|
|
|
|
|
A very strange exception. I have a DAL assembly, which is signed, that I'm using in my application. Everything compiles fine and runs in debug and release on my local machine. I can run the app outside of VS, no problems. Now when I move the app and all appropriate assemblies to a test machine I get a MissingMethodException. Using Reflector I've verified that the method does exist in the DAL assembly. If I do not sign the assembly everything to works fine. I don't understand the connection with signing the assembly. I know I'm missing something but can't see it. Anyone have some insight into this problem?
only two letters away from being an asset
|
|
|
|
|
Hi,
Not sure, but not really surprised either:
maybe the signed DLL ends up in the GAC, whereas the unsigned one is near your EXE, and one
of them is missing a method. When the EXE knows it looks for an unsigned one it checks its folder
first, and when you rebuild based on a signed DLL I guess it looks in the GAC (first).
Hope this helps.
|
|
|
|
|
Good thought, but all assemblies are local. I used xcopy to deploy them to the test machine which is a VM so I'm certain (99% at least) that the assemblies aren't on the machine to begin with.
only two letters away from being an asset
|
|
|
|
|
I am developing a software that needs to know when the PASTE EVENT (through the context menu or ctrl+V) happens (only for files / directories). More or less, something like it happens with TeraCopy or Copy Handler. When you copy and then paste, it is TeraCopy thats handles the pastings.
I know more or less how to capture the COPY EVENT, you only have to set a ClipboardViewer and you catch all global COPY EVENTS (in fact is called: WM_DRAWCLIPBOARD). You can learn this here: http://www.radsoftware.com.au/articles/clipboardmonitor.aspx But the ClipBoardViewer does not provide you with the ability to catch the PASTE EVENT.
This software must not only work for ctrl+v, but also when you click on the option of paste in the context menu (right click).
|
|
|
|
|
Are you looking for WM_PASTE ?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I think WM_PASTE does not occur when you copy a file or directory. So I think this is not the solution.
I know I need a hook and perhaps written in C++ but I don't know how to do it.
Perhaps using EasyHook or madcodehook libraries, but this is
difficult for me, I would need some help.
|
|
|
|
|
I think for this you'll need to have a look at shell32.dll, probably SHChangeNotify[^] and on MSDN[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Could you supply any code? I am really clumsy with hooks.
|
|
|
|
|
Hi All,
I am writing a web browser application using Visual Studio 08 Express Edition C#. Windows Forms Application... But, one of the hardest problems is that I have founf almost ZERO support for the tabControl. And yes, I've checked MSDN. I need to let the user open new tabs, and have a new web browser control placed inside that newely created tab.
Then I want the user to be able to use the navigation buttons (back forward etc) for each of the web browser controls within the tabs. But, I cannot do this, I also want to be able to use any web browser command for every tab there is. I have tested every code sample i've found and nothing works. Can somebody please help me? Any advice/samp code/tutorials etc would be GREATTLY APPRECIATED!
thanks,
jt.
|
|
|
|
|
Hello there,
I don't know what you tried before, maybe if you post your codes here we can help you better.
I think this will help you.
Assume you have a menuStrip and have an Open command which should opens a text file into RTB (Each Tab has a RTB).
void mnuOpen_Click (object sender, EventArgs e)
{
TabPage tp = tabControl.SelectedTab;
tp.Controls["RTB"].Text = strng.Format("Open clicked in tab no.{0}", (tabControl.SelectedIndex + 1).ToString());
}
Hope Helps
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Thank you so much for your quick reply!
Following, is the code for my Web Browser. It simple creates a new Tab, adds a page and a new WebBrowser in it:
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
page.Controls.Add(wb);
I'm having trouble accessing each individual web browser control. I want to be able to also display the name of the website on the actual tab. Can't seem to do that though... I just got your email and am about to test your code Which I'm looking forward to...
Thanks,
jt.
|
|
|
|
|
Okay, I couldn't get the code to work. It compiles. But just doesn't work at runtime, nor does it bring up any errors. Weird. Thanks your your help though, I appreciate it.
Here's my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace JT_Explorer
{
public partial class Form1 : Form
{
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
[DllImport("User32.dll")]
public static extern bool ReleaseCapture();
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
public Form1()
{
InitializeComponent();
}
private void Stop_Click(object sender, EventArgs e)
{
Status.Text = ("Operation aborted.");
}
private void AddressBar_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
page.Controls.Add(wb);
wb.Navigate(AddressBar.Text);
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.Close();
this.Dispose();
Environment.Exit(-1);
}
private void Like_MouseEnter(object sender, EventArgs e)
{
LikedList.Visible = true;
LikedList.BringToFront();
}
private void LikedList_MouseLeave(object sender, EventArgs e)
{
LikedList.Visible = false;
}
private void Tags_Click(object sender, EventArgs e)
{
MessageBox.Show("Disabled.");
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.Hide();
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 15);
}
}
private void pictureBox3_Click(object sender, EventArgs e)
{
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["wb"].Text = string.Format("kjh", (tabControl1.SelectedIndex + 1).ToString());
}
private void pictureBox2_Click(object sender, EventArgs e)
{
tabControl1.SelectedTab.Dispose();
}
private void Back_Click(object sender, EventArgs e)
{
WebBrowser wb = tabControl1.SelectedTab.Controls[0] as WebBrowser;
wb.GoBack();
}
private void Forward_Click(object sender, EventArgs e)
{
WebBrowser wb = tabControl1.SelectedTab.Controls[0] as WebBrowser;
wb.GoForward();
}
}
}
|
|
|
|
|
jay_t55 wrote:
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["wb"].Text = string.Format("kjh", (tabControl1.SelectedIndex + 1).ToString());
OK, I got it. I wonder why you didn't get error!
you have to set the Name property of your control (or its Index) in tp.Controls, like this:
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
wb.Name = "WebBrowser1";
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["WebBrowser1"].Text = string.Format("kjh", (tabControl1.SelectedIndex + 1).ToString());
tp.Controls["wp"] returns null and you didn't get error in tp.Controls["wp"].Text = ... , really Weird!
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Hello, Thanks again
Here's what I got, now:
private void pictureBox3_Click(object sender, EventArgs e)
{
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
wb.Name = "WebBrowser1";
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["WebBrowser1"].Text = string.Format("WebBrowser1", (tabControl1.SelectedIndex + 1).ToString());
tp.Controls["wp"].Text = string.Format("wp", (tabControl1.SelectedIndex + 1).ToString());
}
...But, When I debug, and then click on pictureBox3(add tab button) it brings up a debug error: "object reference is not set to an instance of an object"... it doesnt even open a new tab any more hahaha... Any ideas?
thanks,
j.t.
|
|
|
|
|
jay_t55 wrote: tp.Controls["wp"].Text = string.Format("wp", (tabControl1.SelectedIndex + 1).ToString());
What is "wp"? Did you mean "wb"? Even with "wb" you'll get this error. wb is an object, as I told before, you have to set the object's Name property in tp.Controls, as you did in this line:
jay_t55 wrote: tp.Controls["WebBrowser1"].Text = string.Format("WebBrowser1", (tabControl1.SelectedIndex + 1).ToString());
Clear this line:
jay_t55 wrote: tp.Controls["wp"].Text = string.Format("wp", (tabControl1.SelectedIndex + 1).ToString());
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
thank you,
i have this:
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
wb.Name = "WebBrowser1";
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["webBrowser1"].Text = string.Format("webBrowser1", (tabControl1.SelectedIndex + 1).ToString());
tp.Controls["webBrowser1"].Text = string.Format("webBrowser1", (tabControl1.SelectedIndex + 1).ToString());
..and it still gives the same error message ..totally weird :-p
|
|
|
|
|
C# is Case-Sensitive which means 'A' is not equal to 'a'.
You named your wb , "WebBrowser1" (look at 'W', it's Capital) and told to tp that I have a control named "webBrowser1" (did you see 'w'?) and tp tried to find that but nothing found and got this error. Do you understand?
And why did you write this line twice?
jay_t55 wrote: tp.Controls["webBrowser1"].Text = string.Format("webBrowser1", (tabControl1.SelectedIndex + 1).ToString());
tp.Controls["webBrowser1"].Text = string.Format("webBrowser1", (tabControl1.SelectedIndex + 1).ToString());
Clear one of them and change "webBrowser1" to "WebBrowser1"
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Sorry about that muck up before.
Here is the code that I have as of your last post:
private void pictureBox3_Click(object sender, EventArgs e)
{
TabPage page = new TabPage("Tab");
tabControl1.TabPages.Add(page);
WebBrowser wb = new WebBrowser();
wb.Dock = DockStyle.Fill;
wb.Name = "WebBrowser1";
page.Controls.Add(wb);
TabPage tp = tabControl1.SelectedTab;
tp.Controls["WebBrowser1"].Text = string.Format("WebBrowser1", (tabControl1.SelectedIndex + 1).ToString());
}
Although it still tells me "object reference not set to instance of an object." and it points to the following line:
tp.Controls["WebBrowser1"].Text = string.Format("WebBrowser1", (tabControl1.SelectedIndex + 1).ToString());
Regards,
j.t.
|
|
|
|
|
Oooooooooh,
Why didn't I notice before?
A WebBrowser control does NOT support the Text property!!!!
But why did you get NullReferenceException?!!
I tried this code and did work for me well:
TabPage tp = new TabPage("Tab");
tabControl1.TabPages.Add(tp);
WebBrowser wb = new WebBrowser();
wb.Name = "WebBrowser1";
wb.Dock = DockStyle.Fill;
tp.Controls.Add(wb);
TabPage p = tabControl1.SelectedTab;
(p.Controls["WebBrowser1"] as WebBrowser).DocumentText = "Hello!";
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|