|
Hello,
I would like to translate arithmetical operation to executable ASCII code.
I mean to find the ascii of '+' operator (lets say it's stored in tmp), and then to execute this operation like
int result += num1; but in the next order int result tmp= num1;
is it possible ?
Thanks
|
|
|
|
|
|
hello all i am facing a problem that i do not know how to solve so i'm seeking advise here
private void button2_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox2.Image = new Bitmap(open.FileName);
textBox2.Text = open.FileName.ToString();
Bitmap DatabaseImage = new Bitmap(pictureBox2.Image, 320, 240);
pictureBox2.Image = DatabaseImage;
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
How do i use the DatabaseImage in another button instead?
|
|
|
|
|
If You Declare Any Variable in the Event or method ...
That variable will be only accessable in that event or method..
i.e. Scope of that varialble is limited to that mentod of event..
If you want to use any variable(i.e same variable ) in more than two events declare it outside of the scope of menthod.
means declare it in you class
i.e
class abs
{
declare Here variables;or assgn values
method1()
{
}
method2()
{
}
}
so that you can use same variable value in method1 and method 2
In your case databaseImage Variable(Bitmap) is declared in button2_click()
so you can only acces it within button2_click()
Declare databaseImage above all methods and use it in button1_click() as wel as Button2_click().
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(open.FileName);
textBox1.Text = open.FileName.ToString();
Bitmap finalImage = new Bitmap(pictureBox1.Image, 320, 240);
pictureBox1.Image = finalImage;
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox2.Image = new Bitmap(open.FileName);
textBox2.Text = open.FileName.ToString();
Bitmap DatabaseImage = new Bitmap(pictureBox2.Image, 320, 240);
pictureBox2.Image = DatabaseImage;
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
private void button3_Click(object sender, EventArgs e)
{
}
I want to make use of finalImage and DatabaseImage in button3_Click event how shld i go abt it? i tried declaring above all emthod but it dont seems to be working.
}
|
|
|
|
|
Go back and reread the answer you were given. You might even want to pickup a beginners book on C# because it's apparent that you don't understand the basic concepts of "scope". If you want to use finalImage outside of the event handler, it has to be declared outside of the event handler. You then set finalImage's value (bitmap) inside the event handler.
|
|
|
|
|
|
Gud You solved your Query..
You are always welcome for more queries
|
|
|
|
|
Hi,
i'm writing a small application
and i want to control the webcam for another application that i got on the same PC.
i want to be able to start playing the video, and to stop playing it.
can anyone assist me?
Thanks,
Zvi
|
|
|
|
|
You can't. First, the device is only available for a single application at a time. Second, any settings your app lays down will be overwritten by the application that is really using the camera. You also cannot control when the other application sets these settings, so it'll quite possibly overwrite whatever you set. The normal operation is to setup the cameras settings right after opening the camera and before starting the cameras video feed. Once the camera is opened, your application cannot get at it to make changes.
|
|
|
|
|
Sounds nefarious to me.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Not getting your question.
we can justice with your question when you did first.
|
|
|
|
|
well,
what i'm realy doing is writing an application for controling a Lync client.
I am using the Lync client SDK,
i was able to do all the actions that i wanted, except turning the camera on and off.
So i wondered if there is any way to do it from my application when i have the device ID.
Thanks
|
|
|
|
|
Hello Friends,
Can anyone out there let me know the maximum no of rows and columns excel in all excel versions like 10.0, 11.0 and 12.0?
Thanks
Varun
|
|
|
|
|
This[^] or this[^] might help.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Thanks Abhinav, I by mistake voted the answer bad sorry for that
|
|
|
|
|
you can easily fix that by voting again, it'll replace your previous vote.
|
|
|
|
|
Varun Sareen wrote: Thanks Abhinav, I by mistake voted the answer bad sorry for that
No problem. Things appear to be fixed now.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
|
|
|
Varun Sareen wrote: Thanks dear
you are welcome.
|
|
|
|
|
I need an activeX which handles global hotkey: Shift+b
The code below is supposed to do this when I call this ActiveX from IE.
I see the result of RegisterHotKey is true which means that the hotkey has been registered Ok.
But I don't see that any messages come to the ThreadPreprocessMessage method.... why????
Please help.
Thank you
namespace Kosmala.Michal.ActiveXTest{
public class ActiveXObject : NativeWindow, IDisposable {
public const int WM_HOTKEY = 0x0312;
private IntPtr pFoundWindow ;
public ActiveXObject(){
System.Windows.MessageBox.Show("constructor<<");
Process[] processes = Process.GetProcessesByName("iexplore");
foreach (Process p in processes){
pFoundWindow = p.MainWindowHandle;
}
System.Windows.MessageBox.Show("pFoundWindow:" + pFoundWindow);
SetupHotKey(pFoundWindow);
ComponentDispatcher.ThreadPreprocessMessage += ComponentDispatcher_ThreadPreprocessMessage;
System.Windows.MessageBox.Show("constructor>>");
}
void ComponentDispatcher_ThreadPreprocessMessage(ref MSG msg, ref bool handled){
System.Windows.MessageBox.Show("inside handler");
if (msg.message == WM_HOTKEY){
System.Windows.MessageBox.Show("inside handler");
}
}
private void SetupHotKey(IntPtr handle){
bool res = RegisterHotKey(handle, GetType().GetHashCode(), 0x0004, 0x42);
System.Windows.MessageBox.Show("SetupHotKey res:"+res);
}
public void Dispose(){
UnregisterHotKey(_host.Handle, GetType().GetHashCode());
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
}
modified on Friday, November 26, 2010 8:03 PM
|
|
|
|
|
Please remember to properly format the code you post using the pre tags, i.e. the "code block" menu item above the textbox. Many people will not read or answer a post that does not follow the guidelines that have been clearly posted here.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
FWIW: I've never used ComponentDispatcher nor its ThreadPreprocessMessage, maybe this is a WPF app? For a WinForm, I would use a visible Form (possibly off-screen, i.e. with fake Location) and override its WndProc. And then the app needs to run as administrator on Vista/Win7 for the (un)RegisterHotKey to work properly.
|
|
|
|