|
hi all,
am wanting to write a program that will sit in tray and wait for a key combination. when the combination is detected it will maximise my winform.
should i be using global hooks? or is this acheivable another way in c#?
kind regards,
g00fy
|
|
|
|
|
I beleive a Global Keyboard Hook is the answer.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
yes thank you,
i found a cp article (or two) that will work just fine.
the program i am creating is to take screen dumps. what i would also like is to be able to (on hotkey) change the cursor and draw a bounding rectangle for the image.
any ideas on how to draw a rectangle outline onto the screen ?
kind regards,
g00fy
|
|
|
|
|
Hi,
I am trying to build my custom listbox control. The problem i am having is
that, if my list box shows 10 items and i have for suppose 20 items in it. now
when a user scroll down using lstBox 'VScroll' control then my application
doesn't know that the user has scroll down. Any Suggession without using
"Selected IndexChange " or "Click Event" or "Key Down" Events.
|
|
|
|
|
How are you creating your custom listbox?
Are you designing it from scratch or inheriting from the existing listbox control?
Ed
|
|
|
|
|
hi Ed,
Sorry for the ambiguity in my question. Yes, I am inheriting from the listbox control. I am having the problem metioned earlier. Thanks for the reply.
|
|
|
|
|
In that case can't you just override the OnDrawItem method?
protected overrides void OnDrawItem(DrawItemEventArgs e)
{
}
If you need to resize each item based on their contents then you can override the OnMeasureItem method.
This should automatically display the scroll bars as and when they're needed, you only need to take care of drawing one item at a time also.
Ed
|
|
|
|
|
hi Ed.Poore,
I am posting this message just by reading yours, so plz hear out my problem in detail. I hope your suggestion works. Now problem i am having is when ever a user scroll down or up, some items also go up/down. Now i have to find out when user used the scroll bar of the list box, how far down/up he went. Then i can use the topIndex property to map my items as mapping is done in sql Server diagrams. I hope i did explained myself clearly.
Thanks again.
|
|
|
|
|
Ah, I see it clearly now, you will have to trap some events for the scrolling. Looking through the documentation it might be easier to create a composite control which has a listbox, and a couple of buttons for going up and down a page. This would also be more intuitive if there is a delay in the loading.
Ed
|
|
|
|
|
Hi,
I am trying to build my custom listbox control. The problem i am having is
that, if my list box shows 10 items and i have for suppose 20 items in it. now
when a user scroll down using lstBox 'VScroll' control then my application
doesn't know that the user has scroll down. Any Suggession without using
"Selected IndexChange " or "Click Event" or "Key Down" Events.
|
|
|
|
|
I know this is a cheesy solution, but perhaps you could periodically check if the listbox's TopIndex [^] has changed?
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
hi Ravi,
plz tell me which method or event of the listbox will going to help me in checking the top index periodically. Hoping to get the reply soon.
Thanks.
|
|
|
|
|
You'll need to set a timer and check the ListView 's TopIndex property every time the timer goes off.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
hi Ravi,
plz tell me which method or event of the listbox will going to help me in checking the top index periodically. Hoping to get the reply soon. I will also
look at the link you have mentioned. if in case it did provide me the desired result i will post the message for confirmation.
Thanks.
|
|
|
|
|
Can anyone tell me how to read all the nodes and their InnerText of an xml file?
|
|
|
|
|
Use an XmlDocument object to open the file. The DocumentElement propery is a reference to the root element that contains the nodes.
---
b { font-weight: normal; }
|
|
|
|
|
sample to read all the nodes of XML file
string[] sb=new string[4]{"","","",""};
XmlDocument doc = CreateDoc(XmlFile);
XmlNode root = doc.SelectSingleNode("FormatModule/Leads/Contents");
XmlNode root1;
string fieldname;
foreach(XmlNode node in root.ChildNodes)
{
if(root.NodeType != XmlNodeType.Comment)
{
string str=node.Name;
switch(str)
{
case "Body1":
root1=doc.SelectSingleNode("FormatModule/Leads/Contents/Body1");
foreach(XmlNode n in root1.ChildNodes)
{
if(n.NodeType != XmlNodeType.Comment)
{
XmlAttribute name = n.Attributes["type"];
if(name.InnerText=="text")
{
sb[0]+=n.InnerText.ToString()+"\n\n"+" ";
}
if(name.InnerText=="Field")
{
fieldname=n.Attributes["FieldName"].InnerText.Trim();
sb[0]+=DataLeads(id,fieldname);
}
}
}
break;
return sb;
}
Hope u might be knowing how to creaate XML file
Rizwan Afsar
Associate Member, Technical Team
IAP Company Ltd, Gurgaon
INDIA
www.iap-online.com
|
|
|
|
|
Hi,
You can also have a look at the code below..Hope it's useful to u..
class ReadXml
{
//private const String filename = "c:\\ala.xml";
private const String filename ="data.xml";
static void Main(string[] args)
{
XmlTextReader txtreader = null;
XmlValidatingReader reader = null;
try
{
// Load the reader with the data file and ignore
// all whitespace nodes.
txtreader = new XmlTextReader(filename);
txtreader.WhitespaceHandling = WhitespaceHandling.None;
// Implement the validating reader over the text reader.
reader = new XmlValidatingReader(txtreader);
reader.ValidationType = ValidationType.None;
// Parse the file and display each of the nodes.
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Console.Write("\t<{0}>\n", reader.Name); break;
case XmlNodeType.Text:
Console.Write("\t{0}\n",reader.Value);
break;
case XmlNodeType.CDATA:
Console.Write("", reader.Value);
break;
case XmlNodeType.ProcessingInstruction:
Console.Write("", reader.Name, reader.Value);
break;
case XmlNodeType.Comment:
Console.Write("", reader.Value);
break;
case XmlNodeType.XmlDeclaration:
Console.Write("\n");
break;
case XmlNodeType.Document:
break;
case XmlNodeType.DocumentType:
Console.Write("\n", reader.Name);
break;
}
}
}
finally
{
if (reader!=null)
reader.Close();
}
Console.ReadLine();
}
}
Thank you,
Vaibhav
|
|
|
|
|
Hi,
I want to add or remove some algorithms used for SSL on IIS Web server, how can I do,
Thanks,
Hung
|
|
|
|
|
Hello! I have a strange question... I want to write a program that releases files that are in use by something I don't know...
Actually, I don't know where to start... If someone could help, I would be very thankful...
Thanks in advance!
|
|
|
|
|
First, you can't do that. The main reason is you don't control the file handle. Second, you can't clean up the resources in the app that has the file open in the first place. You'll only cause whatever app that is to crash because its file handle disappeared unexpectedly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Firstly, chances are you won't be able to do this solely from the .NET framework. You'll probably have to dip into the Win32 API to find out which processes have loaded a particular file handle. That's where you'll want to start, see how you can get that information from the Win32 API.
Like Dave said, you couldn't really "unlock" the file. You could terminate the process that owns the file handle, if you can find out which process owns a particular file. And I don't know whether or not that's possible...I would guess it is, but I'm not knowledgeable enough to say.
|
|
|
|
|
Can anyone tell me how to write a Base64 Encoded xml file? I ve written the following 2 statements:
XmlTextWriter writer;
writer = new XmlTextWriter("msg.xml",null);
The second argument of XmlTextWriter is presently null, and it accepts the Encoding! Can anyone tell me what do I need to write in place of "null" to write the file as Base64 encoded?
|
|
|
|
|
I'm building a window base application, I'm supposed to use:
public class MemDoc : System.Collection.Generic.List<Member>
It's methods are simple add record, save file, open file.
I have a seperate Member class with all it's assignments and properties including an instance of another class.
Could someone point me to a good resource on how to access this when I'm not using :
static List<Member> MemberArray = new List<Member>
Trish Holt
|
|
|
|
|
Hi Trish.
Your question doesn't sound right, logically. So perhaps we can clear this up:
You're trying to make a class called MemDoc and have it inherit from a generic List of Member objects. Is this correct?
You're trying to access a static variable called MemberArray inside this MemDoc class. Is this correct?
|
|
|
|