|
Personally speaking, this sounds like a REALLY stupid design. Why you would put a textbox inside a richtext box is beyond all normal reasoning. However, you need to either change tab order or do a textbox1.Focus() call.
|
|
|
|
|
Hi all!
Sorry for my poor english....
Here my problem, I created WebBrowser,and now I need to disable, "Select_all" and "Copy" fulctions in browser.
I disabled ContextMenu, but keys Ctrl+A, Ctrl+C working.
I tryed to using ProcessCmdKey,ProcessDialogKey,for catching this Keys but "Ctrl+A, Ctrl+C" are not catching....
If somebody knows how do it, please help me...
P.S. Sorry for my mistakes.
|
|
|
|
|
Try this.
var isIE = ( document.all != null );
function initIframe()
{
if ( isIE )
{
//wiring to onkeydown event
editor.attachEvent('onkeydown', editorEvents);
...
}
else
{
editor.addEventListener('keypress', editorEvents, true);
...
}
}
function editorEvents(evt)
{
//this is just old habit
evt = ( evt == null ) ? event; evt;
var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
var keyCodeChar = String.fromCharCode(keyCode).toLowerCase();
if ( !isIE )//-->If FireFox
{
if (evt.type=='keypress' && evt.ctrlKey)
{
...
}
}
if ( isIE )//-->If IE
{
//changed the type to "keydown" to catch new wiring.
if (evt.type=='keydown' && keyCodeChar=='v' && evt.ctrlKey)
{
//do something.
//setting the returnValue will cause the event to stop bubbling.
evt.returnValue = false;
//no return needed
}
}
return true;
}
Vipin
|
|
|
|
|
Thank's for You help, but how can I use Your sample for axWebBrowser1?
I'm only junior in programming, and very much I don't understand...
|
|
|
|
|
paste this code in the key press event of the textbox or text area where u want to disable the Ctrl+V or Ctrl+C keypress.
Vipin
|
|
|
|
|
Sorry but my WebBrowser was created in Windows Application, VS 2003, FW 1.1, here sample:
private AxSHDocVw.AxWebBrowser axWebBrowser1;
private void Form1_Load(object sender, System.EventArgs e)
{
object oURL = "www.codeproject.com";
object oEmpty = "";
axWebBrowser1.Navigate2(ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
//Event which open links in new windows\
private void axWebBrowser1_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
{
if (this.axWebBrowser1.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
e.ppDisp = null;
e.cancel = true;
return;
}
FEX f1 = new FEX();
f1.Text = "(New window)";
e.ppDisp = f1.axWebBrowser1.Application;
f1.Show();
}
And how I can use Your sample? Sorry but I don't know....
|
|
|
|
|
if ( e.Control && e.KeyCode == Keys.A || e.Control && e.KeyCode == Keys.C )
{
MessageBox.Show( "Control key + A pressed");
}
let me know if this works.
Vipin
|
|
|
|
|
Hi!
Sorry but WebBrowser haven't event KeyDown.... And Your sample doesn't work...
In my sample, some keys work normal...but "Ctrl+A, Ctrl+C" - does'nt work.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.N))//Normal
{
if (this.axWebBrowser1.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
return false;
}
FEX f1 = new FEX ();
f1.Text = "(New window)";
f1.Show();
return true;
}
else if (keyData == (Keys.Control | Keys.Q))//normal
{
MessageBox.Show("Q");
return true;
}
else if (keyData == (Keys.Escape))
{
this.Close();
return true;
}
else if(keyData == (Keys.A | Keys.Control))
{
MessageBox.Show("113"); //Doesn't work
return true;
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
}
P.S. Sorry for my mistakes!!!
|
|
|
|
|
Hi folks,
I have a simple question for ya (At least I hope it is!)... How can my app find out what folder it is in? This might change regularly, so it needs to know lol
Cheers, Ben.
|
|
|
|
|
Hi,
try this
System.AppDomain.CurrentDomain.BaseDirectory()
Or
system.Environment.CurrentDirectory
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Thanks, this worked
Environment.CurrentDirectory
|
|
|
|
|
Do not use Environment.CurrentDirectory. It could potentially change between application launch and accessing of the property. If you're writing a WinForms app, use Application.StartupPath[^] instead. If it's a command line app, use the first property suggested by the other poster AppDomain.CurrentDomain.BaseDirectory[^].
|
|
|
|
|
In addition to what Senthil said:
The Environment.CurrentDirectory property contains the current working directory. The startup working directory can be specified in the properties for an application, so even if you don't change the working directory from your program, there is still no guarantee that the application file is in the current working directory.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I believe I am familiar and know the concept of OOP.
Can you recommend a book on OOP in C# please?
Thanks
|
|
|
|
|
I recommend you Wrox Professional C#.
Saqib
|
|
|
|
|
Try the excellent 'Programming C#' by Jesse Liberty.
Dave
|
|
|
|
|
Try SAMS C# Unleased, if you are a starter on the .NET framework
Oliekrokenosterpikkelikkeastrysvoel
|
|
|
|
|
Hi All,
I use FileSystemWatcher for monitoring some folders. When a new file is created i wait until it is completly written to disk and then i copy that file to another folder. I am using the FileSystemWatcher events OnCreated(), OnChanged, OnError(). Proper handlers are attached to these events. This code worked perfectly until yesterday. Yesterday suddenly the FileSystemWatcher stopped giving events for file creation, change etc. Not even an Error occured. what may be the probable reason ? Is there any dependancy for FileSystemWatcher ? I didnt changed the code which was working. So i think if there is any dependancy it might be external.
I tried to search the net for a possible solution but i only found that there are a lot of people complaining about FileSystemWatcher. So i will also like to know if there is some other class or component available which can just replace FileSystemWatcher ?
Any sort of information or help will be appreciated. Please reply as soon as possible since i have wasted a hell lot of time on this FileSystemWatcher !
Thanks in Advance.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
You're going to have to do some root-cause-analysis to find out the why. For example:
1) if it is a service (you did not say) is it still running?
2) a sudden change in code is triggered by an event. What change day-before-yesterday?
3) did something unexpected happen like a power surge or power outage?
So it is a very basic part of programming to walk through the possible issues until you find out the event that caused your process to fail. Since you remained at a high level of discussion (not providing all details) there can be just so much that can be provided for help.
|
|
|
|
|
hi theRealCondor,
Thanks for the reply and sorry that i was not able express my problem details properly, but now the problem is solved. Actually my problem was that i was using FileSystemWatcher in a windows service and the Watcher stopped triggering events. Though i didnt changed any code related to that watcher. I posted the same query on microsoft's forum and some one told me to check the log on acount for the service. I changed my log on account and the events started to trigger again. By the way, i was talking about FileSystemWatcher events whcih are generated when file is created or change, etc..
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
This is what I'm trying to do:
Target value is 0xffffff9d, which translates to 4294967197 decimal, which is why it needs to be an unsigned int. Unfortunately whenver I attempt to do this, it spawns an overflow exception.
Two lines of code that matter:
RegistryKey TargetKeyNode = Registry.LocalMachine.OpenSubKey(TargetPath, true);
TargetKeyNode.SetValue(TargetKeyName, TargetValue, RegistryValueKind.DWord);
As a brute force method, I've tried creating the target key as a dword with a zero value and then stuffing in the needed value using RegistryValueKind.Unknown, but that simply changes the key type to a string.
I also tried setting the value this way &Hffffff9dI (along with every possible variation of that) as was suggested for someone else on another website but I get an error "The name &Hffffff9dI does not exist in the current context" on build.
Can anyone please help me with this? Thanks in advance for any help.
Mike Poz
|
|
|
|
|
You can cast the uint value to int, without losing data. The int value will be negative, but having the same bit pattern.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you very much, that worked exactly as you said. Never though of the old "wrap around" trick. Thanks again!
Mike Poz
|
|
|
|
|
Hello fellow programmers,
I am one of the poor souls who tried to dynamically load a dll and discover its types, methods of types, etc.
Now, an example in the vs2005 help environment (and also some online articles by c# programmers) shows that one can use the common line compiler csc with the option "/target:library" and call Assembly.LoadFrom("xxx.dll") etc. and there you go! It works.
However, if I create a dll (not really a dll, as I have found out) through a class library or a control library project, it can't be loaded as an assembly (unless it is in the same solution as your calling application).
I am wondering the difference between using the csc and the visual studio environment. Can I do the same trick from within the visual environment? What sort of C# project must I use to create the kind of library that csc creates?
I will be grateful for any comment on the subject and pass it along to any other programmer who may tackle the same issue.
Hurol
|
|
|
|
|
You should use ClassLibrary type project to create dll in VS.
Saqib
|
|
|
|