|
You are asking in the C# forum. Try the Visual C++ forum insted.
It's been years since I last used the Windows API, but if I remember correctly, there is a EM_SETSELSTART message or something like that. Search, it isn't that difficult.
[EDIT: You're looking for the EM_SETSEL[^] message.]
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi, I was wondering if anyone would be able to help me.
I am currently using a standard RichTextBox to use for input, but if the mouse pointer was used to reposition the cursor, I need to find the last occurance of a particular text pattern prior to the cursors new position.
Thanks in advance.
Dave
|
|
|
|
|
Sounds like a job for a regular expression. The RichTextBox's .SelectionStart property will tell you where the insertion point is, if .SelectionLength is 0.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So I can find the position, but how about getting the last instance before this position, is there anyway to search for a regex back from a certain point?
|
|
|
|
|
Just return the string up to the position the cursor is at
string searchThis = RTB1.Text.Substring(1, position);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
All,
I am creating a program the inventories computer with wmi. I have a class file that contains all of my wmi queries. I have a textbox on the main windows form to enter a computer name into. What would be the best way to transfer that name to the class file that contains all of my queries, so that it can be used in the wmi connection string.
Eric
|
|
|
|
|
That depends on how your wrote your code and how your using your class. If your creating a seperate instance of your class for every machine your going to scan, then the easiest way would be to pass the string to the constructor of your class and have the constructor tuck the string away in a private variable so it can be used later to build the connection and/or query strings.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I got the jist of what you are saying, but I am having trouble finding a way to actually reference the text in the textbox on my main form. I am not sure what needs to be written on the Form page, to actually pass the textbox.text.
Hope this makes some sense.
Eric
|
|
|
|
|
You're kidding, right?
string myText = TextBox1.Text;
myWMIClass myWMI = new myWMIClass(myText);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As bad as that may have sounded, you have extremely helped me figure out some things I have been having trouble getting a handle on.
Please do understand my stupidity.
ERic
|
|
|
|
|
Hi All,
I need to detect when a key has been pressed on the keyboard or a button on the mouse.
This solution has to work on Windows 98 and up. Actually, my solution is using SetWindowsHookEx with WH_MOUSE_LL and WH_KEYBOARD_LL, but it works only on NT and up. I have read WH_KEYBOARD_LL and WH_MOUSE_LL isn't supported by Windows 98/ME.
any ideas for Windows 98?
Thanks,
Bego
|
|
|
|
|
In 98, you're limited to using WM_MOUSE and WM_KEYBOARD. The low-level versions of these hooks are not supported. You might also want to look into the WM_MSGFILTER or WM_CALLWNDPROC hooks.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello;
I Uploaed new xml guest book article with source code if want to profit search for authors Ahmad(ahmed) or Search for article xml guestbook with C#
this article ASPNET web application
Warning:this is Article & source code ASPNET web apllication developed with C#.NET language & xml technologies so
don't forget Check your server's IIS Permission setting
Ahmed Erarslan
MCAD,MCDBA,MCP
MCSD.NET
|
|
|
|
|
Hi all,
I am having a problem with interfaces. I have defined 2 interfaces in an interface project and 2 objects in an object project that extend these interfaces. I would like 1 of my objects to have an instance of the other as a property and i would like this to be exposed via its interface.
Specifically, I have a person object and address object and would like the address to be a property of the person.
When i try to compile I get a circular reference error. I tried changing the Address property in the interface to Iaddress but then i get a message 'cannot implicitly convert...'. so i created a static implicit operator... method on the Person class and I now get 'user-defined conversion to/from interface'.
How do i avoid this problem?
Thanks in advance
Russ
|
|
|
|
|
simple:
public interface IAddress
{
string Street{get;};
string PostCode{get;};
}
public interface IPerson
{
string Name{get};
IAddress Address{get;}
}
|
|
|
|
|
Is there any third-party compiler which can convert MSIL file into the native code which can work on any windows machine without the requirement of .NET framework? It should not require the MSIL on that machine.
Here, I am not talking of ngen.exe utility, because it is a limited utility which only makes an image in native code and you still require the MSIL assembly and secondly this native image is peculier to the machine on which it was created.
Or, is it possible for any "bright" developer or group of developer to take up this assignment as an Open-source project, as this is a very challenging task.
|
|
|
|
|
any "bright" developer would know that that is just dumb..
ofcourse it would be possible to make a native c# compiler or so if you limit yourself to use primitive types and only your own classes..
but things like reflection would not work anymore.. and since reflection is used by may things in .net , all classes that depend on that would not work.
so youd end up with eg C# minus the framework classes...
and in that case... just use vb6 instead... :P
|
|
|
|
|
I don't know why this was voted 5, but this is a common misconception: .NET code is not interpreted, it's compiled. All features of .NET code runs compiled, including reflection.
It's perfectly possible to compile MSIL to native code. NGen, the JIT compiler, and RemoteSoft .NET Protector are proofs of this.
If you need more info about this topic, see this MSDN article:
Compiling MSIL to Native Code[^].
The only thing that would be lost is a bit of theoretical performance, since, by precompiling to native code, you cannot target specific processor instructions, but you'd also gain a lot of performance on application startup.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Im well aware that the code is compled to native when it runs.
however , you still need the metadata for the reflection to work.
So sure you might be able to create a compiler that compiles to native AND embeds the metadata in the compiled file..
then you need something that can actually do the reflection emulation , where would that be placed? in the compiled code ? or in a separate dll?
if in a separate dll , you are only reinventing .net
and if you want to embed all most of the .net framework functionallity in the compiled exe ... you would get a pretty huge exe
|
|
|
|
|
Roger J wrote:
if in a separate dll , you are only reinventing .net
So, why not something that could get NGEN output, statically link the needed parts of the .NET framework (which is NGENed at installation, BTW) and deploy to another machine?
Roger J wrote:
and if you want to embed all most of the .net framework functionallity in the compiled exe ... you would get a pretty huge exe
I've tested it before with ThInstall and a 2MB app became 7MB, still way smaller than the .NET 1.1 + SP1. Furthermore, the size is not always a problem: what I need is some kind of control over the environment, otherwise I'll need to test my application against every single .NET framework version. If you deployed an application to a large user base before, you probably know what I mean.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Daniel Turini wrote:
It's perfectly possible to compile MSIL to native code. NGen, the JIT compiler, and RemoteSoft .NET Protector are proofs of this.
But Anonymous' question wasn't about this.
"Is there any third-party compiler which can convert MSIL file into the native code which can work on any windows machine without the requirement of .NET framework? It should not require the MSIL on that machine."
I think that what Roger is talking about it compiler that would compile C# code into STANDALONE executable, not dependent on .NET framework. That IS dumb idea.
David
|
|
|
|
|
dnh wrote:
I think that what Roger is talking about it compiler that would compile C# code into STANDALONE executable, not dependent on .NET framework. That IS dumb idea.
And why is that idea so stupid? I don't think that it's unreasonable to think about an application that ships with static libraries (in this case, linking the .NET framework into the application). The deployment and testing is really easier and safer when you use static linking. Why? Because you don't have to test with every possible version of the .NET framework, and every different patch set to check if your application works fine. Did you ever try to deploy and support an application on 10,000 machines, in around 300 different companies? You'd give a leg for a static linker...
And the origional post mentioned that static linking and native code compilation would remove a lot of .NET features, e.g., reflection. I disagree, unless someone proves me that: when a .NET application is loaded, it's JIT compiled to native code (if it wasn't pre-compiled by NGEN), and then linked to the .NET framework, which was compiled to native code by NGEN upon installation.
So, can someone explain me why is it so dumb to do all this on the programmers machine, instead of doing this on the user's machine? The only drawback I can see is losing a few machine specific optimizations (which still could be done by generating several versions).
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
ok maybe I didn't express myself clear. How I understood Anonymous' question is, forget .NET, I want to compile C# directly to native, just like C++ does. That's different from static linking, is it not?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
dnh wrote:
ok maybe I didn't express myself clear. How I understood Anonymous' question is, forget .NET, I want to compile C# directly to native, just like C++ does.
No, he wants to take an MSIL executable and compile to native code, and statically link the parts of the .NET framework needed.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Hi all,
I am facing a problem i am using office 2003's smartdocument feature to generate a doc and want to convert it to a pdf doc using c#.net but the problem is i also want the hyperlinks mentioned in the smartdoc to be active hyperlinks in pdf pls help me with the solution
Need ur help
|
|
|
|