|
Hi Venkat,
Try using
public static bool TrackPopupMenuEx(HandleRef hmenu, int fuFlags, int x, int y, HandleRef hwnd, TPMPARAMS tpm);
this is found in Windows.Forms.SafeNativeMethods, but this thing is not documented.
However you can try achieving the same through interop.
Cheers,
Kannan
|
|
|
|
|
I found a lot of things about calling applications and Documents from C# very simple. But I did not find documentations about Calling simple DOS Commands line "md NewDire" or "Copy *.* to x:" from C#.
So I would be happy if somebody could tell me how I can use simple DOS Commands from C#.
I need the following commands: md, copy *.prg
Thanks
Stefan
|
|
|
|
|
Have you tried Process.Start with "Cmd.exe /C CommandToRun"?
Why not just use the .NET file management for these such as "File.Copy" or "Directoy.CreateDirectory"?
Rocky Moore <><
|
|
|
|
|
Thank you! You answered exactly what I wanted.
Process Start Cmd.exe : Did not see this solution.
File.Copy, Directory.Create : simple, I just did not find it in the help doc.
Thank you!
Stefan
|
|
|
|
|
How can I colour (and set boldness and such things) individual charaters in a RichTextBox?
I did this back in VB6 using the SelectionX parameters (they changed the text under selection, not the selection itself as it does in C#), but I can't find anything to do the same thing in C#.
|
|
|
|
|
here ya go this should get you started off :
VB:
<font color="blue">Private</font> void button4_Click(<font color="blue">Object</font> sender, System.EventArgs e)
{
richTextBox1.SelectionStart=richTextBox1.Text.Length;
richTextBox1.SelectionColor=Color.Blue;
richTextBox1.SelectionFont=new Font("Tahoma",10,FontStyle.Bold);
richTextBox1.SelectedText="testing blue bold\n";
<font color="DarkGreen">
richTextBox1.SelectionStart=richTextBox1.Text.Length;
richTextBox1.SelectionColor=Color.Red;
richTextBox1.SelectionFont=new Font("Verdana",10,FontStyle.Regular);
richTextBox1.SelectedText="now testing in red\n";
}
hope that helps a little
<font color="blue">Private void</font> ExpectingTwins(<font color="blue">string</font> twins)
{
<font color="blue">switch</font>(twins)
{
<font color="blue">Case</font> ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
<font color="blue">break</font>;
}
}
|
|
|
|
|
Thanks! Exactly what I needed
|
|
|
|
|
For example,when mouse moves over the webbrowser's client area,a MouseOver event will be fired.
Thanks,a lot.;)
|
|
|
|
|
I recently got my hands on Visual Studio.net and it came with C#. Now, I've been using C++ for a while now, and am starting to get into the nitty gritty of windows programming (using GDI, not MFC) and I wanted to know if I should learn C# instead. I mean, I plan on learning some C#, but is C++ still more powerful? I've looked for articles on the subject, but I really wanted to hear some people's oppinions. What do you guys think? Is C# as clean as C++? Is it as powerful? As fast?
Thanks for your input!
-untwisted
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
C# is not as fast, and takes more memory. (I look forward to the day that they optimize IL and C#.) It is not as powerful in some ways, but it is more powerful in others. It does a lot of the tedious and slow work for you, freeing your time for other aspects of development. The syntax is the same as in C++, which is a big plus. It is just as clean as C++, if not more so.
As for me, I'm hooked! I love C#. I'm someone who has a lot of ideas, but not nearly enough time in comparison to the number of ideas, so I really like the time that C# saves me, especially since I don't have MFC/ATL/WTL, etc.
Here is a short feature comparison:
operator overloading Y/Y
method overloading Y/Y
single inheritance
multiple inheritance Y/N (coming in 2.0)
templates Y/N (coming in 2.0)
pointers Y/Y(unsafe only)
new keyword can explicitly hide/replace inherited member N/Y
delegates N/Y
foreach iterator N/Y
case fallthrough in switch statement Y/N
bit fields Y/N
default values in method parameters Y/N
And here is an MSDN article that may help you.
[^]
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Much thanks! That helps a lot. No one would give me a sure answer on weather or not it was faster, etc. Is there any way in C# to get to the bare bones of programming though? If I wanted to could I create a windows application from scratch using windows GDI? What makes C# slower? What I'm getting at I guess is this: Can C# be a replacement language for C++? I realize that the little drag and drop of C# must make it slower, and add overhead to your project, but if I wanted to could I skip that? Can I make my code just as fast and clean and efficient in C# as in C++? Sorry if I'm being redundant, but I'm having a hard time explaining my question. It's late here, I think I need some sleep
Thanks again!
-Brian
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
untwisted wrote:
If I wanted to could I create a windows application from scratch using windows GDI?
Yes, you could, but you probably wouldn't see a really noticable speed increase.
untwisted wrote:
What makes C# slower?
It's managed, and it seems that MS put hardly any effort into optimizing MSIL. I'd really like to see them do that - it would make a big difference (and I believe they are planning to, but the question is: when?). If they optimized IL, all .NET languages would benefit from the speed boost. It's not like C# code runs at a snail's pace, but nevertheless, the difference between C++ speed and C# speed is noticable.
untwisted wrote:
Can C# be a replacement language for C++?
Yes, it can - in fact it can be an improvement over C++, if you don't mind the speed drop. With .NET Windows Forms, the problem seems to be GDI+, which is not hardware-accelerated (this will be fixed in v2.0).
That huge class library is a timesaver 100x over.
Having said this, I, for my part, will still continue to use C# as my main development platform.
If you really want speed and .NET together, try Managed C++. It's not as easy as C#, but it gives you that extra speed edge.
BTW, sorry if I confused you in the last post - in the comparison list, the left Y/N is C++ and the right Y/N is C#. Also, I forgot to say - C# and C++ support single inheritance.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
That really clears everything up! Thanks a MILLION for your help!
-untwisted
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
A lot depends on what type of software you wish to develop. If it is games demanding lots of horsepower or any program that is heavily graphics based thatr requires larges amount of graphic speed, no, stay with C++.
If your applications are database driven, corporate type applications or just general utilities you will probably notice no diffrence other than it may take you a tenth of the time to create the application in C#/.NET than C++.
If you wish to see the speed of C#, you can download WebMatrix from ASP.NET. That is a free product from Microsoft that was built entirely from C#/.NET. Much of Microsoft's inhose development is switching to C# (or at least they latest Microsoft .NET show said they were).
Also, .NET applictions have a much smaller footprint. Large applications are usually under a meg and as long as someone has .NET installed that is all you need to ship. Makes it lightwieght to distrubute over the Internet.
There is yet another benifit, you can actual create Linux GUI applications using C# via the Mono Project.
Debugging cycle is extreamly shorter duration for applications of any size. I hardly even think about debugging anymore since I seldom find bugs after the initial building is complete. Not that I am such a great programmer, but there is far less to have problems with.
Another plus is that you can build web sites with the same coding you use for your Windows applications. You don't have to learn diffent languages and different APIs, you use the same .NET classes and the same language.
Distributed applications on the Windows platform are a pain. It is easy to remote your application across machines and use the horsepower of multiple machines.
Well, I have been working in C/C++ for over 20 years now and seven months ago I switched all my development to C#/.NET!
BTW, jobs are really starting to flow for C#/.NET programmers, one recently on Monster in Portland Oregon for 90K
Rocky Moore <><
|
|
|
|
|
Rocky Moore wrote:
Another plus is that you can build web sites with the same coding you use for your Windows applications. You don't have to learn diffent languages and different APIs, you use the same .NET classes and the same language.
This is not entirely true, system.windows.forms v/s system.web.ui, for example, the datagrid is different in windows ns then web ns.
please understand, according to Brian Valentine from MSFT, that one day everything will be managed code on the windows os, except device drivers and kernel code. you can find this in april 2003 edition of Windows & .NET Magazine, pg. 64 (second to last paragraph)
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
Soliant wrote:
This is not entirely true, system.windows.forms v/s system.web.ui, for example, the datagrid is different in windows ns then web ns.
Yes, I would have thought that would be obvious, there would be the natural seperation of type based on platform in that one is a Windows application and another is a web application that is stateless and thus controls and progamming logic for the presentation layer would be different in that fact, but still able to use all the base logic. You would still be using the same langauge and core for both unlike ASP where you would have to use scriptiong langauages or code down to IISAPI modules and have completely different core.
Of course there is an article on CP by Mark Clifton (I think it was) that uses a layout engine to run on eitehr ASP.NET or as a WinForm application using the same code.
In short you have the full power of .NET and C# for use in either web or Windows applications allowing most logic to be used by both. Now if they could do that for the client side of the browser
Rocky Moore <><
|
|
|
|
|
hello
here is a small problem that i am looking for some solution.
problem is :
how can i put the values in an html table (on a web page) into the table in a database (sql server or any)?
LOOKING FOR help.
ASIM
Asim
|
|
|
|
|
Can anyone give me a big picture of what configuration files(like Web.config files) are for? and how to use them?
Thanks a lot,
|
|
|
|
|
dear my love ones,;P
Say i have 2 buttons: btnDoSomeWork: implement taskX
and btnTryAgain: allow user to hit btnDoSomeWork
I run my program, and hit btnDoSomeWork , let it run taskX
Now I hit btnTryAgain, take some new input, and have user click btnDoSomeWork the second time.
This will make the 2 same taskX(s) run concurrently, which is not what i want.
Is there anyway to stop the first taskX when i hit btnTryAgain?
THANKS IN ADVANCE
|
|
|
|
|
Try running them in a separate thread. Then get the invoking method to abort the thread if it's running.
"Póg mo thóin!"
"I'm sorry but if they're gonna start talking to us about going to Uni and steering clear of drinking...then students bars shouldnt sell drinks for 50p"
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
Bob Chum Dev site [^]
|
|
|
|
|
Ok. After about 12 hours of trying to combine multiple assemblies into a single EXE, I am finally making some progress.
I ended up compiling each class into its own module (quite a pain). I am now trying to use al.exe to combine all of them. If I use the following command line:
al.exe ActionNotSpecifiedException.netmodule Arguments.netmodule ConsoleLogger.netmodule DirectoryUtils.netmodule FileLogger.netmodule FileUtils.netmodule ProgCommand.netmodule ProgInfo.netmodule ProgNotFoundException.netmodule InvalidCommandLineException.netmodule Logger.netmodule LoggerArrayList.netmodule LoggerManager.netmodule StreamWriterLogger.netmodule StringArrayList.netmodule TextWriterLogger.netmodule TimeOutException.netmodule ProgCommandRunner.netmodule /main:mesh.Prog.ProgCommandRunner.Main /out:ProgCommand.exe /target:exe
I can actually create the ProgCommand.exe executable. Except that it has to be in the same directory as the modules in order to run. So close, yet so far.
I also tried to combine everything in my make file with the following code:
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST)
$(CSC) $(EXETARGET) /addmodule:$(MODULES: =;) /main:mesh.Prog.ProgCommandRunner.Main /out:$@ %s
which on the command line translates to:
csc /nologo /debug+ /d:DEBUG /d:TRACE /t:exe /addmodule:.\Arguments.netmodule;.\InvalidCommandLineException.netmodule;.\DirectoryUtils.netmodule;.\FileU
tils.netmodule;.\TimeOutException.netmodule;.\StringArrayList.netmodule;.\Logger.netmodule;.\LoggerArrayList.netmodule;.\TextWriterLogger.netmodule;.\ConsoleLog
ger.netmodule;.\StreamWriterLogger.netmodule;.\FileLogger.netmodule;.\LoggerManager.netmodule;.\ActionNotSpecifiedException.netmodule;.\ProgCommand.netmodule;.
\ProgNotFoundException.netmodule;.\ProgInfo.netmodule;.\ProgCommandRunner.netmodule /main:mesh.Prog.ProgCommandRunner.Main /out:.\ProgComma
nd.exe ..\build\AssemblyInfo.cs
However, this gives me the following error:
error CS1555: Could not find 'mesh.Prog.ProgCommandRunner.Main' specified for Main method
NMAKE : fatal error U1077: 'csc' : return code '0x1'
Does anyone have any idea what I am doing wrong? I have been trying to get this to work for quite some time. All I want to do is combine multilple projects into one executable.
Thanks in advance... (I hope)...
mike c
|
|
|
|
|
You cannot use a .NET module from the assembly it is contained in. Why not make one big assembly in the first place? Else you will have to go a long and painful route via IL.
<a TITLE="See my user info" href=http:
|
|
|
|
|
>Why not make one big assembly in the first place?
Because my code is broken up into different projects to make it more reusable.
I guess i could make one project that linked to all of the other individual files, but I just figured there would be another way to do it.
I have been rpetty surprised by how difficult this has been, and how little information i can find on it.
Thanks for the info...
mike c
|
|
|
|
|
There is an option if you want to make one big exe (unmanaged code will not work here) is to use IL Linker/Binder. Do a search on GotDotNet for it.
<a TITLE="See my user info" href=http:
|
|
|
|
|
mikechambers wrote:
Because my code is broken up into different projects to make it more reusable.
Why not take your reusable code and put into into DLLs? That way you just add a reference to your DLLs and they are pulled into your application. This allows you to keep the in different projects and still be used in any of your applications. Just change the type of your project from EXE to DLL for each of those extra projects and add reference in your main application.
Rocky Moore <><
|
|
|
|
|