|
As CG has pointed out, you call Invalidate() to invalidate the window, which will cause the OS to eventually call your paint handler. In addition, you can call Update() to force the OS to paint your window immediately.
/ravi
|
|
|
|
|
Thanks so much that worked!
|
|
|
|
|
I need to use a Win32 (unmanaged) function, and need to a way to get a pointer to a CSharp function. Is this possible in CSharp?
|
|
|
|
|
Yes, I'm not sure of the mechanics right now, but I know it can be done.
You could look into the Canon SDK wrapper I have here as an article ( I didn't write that bit ). Or you could check www.pinvoke.net to see how it's done via an API that does it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Not from CP but will bring you in the right direction
http://www.informit.com/guides/content.asp?g=dotnet&seqNum=473&rl=1
File Not Found
|
|
|
|
|
Alright thanks guys! I'll check this info out ASAP.
|
|
|
|
|
Yes, it's called a delegate.
Example:
/// <summary>
/// delegate used for EnumWindows() callback function
/// </summary>
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);
/// <summary>
/// Enumerate all windows, calling a delegate for each of them.
/// </summary>
/// <param name="ewp"></param>
/// <param name="lParam"></param>
/// <returns></returns>
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumWindows(LP_EnumWindowsProc ewp, object lParam);
private static bool CollectVisibleWindows(IntPtr hWnd, int lParam) {
IntPtr ptr=(IntPtr)hWnd;
if (LP_User32.IsWindowVisible(ptr)) list.Add(ptr);
}
EnumChildWindows(ptr, new LP_EnumWindowsProc(CollectVisibleChildWindows), 0);
Hope this helps.
Luc Pattyn
[My Articles]
|
|
|
|
|
I have a string of text similiar to below. I am new to c# and was wondering of there is any built in functionality that allows string parsing in c# to figure out new lines based on the carriage return line feed in a string of teext such as below. Or is it just like usual, where you must search for the '\r\n'?
EE.DDDDDDDD
14:00 03/13/2007 00176
14:00 03/13/2007 00311 AAAAAAA
* DDDDDDDD
TXT
LIC:DLLLLL 041 TAB:51100D6 EXPIRE: 05/15/2006
VIN:1D7HA00000000 VYR:2003 VMA:DODG VMO:SQ1 VST:12PU
NAM:DAN,DEXTER,DDASS CUST#:D02620977
ADR:16102 PRINCE LN
CTY:HEY ST:TT ZIP:85889 GVW:000000
|
|
|
|
|
Yes, you can use the Split[^] method on the string class.
in your example, since you want to get the strings on each new line, here's the code I would write:
string theWholeText = ... ;
string[] delimiters = { Environment.NewLine };
string[] textLines = theWholeText.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
After that code, the textLines string array will contain each line of text.
|
|
|
|
|
So if i read this correctly, say i have 10 new lines. What you are saying is that this split method would place each line in an array of size 10. Then i can access from there?
|
|
|
|
|
|
As an alternative to splitting, you can create a StringReader that uses the string, and use the ReadLine method to read one line at a time.
StringReader reader = new StringReader(theString);
string line;
while ((line = reader.ReadLine()) != null) {
}
---
single minded; short sighted; long gone;
|
|
|
|
|
As an alternative to splitting, you can create a StringReader that uses the string, and use the ReadLine method to read one line at a time.
using (StringReader reader = new StringReader(theString)) {
string line;
while ((line = reader.ReadLine()) != null) {
}
}
---
single minded; short sighted; long gone;
|
|
|
|
|
hi .. !
this is really a problem for me .. !
coz any1 can just view the app. and edit anything in "about" box or something .. !
simply .. stealing it .. ... !!
|
|
|
|
|
You can't stop it, obviously. You CAN encrypt the string that are inside your program, so that it's not obvious to people who view it when they are looking at your string, and so they can't just edit it without first knowing the encryption.
Oh, I thought this was the C++ forum. People can decompile your app, change it and recompile, because it's C#. So, there's really nothing you can do. Encrypting the strings will provide basic protection, tho.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
im still new in C#, can u tell me how can I encrypt my strings?
actually .. my about box is not a dialog .. its a messagebox :P ... should i use about dialog box instead ?
and thanks for ur reply
|
|
|
|
|
An easy way would be to add a known value to each character. Another way would be to explore system.Cryptography.
NiZaR.TecH wrote: my about box is not a dialog .. its a messagebox ... should i use about dialog box instead ?
It makes no difference.
In the real world, the number of users who will try to hack your app is very low, unless it's a technical app in the first place. i.e. the nature of the app determines the user base. But, most people do not worry.
You can indeed buy a compiler to turn .NET code into a real .exe, but it's very expensive, and rarely worth the cost.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
there is at least one program available that will convert a .net application into a win32 exe, and give a level of protection equivalent to a natively built app. You'll have to spend a decent chunk of change to get it though.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
its in .exe format .. !
and I used one of the hexaViewers ... and i changed the about box and saved it .. !
and yea for some ppl my program is important :P
|
|
|
|
|
Christian and my point was that a c# app is much easier to reverse engineer. You can use a tool like Reflector[^] and get source code with only private variable names munged away. IF you're paranoid this is a much bigger concern than tinkering with a hex editor. That said even if you encrypt your datastrings someone with a disassembler/debugger can trace your apps execution in hex until they find where you get the string from and replace change AboutDlgText = DecryptString(encryptedText) with AboutDlgText = "Not NiZar's app" .
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
didnt get u dan .. but for example in MultiMedia Builder (MMB) .. there's an option when you publish your project as a .exe file ... the option says : add protection layer .. and the protection layer's help says : to prevent your strings and scripts from being viewed by hex editors and viewers .. !!
got me mister?
|
|
|
|
|
Nothing can protect your strings 100%. You can do what we said, but the app will still be able to be decompiled.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
NiZaR.TecH wrote: MultiMedia Builder
Never heard of it, but it's probably using some form of encryption to make them less obvious.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
You can put all of your strings in a resource. And then for every resource you can use strong encryption to generate a uniquely encrypted hash. Then at runtime you can verify the hash with the public key. No one will be able to generate a new string and have the hash values match without the private key.
File Not Found
|
|
|
|
|
sorry mister, but I'm so beginner ... I guess I didnt get that ... but after all .. it seems there's no way to protect my application ...
|
|
|
|