|
Sorry, my English is bad. I mean I want to use "using" statement which is at the beginning of each cs file to import the namespace of the proxy class.
regards,
George
|
|
|
|
|
You will need to know the namespace that the classes you want to reference lays in. You use that namespace with the using clause at the top of your class:
eg.
namespace SampleNamespace
{
public class SampleClass
{
public static object oValue;
}
}
This you can use as:
using Samplenamespace;
public class Foo
{
public void Boo()
{
object sampleValue = SampleClass.oValue;
}
}
Hope this answers your question.
|
|
|
|
|
Thanks bcozican,
My question answered.
regards,
George
|
|
|
|
|
Hi all,
I would like to know when making use of the 'using' keyword and an exception occurred, will the exception be catered for in the 'using' scope?
Thus, if one would look at the following example(s), and lets say an exception occurred within the 'using' block below, will the exception be catched?:
Font font1 = new Font("Arial", 10.0f);
try
{
byte charset = font1.GdiCharSet;
}
finally
{
if (font1 != null)
((IDisposable)font1).Dispose();
}
using (Font font3 = new Font("Arial", 10.0f), font4 = new Font("Arial", 10.0f))
{
}
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Thanks...
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
You are welcome
|
|
|
|
|
It will be caught, eventually, but not by your try/catch block as shown. If you want your 'using' exceptions caught then the using needs to be in a try/catch block.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: If you want your 'using' exceptions caught then the using needs to be in a try/catch block.
Thanks that was helpful...
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
The using block generates a try...finally block. That ensures that the object is disposed even if an exception occurs, but it doesn't catch any exceptions.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks for your response, it was very helpful.
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi All
I want to send a Keystroke to the window of other application.
I have got the Handle of that window.
Is there any API or Managed C# code which will directly send the Keystroke only to that window.
setting the window to foreground and then sending the keystroke is working fine.But in the meantime if the user click on other window that window becomes active and the keystrokes are send to that window not to that window for which it was meant.
I have also studied about SendMessage Api
SendMessage Function
Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.
Syntax
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
But i do not know how to put Keystrokes input into msg variable
Does anybody know how to send only to particular window?
Thanks in advance
THE SK
(Sandeep Kalra)
I am the One
|
|
|
|
|
hWnd is the handle of the window that you want to receive the message. This is explained in the MSDN sendmessage [^] docs.
The message you want to send is probably WM_KEYDOWN and then WM_KEYUP. (You can find a full list of the messages and their numbers here[^])
Look here[^] for an explanation of the WM_KEYDOWN message, and what to put in the wParam and lParam parameters. You can use google to find a similar doc page for the WM_KEYUP message.
Simon
|
|
|
|
|
i have developed an app that have 1 array of int type with 3 elements, assign their values on Load event. Assign a timer that keep write their values in a textbox. Next, i run that app and got the first element offset in kernel32.dll by using a software. Now i want to write new values to that array from another application by using that offset i got. for example
int[] Xarray = new int[3];
private void Form1_Load(object sender, EventArgs e)
{
Xarray[0] = 61457899;
Xarray[1] = 44527899;
Xarray[2] = 832429;
}
i got address of first element(of Xarray) that is 0x1D52EF4 then the next element value i can find it on 0x1D52EF8 and third one on 0x1D52EFC
so if i write from another application like this
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF4), ref Newvalue, 4, 0);
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF8), ref Newvalue1, 4, 0);
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EFC), ref Newvalue2, 4, 0);
[DllImport("kernel32")]
public static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref int lpBuffer, long nSize, long lpNumberOfBytesWritten);
then it will write Newvalue successfully, but i cant do because here are only 3 elements what if i have 100. Therefore, i made a struct that have 3 int variables but when i try to write it nothing happens. Here is code
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF4), Xstruct_instance, 12, 0);
[DllImport("kernel32")]
public static extern Xstruct WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, Xstruct lpBuffer, ref long nSize, long lpNumberOfBytesWritten);
[StructLayout(LayoutKind.Sequential)]
public struct Xstruct
{
public int Newvalue;
public int Newvalue1;
public int Newvalue2;
}
anyidea guys to solve this ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
A struct is a value type, so it will be allocated as a part of the application object instead of as a sepearate object on the heap, so it will have a completely different memory address.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
can you explain in little more detail ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
When you create an array it is created as a spearete object on the heap outside the Application object. When you create a struct as a member of the Application object, it will be allocated on the heap as part of the Application object. Naturally the address of those variables will be different.
Also, you can't rely on the address of anything that is allocated on the heap being the same every time you run the program. Subtle differences like user culture settings can easily change the number of objects allocated at startup.
Besides, the garbage collector can move any object on the heap at any time (unless the object is fixed).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
oh...but that was just an example, my original work is on a game where it has a fixed offset. I dunno what developers used, an array or struct but i know its all format (float then an interger then something). It was very time consuming to check effect in game so i made my own app and checked in it. Now any idea ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi, I have created one windows service.
Now i want to run any GUI made in C# as Schedule time.
Plz give me any idea?
Thanx in Advance......
|
|
|
|
|
Hi,
You can simply schedule the service through Scheduled Tasks in windows. Go to control panel --> Scheduled Task and add a new task for your service. You can install your service as well and it will run in the background and performs your task according to your requirements.
Regards,
|
|
|
|
|
Thanks for response...Can we do this Programmaticly.
|
|
|
|
|
|
Thanks.... it's very helpful....
|
|
|
|
|
Glad to help you
|
|
|
|
|
how to make "yahoo answers" website like paging list control(horizontal list with page nos in boxes style) in C# windows application..
In this type of control i wanna generate list of page nos dynamically..with proper style like hover.
example can also be seen in windows live search results at microsoft website. pl suggest solution for this..
|
|
|
|