|
User asked this in August. Bad subject title.
Blog link to be reinstated at a later date.
|
|
|
|
|
Well, if I were you, I'd sign up for a beginners course in network protocols.
|
|
|
|
|
Pete O'Hanlon wrote: beginners course in network protocols
A little English Refresher course would help as well. See his capitalization and sentence formations.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hi everyone, I'm developing an application that can control the mouse to do things. Now my app can force the mouse to move to any point and do left click or right click. Before I explain my problem about mouse scroll, I'd like to show my code to you.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
namespace SeniorProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process[] p = Process.GetProcessesByName("winword");
if (p.Length > 0)
{
// Set focus on Microsoft Word program when user click button 1
SetForegroundWindow(p[0].MainWindowHandle);
Thread.Sleep(10);
}
Cursor.Position = new Point(100,200); // Bring pointer to (100,200)
const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
const UInt32 MOUSEEVENTF_WHEEL = 0x0800;
UInt32 x = Convert.ToUInt32(Cursor.Position.X);
UInt32 y = Convert.ToUInt32(Cursor.Position.Y);
mouse_event(MOUSEEVENTF_WHEEL, x, y, 0x0010, new IntPtr());//Force the mouse to scroll
}
[DllImport("user32.dll")]
public static extern void mouse_event
(
UInt32 dwFlags, // motion and click options
UInt32 dx, // horizontal position or change
UInt32 dy, // vertical position or change
UInt32 dwData, // wheel movement
IntPtr dwExtraInfo // application-defined information
);
}
}
You see "0x0010" in the function mouse_event, right? The problem is that I cannot force the mouse to scroll down no matter what number I use, it will always scroll up. If I use greater number such as 0x0200 it will scroll up faster than less number such as 0x0010 but I really want it to scroll down T_T. So if anyone know how to make the mouse scroll down, please tell me and I'll really appreciate your help. Thanks a lot.
|
|
|
|
|
Check out this page[^] on pinvoke.net. Part way down there's a 'fixed' version of the function declaration that take ints rather than uints. Sending a negative value (after changing the function) should have the desired effect.
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)
|
|
|
|
|
Thank you very much Dave,now I can scroll it down according to your suggestion.
I changed UInt32 into int so I could assign the negative value to dwData and then the mouse finally scroll down. Thanks again Dave ^^
|
|
|
|
|
No problem
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)
|
|
|
|
|
Hello friends,
I'm using VS2005 (.Net Framework 2.0). I have a few problems with the Windows Form controls. First, I've searched and searched, but couldn't find a horizontal separator control, like the one we see in the File Properties dialog box, in the Windows Form Controls library. Is there a way to add such a control to my forms or I have to derive a new class?
Second, the textbox control doesn't support transparent background. I've searched the Codeproject articles, but they all suggest long and complex method for the purpose. If someone can please suggest a sweet and simple solution, I'd be very grateful. I'm developing a new application and deriving new classes just to implement a new UI element is a time-consuming and complex affair.
Many thanks in advance.
modified on Saturday, October 25, 2008 8:56 AM
|
|
|
|
|
Ankit Rajpoot wrote: I have to derive a new class?
You could use a Panel, set it's border to Fixed3D and set it's Height to 4. Seriously, create a new user-control and write a paint-handler. You'll need to draw two lines on the canvas.
Ankit Rajpoot wrote: Second, the textbox control doesn't support transparent background.
With good reason; even the login-screen of World of Warcraft doesn't use transparancy in the input-controls. It will be harder for the user to read what he/she has typed.
You could use a label, and add/remove characters (from the .Text property) as the user presses keys (OnKeyPress event). Not a pretty solution, though
|
|
|
|
|
Hello eddyvluggen,
What I need a transparent textbox is for displaying the path of a file in a properties dialog box. The path may be longer than the width of the dialog box, so the best solution would be to use a textbox that has its ReadOnly property set to true. So that the user can click in the textbox and then use his/her mouse or arrow keys to see the complete path. I don't need to type anything in it, I just need it to display in it.
One more thing, I'd like to ask is that how can I implement the sliding panels in my application like the ones we see in VS itself (for solution explorer and properties and the toolbox.)
Thanks
|
|
|
|
|
Ankit Rajpoot wrote: I don't need to type anything in it, I just need it to display in it.
Sounds plausible How about a word-wrapped tooltip?
Ankit Rajpoot wrote: One more thing, I'd like to ask is that how can I implement the sliding panels in my application like the ones we see in VS itself
Use a Panel and set the AutoScroll property to 'true'. Next, drop the control that you want scrollbars on, into the panel. Set it's height and width so that it's larger then the Panel itself, and scrollbars will appear.
Good luck
|
|
|
|
|
Naaaahhhhh
I'm talking about their sliding property. The way they slide into view when the mouse hovers over them.
|
|
|
|
|
That's not a standard property, you'll need a third-party library or you'll have to code the functionality yourself. Sorry, but I can't really help there.
You could slide a form into view once you hover a panel, or you search the CodeProject
|
|
|
|
|
Hi,
Let us suppose there are 10 systems in network.I have created a table with few records in one system.Now i want to create same table with same records in remaining all 9 systems.I can not go to each and every system and do same.so that i decided to do like following.
suppose 1st i create table with few records in one system. now i want to create script for that table using c#, but not sqlserver management studio.After creating script using c# i would like to run the script(in all remaining 9 systems) from my system by providing server name ,user id,pwd.For this i need a win application.plz suggest me.
Otherwiseplz tel me how to create script using c#.
Thanks,
ravikumar
|
|
|
|
|
Why not use Management Studio scripting capability: script the objects you need, store the result in a file and run it through C# using SQLCommand.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi,
I want to maintian my xml data by using DataGridView, but I'm having a problem with getting the right xml element name to set a DataGridView.DataMember if the case is:
I have 2 xml files where the difference is:
sampleOne.xml:
<?xml version="1.0" standalone="yes"?>
<user>
<id>1</id>
<name>Robin</name>
</user>
<user>
<id>2</id>
<name>Batman</name>
</user>
sampleTwo.xml:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<user>
<id>1</id>
<name>Robin</name>
</user>
<user>
<id>2</id>
<name>Batman</name>
</user>
</NewDataSet>
And the code for loading the xml into DataGridView:
private string getXmlElementName(string path)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
XmlElement element = xmlDoc.DocumentElement;
return element.Name;
}
private void openXmlFile(string path)
{
DataSet ds = new DataSet();
ds.ReadXml(path,XmlReadMode.Auto);
dgvBrowser.DataSource = ds;
dgvBrowser.DataMember = getXmlElementName(path);
}
when loading sampleOne.xml it didn't show any errors, but the result of loading sampleTwo.xml will accure errors, it's because the element.Name = "NewDataSet" which is not appropriate for the dgvBrowser.DataMember. how can I get the element name "user"? Any suggestion for this? I browsed anywhere and still didn't get the answer for this problem
Thank you for the help.
Regards,
Andre H.H.
|
|
|
|
|
Perhaps methods GetElementsByTagName or SelectNodes would help. Both are found in XmlDocument class.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I want a detailed hierarchy of exception classes.Specially ones that handle database exceptions.Please help...
|
|
|
|
|
MSDN[^]
For database exceptions, refer to the documentation for the database you are using as they are product specific.
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)
|
|
|
|
|
hellow world !
i need to convert access file to sdf fpr Pocket pc
i need to convert it in the PC (not in my PPC)
how can i do it ?
than'k for any help
|
|
|
|
|
Hi,
i have some images stored in sql database and is all ok. They are saved as a byte[] and i load them into the c# application.
So, i was wondering about how can i have a byte[] in a c# solution (design time not runtime time), well i want to add a byte [] to the solution not image file!!!
Can i do that? is not really important, but i like the way pictures are stored in sql kind of stealth mode.
Thanks
nelsonpaixao@yahoo.com.br
trying to help & get help
modified on Friday, October 24, 2008 8:13 PM
|
|
|
|
|
You can but it's not very efficient as the byte array will need to be serialized by the designer for it's value to persist.
If you want to do it, it's probably easiest to wrap a List<byte> in a component, and call it's ToArray method to get the byte array and it's Clear + AddRange methods to set a byte array.
I don't see what advantage you will gain by doing this though.
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)
|
|
|
|
|
|
Hi,
i created a folder and added a few icons there (i embeded them after), and i want to load them in a label only in some ocasions (other ocasions remains with no icon), the bellow code is for bitmap but not for icons! well it loads but i get edges in white color
Assembly myAssembly = Assembly.GetExecutingAssembly();
Bitmap mybit = new Bitmap(myAssembly.GetManifestResourceStream("UserControl_Page.icons.error.ico"));
Image img = Image.FromHbitmap(mybit.GetHbitmap());
ToolStripStatusLabel_InfoBottom.Image = img;
how can i do this for an icon file???
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I am working on a SDK. It is currently for our use, but one day it will be licensed to our customers. I need a way to ensure that the only code that uses the SDK is our code. Our code is signed (Strong Name). I was thinking that it would be great if there is an Init function or Load event I could use to check that the assembly loading mine was signed with our key. Does such a thing exist? Do you have an alternative idea?
Pat O
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|