|
how to find the exact byte and replace it. is there any class / method available in c# 2.0?
|
|
|
|
|
You are opening the file as a text file and so the codepaging is going through and saying 'bad c-cedilla, we no know you' and baneshes it to the wind.
Try opening the file as data and searching the bytes for the cedilla and blapping it.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
how to do this, i mean which class i can use to open the file as data and then look for the specific byte for cedilla?
please help, thanks
|
|
|
|
|
The FIRST class in System.IO is BinaryReader . Guess what it does?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
i think diffrent encoding make this problem
to solve this problem without any knowledge about encoding use System.IO.StreamReader and depending on size of file use ReadToEnd or ReadLine method. this two method return string and with on loop search and replace you characters and if use ReadToEnd method close file and write to file with System.IO.StreamWriter and if user ReadLine you must use temp file [Get temp address with string System.IO.Path.GetTempFileName()] and when reading and replacing complete delete main file [System.IO.File.Delete(string path)] and copy temp file System.IO.File.Copy(string path1,string path2)]
|
|
|
|
|
Sorry for late reply, due to sudden illness.
But friendz, none of the solution able to recognize the special character. is there some thing i m missing?
please reply.
|
|
|
|
|
I am creating a windows service where the employees get automatically logged into database when they start their computer. For this my service require the windows logged in username. Environment.UserName is not working. Is there any other tried solution?
puranonnet@hotmail.com
www.ibrinte.com
|
|
|
|
|
System.Security.Principal.WindowsIdentity.GetCurrent().Name will get you the user that the service is running as, but services generally run under special user accounts like "Local Service". Services also start before the user logs on so you can't just set it to run under the currently logged on user, because there might not be one.
Services aren't really meant to be tied to the logged on user. What would happen if you had two users logged on at the same time (which can happen). Perhaps you should consider making your app a normal client based app (but with no GUI) and stick a short cut to it in the start up menu.
You should also probably be using windows authentication instead of getting the user name.
Simon
|
|
|
|
|
hii
any one can tell that how make setting in enterprise library in the connection string there should be sqlconnection but i have 4.1 version of enterprise,in this there is option ORACLE PACKAGE in data access application block.
what the problem in this,is that installation problem
rizvan sivally
|
|
|
|
|
0. very very badly written statement/question.
1. Try the database[^] forum; tell them I sent you.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi forum............
Can anyone give my any sample for message handling. I am working on a program which should receive a message sent by any other program. These messages will be the keyboard keys (WM_KEYS). So please give me any example; how to handle a message sent by other application using SendMessage API.
Thanks in advance......
Vishal Moharikar.
|
|
|
|
|
Instead of using message passing using SendMessageAPI, i would recommend you to use FileWatcher. Let one application write in it and the other application read from it.
This is a better way of doing it.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Hi Ahsan.......
Thanks for your quick solution.....but I can not use this solution. Actually the second application is pre-build and I can not modify it. Also the second application is written some other language which actually hooks the keyboard events and change its character to any desired language (other than English) character. Besides this task (character interchange) it sends the actual keyboard character to the calling application for its use.
This message passing is done via SendMessage API and I have no idea how to handle the messages. So please help; how can I receive the messages and use them.
Thanks once again....
Vishal Moharikar.
|
|
|
|
|
Why? Message passing is easily more efficient than writing a file, sending a message to all processes which are hooked to the file system, propagating that message and reading the file. And it requires more permissions than simply calling SendMessage, which isn't quite so good if running from an intranet
|
|
|
|
|
To receive a message, you simply override the WndProc method of a Form. I'm not certain that you can receive every message sent (unless they're broadcasted to every Form). However, if you are simply receiving the keyboard keys, then you could simply hook the keyboard. Look at this article for more details
|
|
|
|
|
Sounds like a very strange approach. You're sending fake keystrokes for inter-process communication? Good luck my friend.
If its the SendMessage I'm thinking of you'll need an hWnd to send to. How is the sending application determining this? FindWindow perhaps?
In the receiver, you'll need to derive a window or a control or something and override the WndProc to capture the incoming messages. This is as dodgy as it gets, and I wouldn't even be certain it would work in modern versions of Windows.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: I wouldn't even be certain it would work in modern versions of Windows.
By which I mean inter-process. A protected operating system has some responsiblity to stop one process interfering with another, so wouldn't be surprised if it blocked keystrokes sent from other processes when they should really only come from keyboards. Only a guess though so I might well be wrong.
Regards,
Rob Philpott.
|
|
|
|
|
Hi Rob...
Thanks for your comments....
I am using one application which hooks all the keyboard events and change the character according to its predefined rules. This helps to perform language typing other than English.
I want to know how to handle any message sent by SendMessage API. Please help.
Thanks...
Vishal.
|
|
|
|
|
vishal moharikar wrote: I am using one application which hooks all the keyboard events and change the character according to its predefined rules. This helps to perform language typing other than English.
What does this have to do with SendMessage() ?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I'm really not sure I can offer much help as I don't fully understand what you're trying to do.
SendMessage sends a message (of WM_ form) to a WndProc (every Window has one) with an LPARAM and a WPARAM, and its been this way since the dawn of time.
As I suggested before, derive something from Control and place it on a form. Provide an override to the WndProc and check the Message parameter for whatever message it is you want. (Something like WM_KEYDOWN, WM_KEYPRESS etc.)
You'll then need to configure the sending application to send the messages to that window.
As I said before I'm doubtful whether one process can send messages to the WndProc of another process.
Spy++ is a useful tool for finding the names and classes of windows and watching what messages are being sent.
Regards,
Rob Philpott.
|
|
|
|
|
If I understand you correctly then if you add the following code to the program.cs then you will be able intercept messages being passed to your app. Hope this helps.
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
MessageFilter messageFilter = new MessageFilter();
Application.AddMessageFilter(messageFilter);
}
internal class MessageFilter : IMessageFilter
{
bool IMessageFilter.PreFilterMessage(ref Message m)
{
switch (m.Msg)
{
case 0x100: //MSG.WM_KEYDOWN
if ((int)m.WParam == (int)Keys.F1)
{
}
}
}
}
Mark
|
|
|
|
|
Hi,
How to fill a combobox with avalue from 20-100
Thankyou
YPKI
|
|
|
|
|
for(int i = 20; i <= 100; i++)
{
comboBox.Items.Add(i.ToString());
}
|
|
|
|
|
for(int i=20;i<=100;i++)
{
cmbName.Items.Add(i.ToString());
}
Hope this help..
|
|
|
|
|
I guess what you need is to Set minValue = 20 and maxValue = 100
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|