|
Thanx a lot, looks correct.
|
|
|
|
|
Hi,
I've also this type of problem. How can I run the server on a remote machine ?
I discover DCOM - COM programmation (in .Net) and I've just be able for the moment to create a client - server on the same machine and the server is instancied by the client. (1 instance of server by client).
I would like to run the server on a remote machine, and call it with clientS and to get then only one instance of the server.
Thks a lot
Denis
|
|
|
|
|
My problem is that i trye to move some bit's from one byte in spacific position to another byte in the same position
EX.
Byte :A = 11111111
Byte :B = 00000000
let us say that i want to move the last 4 bits in A to the last 4 bits in B my result should be
A = 11111111
B = 00001111
and thatnks verey much
|
|
|
|
|
|
thanks you for your answer
but i found a problem onit it give me a error message which say that the int cannt be converted to byte
where is the problem here i try to solve it
thanks again
|
|
|
|
|
|
Hi
Im using C#,ASP.NET
I Pass Form Instance of a WebForm to another class(.cs) and Hide the Controls in the webform.I can do this by calling the method of .cs in Page Load.I have to do this for many webforms.In this case i have to copy all method calls in all WebForms Page Load.
If I can Get the Form Instance of Requesting WebForm in Global.asax.cs it would be easy so that i can have the Method Call in GLobal.asax.cs file's Application_BeginRequest Method.
Please Help me in This.
Thanks in Advance.
Regards,
Rajesh Thomas.
|
|
|
|
|
Hello all.
I have a little problem, rooted in the fact that I'm a newbie coder.
To get down to business, what I'm trying to do is this:
I have a list of status codes that I use, for example:
BLAH = 1
FEMALE = 2
POISONED = 4
FOO = 8
BAR = 16
etc...
HIDDEN = 128
and I then construct a status indication code from that. Say for example that I am Hidden (128) and Poisoned (4) then that would yeild 132. See where I'm going with this?
Well, the problem I have is reversing it. How do I check if I am poisoned? Some voice int he back in my head is tellingme something about XORing backand forth, but I have no clue where to start with that. I really want to avoid 300 if checks to see if the poisoned person happens to be female, or god forbids, also hidden.
What I want is that once a status is detected in the total 1-byte (0-255) code it should toggle an assigned bool accordingly, for example - status 4 should set isPoisoned = true.
Any easy way to do this?
I'd be eternally grateful.
|
|
|
|
|
Sure, it's quite easy.
First, you should define an enum with your status flags:
[Flags]
public enum Status
{
Hidden = 1,
Poisoned = 2,
Sleeping = 4
} In your class you can have an attribute for the status:
protected Status characterStatus; and, if you like, properties for the single flags:
public bool IsHidden
{
get { return (characterStatus & Status.Hidden) == Status.Hidden; }
set {
if (value)
characterStatus |= Status.Hidden;
else
characterStatus &= ~Status.Hidden;
}
}
Regards,
mav
|
|
|
|
|
Thanks for the reply, it was very helpful.
However, I'm still not sure how to process the numerical status "summary". Because it is an int when I read it I'm not sure how to process it as a "compacted" list of Statuses.
For example, I get "132" so I try to set characterStatus to that, which is "Status" and not "int" so I'm a bit lost there.
To explain more in depth what I'm doing here... I'm writing a little program that reads certain memory addresses of a game, and should display a little window with colored boxes indicating whether I'm, say, poisoned or not (green box if so, red otherwise).
The status byte is therefor 0-255, and I have to make "sense" of that, in term of enumerated statuses. Perhaps I'm going about it the wrong way.
|
|
|
|
|
|
In which way are you going to "process" the status? It's a list of values that can be OR'ed to form an integer, nothing more, nothing less.
In the example, if you want to set several status bits in one go, you can write
characterStatus = Status.Poisoned | Status.Sleeping; which is equivalent to writing
characterStatus = 6; In order to colorize a box you'd write something like
Color boxColor = IsPoisoned ? Color.Green : Color.Red; with the IsPoisoned property implemented similar to IsHidden in my previous posting.
The reason you're getting integer values when you query the characterStatus is that Enum s are based on integers (Int32 IIRC) by default. You can use different data types (for example Int16 or byte ) if you write
public enum Status : byte Regards,
mav
|
|
|
|
|
Hi all,
I've used VS.NET to add my own counter category, but it's only on my machine! If I run my app on anohter machine, the category's not there. How do I create the category on other machines?
Do I have to build some kind of setup project to do it, or do I have to do it in my code: something that creates the category on app-startup and removes it on app-shutdown.
thanks...
/=/=/=/= Sagmam =\=\=\=\
|
|
|
|
|
hi
I'm a Korean student.
I'm studing C# and image processing.
I am reading a book, the book's name is GDI+ Programming wrote by you.
I'm studnig 16bit RAW image file.
But I did'nt display on screen.
How can i do?
please help and detail information.
-----my programming source is here -----
FileStream fs = File.Open(strFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
BufferedStream buf = new BufferedStream (fs);
BinaryReader r = new BinaryReader(buf);
Bitmap bitmaps = new Bitmap (_Define._ImageWidth, _Define._ImageHeight, PixelFormat.Format16bppGrayScale);// .Format48bppRgb);
BitmapData bmData = bitmaps.LockBits (new Rectangle(0, 0, _Define._ImageWidth, _Define._ImageHeight), ImageLockMode.ReadWrite, PixelFormat.Format16bppGrayScale);
bitmaps.UnlockBits (bmData);
UInt16 *p = (UInt16 *)(void *)bmData.Scan0.ToPointer();
UInt16 swap;
int nTotal = _Define._ImageHeight*_Define._ImageWidth;
byte [] data = new byte [nTotal];
try
{
int nPer = nTotal / 10;
int nCnt = 0;
for(int y = 0; y < nTotal; y++) // 원본을 로드하기위한 For문...
{
if (y%nPer == 0) {
pLoading._Percent = nCnt;
nCnt += 10;
pLoading.Refresh ();
}
swap = (UInt16)(r.ReadInt16 ());
*(p) = swap;
p++;
}
}
catch(Exception fo)
{
MessageBox.Show(fo.ToString());
}
// m_pPanel is View
MDProcess.ImageObject pImage = new ImageObject (m_pPanel);
pImage._ImageName= strFileName;
pImage._rcBound = InitImagePT (iFiles);
pLoading._Percent = 100;
pLoading.Refresh ();
m_alImageList.Add (pImage);
pLoading._Counter = i;
pLoading._Total = alFiles.Count;
pLoading.Refresh ();
bitmaps.Dispose ();
fs.Flush ();
buf.Close ();
fs .Close ();
r.Close ();
|
|
|
|
|
i want to write a HighLight porgram, but i do not know how to match this string :
/*123adfadfr55543sttttt
adfdafeefefefefe
ddddghhhh*/
|
|
|
|
|
|
I don't understand - why do you need regex to match a constant string ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi there,
How to change UI(e.g. Menus)Labels in MDI Form? I'm using Localization for Multilingual Support. It is OK in childForm When CultureInfo object set to CurrentThread.CurrentCulture and CurrentUICulture. I want to change language on the spot without having to reload MDI form.(For example when change language menuitem click).How can I do for that?
I would like to know how to handle in your application situation like this?
Thanks in advance.
|
|
|
|
|
Hi, i'm trying to draw on the desktop...made the following code from combination of stuff i found on internet
[DllImport("user32.dll")]<br />
private static extern IntPtr GetDC (IntPtr hwnd);<br />
<br />
[DllImport("user32.dll")]<br />
private static extern void ReleaseDC (IntPtr hwnd, IntPtr hdc);<br />
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
IntPtr deskDC = GetDC(IntPtr.Zero);<br />
using (Graphics g = Graphics.FromHdc(deskDC))<br />
{<br />
g.FillRectangle(Brushes.Green, 100,100, 100,100);<br />
<br />
}<br />
ReleaseDC(IntPtr.Zero, deskDC);<br />
}
The problem is when you drag windows over what you drew...windows erases. I could just dump the drawing into a thread or timer but thats wrong...i want to somehow listen to the desktop's windows messages and paint when it paints...any ideas?
|
|
|
|
|
hmm, i put the draw in a while loop and i didn't like the resuts...it draws everywhere...not just "over the background image" like i was trying to achieve.
|
|
|
|
|
Can anybody tell me how to make the application start with windows?
thanks a lot.
|
|
|
|
|
You have to create a key in the registry, in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
They key name doesn't matter, but the key value must be the full path to your executable (try Application.ExecutablePath ).
Use the Registry and RegistryKeys in the Microsoft.Win32 namespace.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I am writing a keyboard hooker for a study that I want to run. That study requires that the program run all of the time (as it is analysing all of the text that is input into the keyboard). As I am likely going to slow down the computer a lot on mere merit that I am putting a system wide hook on the keyboard, I have another question. Where should I be running the interpretation code from? I was thinking that I should likely run this as a Windows service but I would appreciate input. Thanks a lot,
Jim
|
|
|
|
|
Esmo2000 wrote:
Where should I be running the interpretation code from?
Your hook procedure must reside in a DLL by itself. I recommend you put in this DLL the least possible amount of code, because it will be injected into every process.
It really doesn't matter (in terms of slowing down the computer) if your program (the one that installs the hook) is a service or a regular app, since it will only run once. But a service has de added benefit of capturing text while no user is logged on (eg. the logon sceen -- correct me if I'm wrong.)
I would reccomend writing your DLL in plain old C/C++ (without the .NET or MFC) because it (and the DLLs it requires) will be loaded into every process.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Thanks a lot, that helps greatly. Perhaps I should ask another question while I am at it.
I want to run some statistics on all of the text that I interpret. At what point should I do this? What I was thinking of doing was to simply keylog every stroke that comes my way and on a daily basis (or some other set time frame) run the statistic analysis from a windows service.
Here is my question:
At what point should my code commit the changes to hard drive? File IO is a pretty taxing process, so I was thinking that I should keep as much of the typed text as possible in RAM and commit them to some point on the hard drive as infrequentlf as possible. However, that poses another probem; As the code is injected into each process seperately, there will not be the consistency that I require. The text has to be stored in order.
How do I deal with this problem? Thanks a lot!
|
|
|
|