|
Hi. i want to make a searh function in a richTextBox.
Just like in notepad or word ect ect i want a textBox there i could write something and then press searh/find and it searhes trough my text in my richTextBox.
How to do this?
Sorry for my bad english and thx.
Regards
//AeQuitaZ
PS. Thx to Yadav Pramod for the last sulution you gave me. thx.
|
|
|
|
|
If you get all the text in a string without formatting, the string class has a member IndexOf that finds the location of a substring. This[^] override will help you, since you can specify the starting position (probably where your cursor is.)
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I am using a 3rd party component in my code and every time there's a particular error occurs in the execution of the component, instead of passing the error to the code that is running it (the component) the developers decided to just make a Message box show up!!
It totally is inconsistent with my program and since my program runs in a loop, if the particular error occurs, the user gets an endless loop of messageboxes that are really hard to kill. You wind up having to go the task manager to stop my program, because you message boxes from the 3rd party component are "dialog" (or whatever it's called) so you have to click the button and don't have access to my program's window. Very bad programming ethics on their part.
So, I was wondering if there is a way to suppress the messagebox from the 3rd party component? I don't have access to the components source either.
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: I was wondering if there is a way to suppress the messagebox from the 3rd party component?
I know this isn't the answer you're looking for, but I would seriously consider dumping the component. However, before I do that, I'd check the documentation for error suppression flags and confirm the message boxes aren't being shown because the component is running in unlicensed (demo) mode.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Yeah, I can't dump it and the docs def. don't say anything about it. They're just lazy.
/\ |_ E X E GG
|
|
|
|
|
As Ravi suggested, I'd throw the component away and find another one (or develop it myself.) If you manage to kill this message box, you don't know if there are more hidden just waiting to pop up with your best customer.
As to how you could kill it, a WH_CBT Windows hook probably would do it.
eggie5 wrote: are "dialog" (or whatever it's called)
It's modal (disables parent window) and modeless (doesn´t disable parent window)
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Asking them devs to fix it would be best but Luis hooking will work or you can remove the message box dialogs completly by debugging the control and noping the calls to the dialog.
|
|
|
|
|
In any case (hooking or patching), there will be problems when a new version is released (most likely with patching.)
Making the developers fix that probably would be hard, altough he can try. If a component-developing company allows that code to be released, I would expect great customer support. Altough I might be wrong.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Can you explain this "hooking or patching" process to me? I"m not quite sure what you mean...
Also, this component will never be updated again.
/\ |_ E X E GG
|
|
|
|
|
Patching is actually changing the code in the DLL. In you case, suppose you have somthing like this in machine-type pseudocode:
call DoSomething
if error code != 0
go to error
call DoSomethingBecauseNoError
return
error:
call MessageBox("error!!")
return Suppose you find that code in the DLL and actually modify the file so that the insctruction go to error is changed to a NOP (which is an Intel x86 assembly language instruction that actually does nothing). The next time the DLL is loaded and executed, the DoSomethingBecauseNoError call will always be executed, even if there was a previous error. That's patching: modifying some already-compiled code.
I can also be useful in cracking programs. Suppose you have an app that calls a funcion to check whether it's registered or not. If you patch the beginning of that function (by changing the first instruction for a return true ) it will always seem as registered (that's what some cracks actually do.)
Hooks are something totally different. A hook is a way to register your code so it's called before or after some other code, and it can optionally alter the normal behavior. In this case the original code is not modified, but the operating system or the code-to-be-called must provide a way to be hooked.
Windows provides several types of hooks. One of them, the WH_CBT hook, lets your hook procedure be called everytime the system is about to create a window, and you can prevent it from doing so. This way, you could see every window created, and if it's the specific message box, just prevent it.
You can find more information in MSDN:
About Hooks[^]
CBTProc[^]
Your hook procedure must reside in a DLL that will be loaded in the target process, so I seriously recommend it's written in plan Win32 API code. If you write it in .NET, the whole .NET Framework will be loaded in the target process, and there could be a conflict if that process uses another version of .NET.
I hope this helps!
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I don't have any of the source code, all I have is the DLL. Can I still do the patch/hack?
/\ |_ E X E GG
|
|
|
|
|
Yes, that's the idea, without the source code. But it's not easy. You need to disassemble it, find the call to message box, find where you could put a NOP (not all assembly instructions are the same length), get the hexadecimal value of the NOP (it's called the opcode)... it's really not that easy.
I would definitely try to find another component, and if not, I would probably use the hook technique. Patching is the last resort.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Can you recommend a disassembler to use? I would like to mess around with this.
/\ |_ E X E GG
|
|
|
|
|
You'll have to search for one in google. I've not used one in years. I remember using one called WDASM32, but I don't know if it still exists.
On a side note, I always wanted to write one myself (interesting project) but never did it. Now that I work for a living, I just don't have time.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
can you explain more to me what you mean by
cnich23 wrote: debugging the control and noping the calls to the dialog. ???
Can I do this if I don't have access to the source?
/\ |_ E X E GG
|
|
|
|
|
There is no real easy way to explain this. Either you need to know your machine ASM or if the control is .NET you need to know IL. There are several .NET Dissasmblers some even let you edit the IL code directly. Which in your case you can search for MessageBox and remove them. But there is no easyway to explain this, and most likely it will involve a lot mroe research then waht your trying to accomplish. Best bet is to have the dev's fix it or learn .NET reversing.
|
|
|
|
|
Hi all,
I am making an application, where i need to keep drawing and erasing lines over an image.
Drawing lines is ok, but i am not able to find any suitable means to remove those lines.
One method could be to draw on the same line using some other color, but that method is unsuitable since i am drawing it over an image.
Another method could be to send the Paint event so as to refresh the frame. But since i am drawing and removing the lines quite frequently, i dont think it will be a good idea to call the paint method so many times.
Can anyone please suggest a more efficient method?
Any help will be highly appreciated.
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Repainting is generally a good idea. Just implement your OnPaint method the way that a flag indicates whether the lines should be drawn or not. Everytime you switch between on and off just switch the flag and call Invalidate on your control. This will lead to a repaint (and also avoid too many repaints).
If your are switching frequently you should enable double buffering to avoid flickering:
(in constructor)
base.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true);
|
|
|
|
|
Hey thanks Robert!
I havent tried that yet, but will surely do when i get out of my office.
Thanks a lot.
I'll get back to you if i bump into any more problems.
Thanks again.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
How can i bind two controls together in witch that when one control scrolls the other scrolls too?
for example imagine that when a "DataGridView" scrolls , contents of a panel scroll too.
Thank you...
|
|
|
|
|
Handle the DataGridView's Scroll[^] event and add necessary code to tweak the Panel.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I have a program used to start or stop a service on window. The problem happen when the service is protected by a password. My program start service, then the password dialog appear, if I move the mouse to the dialog, the dialog changed to "not responding" state.
I have tried to use a thread, but the same thing happened!
How can I solve this problem. Thanks for your help!
Hung
Hung
|
|
|
|
|
Hi there.
I am trying to learn how to use GDI+ in ASP. I made a simple webform with a button on it. When the button is pressed a line is supposed to be drawn but nothing happens. Can someone please help me out? Here is the code:
private void Button1_Click(object sender, System.EventArgs e)
{
Pen p = new Pen(Color.Black,3);
Bitmap bit = new Bitmap(400, 400);
Graphics g = Graphics.FromImage(bit);
g.DrawLine(p, 30, 30, 97, 97);
bit.Save(Response.OutputStream, ImageFormat.Jpeg);
bit.Dispose();
g.Dispose();
}
I can´t figure out why this doesn´t work. Any help is very much appreciated.
Thanks,
FJ
|
|
|
|
|
Try adding:
Response.Clear();
Response.ContentType = "image/jpeg";
before saving the image to the output stream.
|
|
|
|
|
Please don't cross post.
Standard question #4:
No, "nothing" never happens. Exactly what is happening?
Does the button seem to work? Does the button do a postback? Is the page replaced by the image that you created?
You are writing the image to the response stream in a button event, that doesn't really work very well. As you are not even calling Response.End, the image data will be followed by the HTML code for the page.
---
b { font-weight: normal; }
-- modified at 13:23 Saturday 25th March, 2006
|
|
|
|