|
|
See SendKeys.Send[^]. It't might do what you want. And be sure to take a look at the NOTE at the very botton.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Thanks.
Case that it will simulate keyboard keys of number 0~10, how to make?
|
|
|
|
|
Hi!
I would like to make a custom control with a menu that drops down when the user clicks it (sort of like a combo box) - but I can't seem to find a way to make parts of the control (the drop down menu) overlap other controls like the combobox does. Any suggestions?
|
|
|
|
|
Search MSDN or codeproject, there are many articles on doing custom control drawing.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
Yeah... I've done alot of custom control drawing, but this is a bit different since it's supposed to be able to pop up over all the other controls... I guess I'll end up using a normal control that makes sure it's topmost all the time while it's visible. The best thing would be to be able to make a custom ContextMenu (since they're able to hover over other controls)
|
|
|
|
|
Ah, I understand your problem now. Have you tried setting the Region of the control? I think with that you could draw past your control bounds...
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
hello friends i m making a project in ma university and for that i need to get image from scanner and display it in the picture box in c#...i found the relative code for vc and vb but couldnt not find it for c #....i found one that was of Twain but it has copy rights ...........
so plz any bodu plz can help me and send me a code in which to get image from scanner and display it in the picture box in c# plz i will be looking forward for the code as soon as possible thnx u very much palz...tc u all
Momi
|
|
|
|
|
Hi everyone, I'm wondering about this....If you are familiar with the old DOS days, please read-on, back then in those days, if you want to protect anyone from stepping into your code (either compiled C/Pascal) [Note: No Win .NET stuff etc here], you can redirect Interrupt 3 (which was the debugger interrupt) to your own interrupt vector routine and prevent the code from being stepped into. Is there an equivalent of that in the Windows, .NET world. I'd like to be able to prevent anyone attaching a debugger to a running .NET app (process) so that they cannot find out how to bypass the routines etc....I am 100% sure there's a way to do this, without resorting to tapping into the debugger api...can anyone shed some light on this please?
Many thanks,
Tom.
#define STOOPID
#if STOOPID
Console.WriteLine("I'm stoopid!");
#endif
|
|
|
|
|
|
That doesn't enforce it. Only if the debugger explicitly wants to skip over it. Basically, it works for a .Net debugger, not an asm debugger.
Perhaps a small loader could be merged into the .Net exe that would redirect int3?
|
|
|
|
|
Hi all,
I'm using the nice example [^] and everything works fine until I got an "out of page range error" while printing the document.
Does anyone know:
a) how to suppress MSWord errors - no error popup ?
b) how to handle errors happened in Word?
c) how to reset errors and continue working ?
I tried to use for point a)
word.Visible = false;
word.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
but it doesn't have any effect - the error message is still comming up.
(have not found msdn articles)
Thanks for your response
Frank
|
|
|
|
|
Hi!
I'm using:
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.DoubleBuffer,true);
SetStyle(ControlStyles.UserPaint,true);
.....
protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= 0x00000020;
return createParams;
}
}
......
protected override void OnBackColorChanged(EventArgs e)
{
// TODO: Add DivPanel.OnBackColorChanged implementation
//base.OnBackColorChanged (e);
}
, in my TranspPanel class and:
private void OnPanelDragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
DivPanel d_panel = sender as DivPanel;
Point cu=Cursor.Position;
cu=DraggingPanel.Parent.PointToClient(cu);
cu.Offset(-this.offX,-this.offY);
d_panel.Parent.Invalidate(new Rectangle(d_panel.Parent.PointToClient(DraggingPanel.Parent.PointToScreen(DraggingPanel.Location)),DraggingPanel.Size),true);
this.DraggingPanel.Location=new Point(cu.X,cu.Y);
where d_panel.parent is TransPanel.
But there are blinking...
What I should do?
|
|
|
|
|
here is full code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace wg2h
{
///
/// Summary description for WYSIWYG.
///
public class WG : System.Windows.Forms.Form
{
private Panel DraggingPanel;
private int offX;
private int offY;
private Point loc=new Point(1000,1000);
public static Form wf=new WG();
private wg2h.DivPanel p0;
private System.Windows.Forms.Label label1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public WG()
{
ResizeRedraw = true;
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.p0 = new wg2h.DivPanel();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// p0
//
this.p0.AllowDrop = true;
this.p0.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.p0.Dock = System.Windows.Forms.DockStyle.Fill;
this.p0.Location = new System.Drawing.Point(0, 0);
this.p0.Name = "p0";
this.p0.Size = new System.Drawing.Size(610, 475);
this.p0.TabIndex = 0;
this.p0.DragEnter += new System.Windows.Forms.DragEventHandler(this.OnPanelDragEnter);
this.p0.DragOver += new System.Windows.Forms.DragEventHandler(this.OnPanelDragOver);
//
// label1
//
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
//
// WG
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(610, 475);
this.Controls.Add(this.p0);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WG";
this.Text = "WYSIWYG";
this.Load += new System.EventHandler(this.WG_Load);
this.ResumeLayout(false);
}
#endregion
[STAThread]
public static void Main(){Application.Run(wf);}
private void OnPanelMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.offX=e.X;
this.offY=e.Y;
Panel tsender=(Panel)sender;
this.DraggingPanel=tsender;
this.DoDragDrop(tsender,DragDropEffects.Move);
}
private void OnPanelMouseLeave(object sender, System.EventArgs e)
{
}
private void OnPanelDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
e.Effect=DragDropEffects.Move;
}
private void OnPanelDragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
DivPanel d_panel = sender as DivPanel;
Point cu=Cursor.Position;
cu=DraggingPanel.Parent.PointToClient(cu);
cu.Offset(-this.offX,-this.offY);
d_panel.Parent.Invalidate(new Rectangle(d_panel.Parent.PointToClient(DraggingPanel.Parent.PointToScreen(DraggingPanel.Location)),DraggingPanel.Size),true);
this.DraggingPanel.Location=new Point(cu.X,cu.Y);
}
private void WG_Load(object sender, System.EventArgs e)
{
Control px=new DivPanel();
px.Location=new Point(0,0);
px.Size=new Size(100, 200);
px.AllowDrop=false;
this.p0.Controls.Add(px);
px.BringToFront();
px.DragEnter += new System.Windows.Forms.DragEventHandler(this.OnPanelDragEnter);
px.MouseHover += new System.EventHandler(this.OnPanelMouseLeave);
px.DragOver += new System.Windows.Forms.DragEventHandler(this.OnPanelDragOver);
px.MouseLeave += new System.EventHandler(this.OnPanelMouseLeave);
px.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnPanelMouseDown);
px=new DivPanel();
px.Location=new Point(0,0);
px.Size=new Size(100, 200);
px.AllowDrop=false;
this.p0.Controls.Add(px);
px.BringToFront();
px.DragEnter += new System.Windows.Forms.DragEventHandler(this.OnPanelDragEnter);
px.MouseHover += new System.EventHandler(this.OnPanelMouseLeave);
px.DragOver += new System.Windows.Forms.DragEventHandler(this.OnPanelDragOver);
px.MouseLeave += new System.EventHandler(this.OnPanelMouseLeave);
px.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnPanelMouseDown);
}
}
public class DivPanel:System.Windows.Forms.Panel
{
public DivPanel()
{
//Для прозрачности установим стиль
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.DoubleBuffer,true);
SetStyle(ControlStyles.UserPaint,true);
this.BorderStyle=BorderStyle.FixedSingle;
}
//Добавим к окну, при его создании, WS_EX_TRANSPARENT для прозрачности:
protected override CreateParams CreateParams
{
get
{
const int WS_EX_TRANSPARENT = 0x00000020;
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= WS_EX_TRANSPARENT;
return createParams;
}
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
// TODO: Add DivPanel.OnPaint implementation
//рисуем бордер
base.OnPaint (e);
this.BorderStyle=BorderStyle.FixedSingle;
if(this.Parent is DivPanel)e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(100, Color.Red)),0, 0, Width, Height);
}
//отменяем базовый метод:
protected override void OnBackColorChanged(EventArgs e)
{
// TODO: Add DivPanel.OnBackColorChanged implementation
//base.OnBackColorChanged (e);
}
}
}
DivPanels blinking ,as you see...
and nobody can tell me what's the ...
|
|
|
|
|
I was just browsing through some of the features apple's new tiger operating system. One of the features I found was the invocation of the dictionary feature implemented in Tiger. Essentially, one would place their mouse on top of a word they are interested in and they simply hold down CTRL-COMMAND-D this fires the dictionary window displaying the definition of the word in question.
This link gives a good description :
http://a1408.g.akamai.net/7/1408/7780/20050429/www.mac.com/st/1/learningcenter20050429/pdf/tiger/Tiger_Definitions.pdf
Being new to windows programming, I was wondering how could I go about mimicking such a feature in windows. For starters the dictionary application could listen for certain keypress event with a keycombination such as CTRL-SHIFT-ATL-D. One thing I can't quite figure out is that how is it possible to pass the selected text from any application into the dictionary window.
Any feedback will be appreciated.
thanks
Vee
|
|
|
|
|
Someone has been asking about grabbing the selected text in ANY windows application before. It's just way to complicated to do in Windows in its current form. There are just too many different controls and applications that can display text and getting at it requires different methods for each of those controls/apps. You can't possibly do it for all of them.
It is possible if you want to handle a few differnet standard controls, but on any test displayed on the screen, practically it isn't possible in Windows.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for the quick response.
How about this, pressing the key combination of CTRL-SHIFT-ALT-D on the selected text, performing a copy to clipboard analogus to the COPY operation of windows. Then simply doing an auto PASTE operation into the textbox of the application that gets invoked by the pressing of the keycombination ?
Or this wild solution is already answered by your previous post
|
|
|
|
|
Hmmm... Possible to do, but not the way to think.
If this key combination is pressed, your application would be launched, stealing the focus from the application you want to copy the text from. There is no way to determine which application HAD the focus and therefore no way to force that application to do a copy to the clipboard.
You can get around this, though, by writing your application as a Service that interacts with the desktop or as a normal application that is launched on user login (Startup folder or Registry Run key) that shows no windows, but has a System Tray icon. You application would have to hook the keyboard to look for the key combination your using to luanch this. Once you code sees this combination you could inject the Ctrl-C key codes without stealing the focus. Most applications support this as the Copy to Clipboard command and will dutifly do so.
You said this is your first Windows application? You've got a lot to learn to get this far and this doesn't include the dictionary functionality. What kind of programming experience do you have?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What about capturing whatever is below the mouse and trying to OCR it? I think it would be a much more viable solution for an application like this.
[EDIT: I don't think it would be an awfully complex solution, and yet it would work on browsers (text and images), Word, Paint, Excel, Media Player and any application. But I probably would write that in plain Win32 API.
Good idea, I think I could make that a spare project of mine (for those rare situations when I have nothing to do.)]
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
in response to your post dave,
i didnt think about the loosing focus part. Your suggestion of running it as a service is pretty cool, I never thought of it How does one go about emulating the Ctrl-C mechanism inside the keypress events of the service application if the correct keycombo was pressed ?
I was wrong in say that it is my first windows applications. I should say that I have been learning C# since march and most of my information comes from this very website, scouring through the numerous articles. So far I can disect the code from the articles and understand it well. My background was in embedded systems, mainly writing ANSI C. So this is a big switch over for me. However, I am enjoying it since its answering my own questions of how windows applications interact with windows. Though I am not sure if my approach to learning c# is correct?
At this stage I am not too worried about implementing the dictionary funtionality because I would be just happy getting the of copying of selected text through a service application without stealing focus.
in response to your post Luis,
OCR, now thats going beyond the call of duty . It is an interesting spin to this same problem, however, where would one get a OCR class from ? I think I was reading somewhere that one of the ms packages has a OCR dll that can be used correct ?
If anyone else can spin other ideas, I am sure others including myself would interested in reading them
cheers
Vee
|
|
|
|
|
ekynox wrote:
where would one get a OCR class from ?
I have no idea... maybe searching here you could find some leads.
I believe this is the only practical way of doing it, basically for the following reasons:
* First of all, not all text you see on screen belongs to a control. For example, you can't easily get what's in an IE window because it's drawn by the browser, instead of Label controls (or a rich text box or whatever.) Or images, or toolbar buttons... they are not controls in the Windows way. And what about Word? If I were writing this dictionary, the most important apps to support would be the browser and Word.
* Some controls contain text, and it cannot be selected. You can't select a single word in a ListView or in a TreeView . The caption of a window, a combo box item.
* And finally, you might not know controls that support selection which expose it's text in a different way (other that casting to a Control and getting its Text property.)
With OCR you can get the screen under the mouse (a screen capture program does it.) and identify the text under it, which, since not being handwritten, can be identified with almost 100% of success.
That's my idea, but I don't know I would implement it. I would have to research a bit, specially on the OCR part. That's why I liked it as a project for my spare time.
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis,
Finally found that OCR article on this website,
http://www.codeproject.com/csharp/MODI.asp
Well this should give you some start on your new project
I did some searching on this website and found couple of tutorials that could help me out:
http://www.thecodeproject.com/csharp/popupkiller.asp#hotkey
http://www.codeproject.com/csharp/clipboard01.asp
The way I will approach my problem is to create a service application which has a unique hotkey assigned to it then use the clipboard tutorial to help me figure out how to copy text to memory. I will based my application to work with notepad to start with then see how things fold.
cheers
Vee
|
|
|
|
|
Hi,
I was wondering what operating system is everyone using to develop on? And have you created web services on that platform with any problems. I am having big problems trying to get web services to work on my win xp pro box and am wondering if I should just reinstall op?
Thanks,
JJ
|
|
|
|
|
There are no problems doing it on XP. All you need is IIS installed. What kind of problems are you having? Supply EXACT error messages and codes, please.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
This is the exact Error in my web proxy:
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll
Additional information: This is an unexpected token. The expected token is 'NAME'. Line 4, position 36.
I have a web service thats local and created a web ref called lh1.
At the top of my win form where I call the web ref is this:
using EMS.lh1;
private static lh1.EMS1 wsHrs = new lh1.EMS1();
When I enter win form that has the call to the web service it bombs as soon as I enter the proxy at:
public EMS1() {<-- This line
this.Url = "http://localhost/WSEMS1/EMS1.asmx";
}
This is what the top of my proxy file code looks like, I added nothing to
it:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="EMS1Soap",
Namespace="http://tempuri.org/")]
public class EMS1 : System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks>
public EMS1() {
this.Url = "http://localhost/WSEMS1/EMS1.asmx";
}
Following Error is: This is an unexpected token. The expected token is
'NAME'
What am I doing wrong?
public EMS1() {
this.Url = "http://localhost/WSEMS1/EMS1.asmx";
}
This line is located in the proxy file generated by my web reference.
Thanks,
JJ
|
|
|
|
|