|
Hi,
I am trying to solve a problem using C#. Basically it invovles capturing any application in the form of image. lets say the active application is acrobat reader, My application has to capture the image of the window of it and send it across the network.
Networking part is very easy in C# but capturing the image of other applications i could not find a way. Please tell me if i can do that with other lnaguages like c, C++.
eligeti
|
|
|
|
|
eligeti wrote:
Networking part is very easy in C# but capturing the image of other applications i could not find a way.
To capture an image of a visible window, you need to use GDI and BitBlt. IF the window is not visible, you can use WM_PRINT and/or WM_PRINTCLIENT.
Not exactly for newbies, but you can find a lot of samples on how to do this on Google.
Yes, even I am blogging now!
|
|
|
|
|
Hey I have created a Listview with labelEdit property set to true.
But for the label to become editable it requires atleast 2 clicks.
How can I make it editable on a single click ??
If i set the Activation property to single_click it cant be edited at all
|
|
|
|
|
On the click event, call:
SendMessage(yourListView.Handle, LVM_EDITLABEL, itemToEdit, 0);
and add the following declarations to your class:
[DllImport("User32.dll")]
public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
const int LVM_EDITLABEL = 4214;
Yes, even I am blogging now!
|
|
|
|
|
Hi
I have this code
<br />
string name = "tabPage0";
mainTabs.TabPages.Add(name);<br />
Then I would like some way to set tabPage0.Text How is this done?
Thanks
|
|
|
|
|
You could just write a function that will dynamically add new TabPage 's for you. Something like the following will do it for you, this assumes the TabControl is a member of the same class of this method. You could change this if you needed but this should get you started.
private void AddNewTabPage(string tabText)
{
TabPage tp = new TabPage(tabText);
this.TabControl.TabPages.Add(tp);
this.TabControl.SelectedTab = tp;
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks, I wasn't very clear. I was looking for a way to dynamically name tabs. How could I create a function to add tabs with different names for each one?
|
|
|
|
|
You can use the method I wrote above, write a separate method to randomly generate text and with each text generation, call my method to create the TabPage .
- Nick Parker My Blog | My Articles
|
|
|
|
|
If I'm understanding correctly, what you are trying to acheive cannot be done.
You cannot name a control and then use its name in your code as you would with any other variable. That isnt possible because the compiler will not know of the name ur assigning as it will only be "visible" in runtime.
That means that, follwing ur example:
string name = "tabPage0";
mainTabs.TabPages.Add(name);
You will never be able to use in your code tabPage0.WhateverMethod. That can only be done if u declare a tabPage0 variable in ur code.
U will have to work with the tabpages collection indexes or iterate through it looking for the correct Text/Name or whatever.
|
|
|
|
|
I am trying to draw a Family tree onto a panel by adding several custom panels that contain the data about each person in the tree. I have all the panels displaying but my formula for working out where to place each custom panel is placing them incorrectly.
This is my formula.
child is the custom panel one generation back in the tree and the index is set according to its vertical position in the generation (i.e the one nearest the top of the panel is 1 and the next lowest 2 and then next lowest 3 etc..)
generation is the generation the the animal belongs to (1 being the initial person, 2 being the parents, 3 the grandparens)
pw = the custom panel width, hg = the gap between generations, pd = the custom panel height, paneldepth = the main panel height
I want the tree to draw left to right.
The x co-ordinate works fine its the y co-ordinate that doesnt work, it causes earlier generation to be too close together.
// Set Panel Location
int x = child.Location.X + pw + hg;
int y = ((paneldepth / (generation + 1)) * ((2 * child.Index) - 1)) - (pd / 2);
parentpanel.Location = new Point(x, y);
Can anyone suggest a formula that might work?
|
|
|
|
|
I would like to read unicode from INI in my application. Reading from GetPrivateProfileString is ????
For example..
I want to read and display Thai Words in my application.
[Thai]
Card=บัตร
Thanks in advance.
|
|
|
|
|
You can P/Invoke the GetPrivateProfileString as I did below, string 's in .NET are unicode.
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, uint nSize, string lpFileName);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi
Use GetPrivateProfileStringW (notice the W)
That's the unicode version.
|
|
|
|
|
I have a network application. These two application has a form on which two label controls are present.
Please see the diagram...
Host1 Host2
Form1.cs Networkoperation.cs Form1.cs
Networkoperation.cs class actually handles the communication between the two applications.
What I Want? I want to have button on each form If I click the button the text present in a textbox on the form has to go the same label control and should be assigned to the Text property of the control.
I am unable to do this, Because how to get the handle of label control of form1.cs class in networkOperation.cs Class?
Any one who knows it Please help to me.
|
|
|
|
|
Hi!
I'm wondering if there are any free texteditor components out there where you can have syntax hightlighting for multiple languages?
If not, any good articles on how to acomplish this yourself?
Thanks in advance!
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
Martin Lundberg wrote:
If not, any good articles on how to acomplish this yourself?
There are articles online that cover how to do this using a RichTextBox class. This[^] one should get you started.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Hi,
I want to select a member of TabControl by stroking keyboard but not by clicking the mouse on it.So,I think I have to create a shortcut key for that member.Can you tell me how to create it?
Thanks!
|
|
|
|
|
i'm not certain what you mean. but if i understandyou properly you want a control to gain focus when a button is pressed?
well i havn't done anything with tabs (never needed to) but here's the general code.
goto the events list on the form that the tabs are on and create a KeyDown handler by double clicking on it.
in the handler do something like this...
if(e.KeyCode == Keys.____)
{
tc.focus();
}
e being keyeventargs, tc being your tab control.
i hope that helped a bit
|
|
|
|
|
Here[^] is an article on creating keyboard accelerators in C#. This should get you started.
- Nick Parker My Blog | My Articles
|
|
|
|
|
After this code EndofHeader is still zero.
Why?
FİleInfo fp = new FileInfo(path);
FileStream file = fp.Open(FileMode.Create);
StreamWriter sw = new StreamWriter(file);
sw.WriteLine("{0} {1} {2} {3} {4} {5}",m,0,-1,1,1;
EndofHeader = file.Position;
balkan
|
|
|
|
|
You could try
sw.WriteLine(String.Format("{0} {1} {2} {3} {4} {5}",m,0,-1,1,1,1));
one argument is missing, and String.Format too...
try adding sw.Flush(); after WriteLine
Hope it'll help...
Robin Panther
|
|
|
|
|
i need some help in validating the contents in property grid in c#.
if anyone knows about this kindly answer the question.
sundar
writesundar@yahoo.com
|
|
|
|
|
hello i want to trap enter/return keystrokes in my custome control no matter wich control withint the custom control has focus i basicly want my control to have an ok button that always reacts to the enter key how do i make this happen?
|
|
|
|
|
your custom control needs to have a keydown handler.
if possible make it extend the Form class, then you can just set the AcceptButton.
|
|
|
|