|
max29297 wrote: If I design a program in C#, iit will still run on a computer without the .NET Framework, right?
No.
Unless you have Mono, but I don't think you were thinking of that.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Hi Max,
the answer is no: the CLR compilers (C#, C++/CLI and VB.NET) emit MSIL code, not native code,
so you need the .NET Framework to JIT and execute that;
and your app also needs the DLLs (such as mscorlib.dll) that contain the system classes
(#using System.Text and the like) and come with the .NET Framework.
And before you ask, you cannot automate a FrameWork installation, not from within an app,
not even from within an installer.
So you need the Framework and you have to install it manually, separate from any app.
I think there are CD/DVDs that contain the Framework, I dont think you need Internet
to do it.
BTW modern PCs, if they have Windows, also have (a couple of versions of) the .NET
Framework pre-installed.
|
|
|
|
|
hello there guys... i want to dial a phone number and play a sound message using the fax modem and C# 2005... i have been searching information but i haven't found anything yet... if you have any idea, or some code i'll appreciate it... i'm working on my thesis and it's a very important part of the software!.... thanks a lot!...
// Gonzalo
|
|
|
|
|
Hi Everyone,
I'm writing an application that implements an on-screen keyboard (because the Windows on-screen keyboard is extremely small and hard to use) and I'm having problems setting focus to the desired window in which the user wishes to type.
I'm using a few User32 API calls to get the active window handle number and then set the active window once I know what the handle is. This seems to be working OK. However, the window which has focus (the one receiving the typing) flickers as the user clicks on a key.
This is because as the user touches a key to type, it gives the keyboard focus and then immediately sends focus back to the window in which the user is typing, hence the flickering. So...
Question #1:
How can I eliminate the change of focus and always give focus to the desired window so that there is no flickering back and forth between my keyboard application and the window receiving the typing?
Question #2:
This is not just a standalone keyboard, but is a small part of a larger piece of software. Consequently, there are occasions when the user must use this on-screen keyboard to type into a window within it's parent application or into different forms within the app. One form contains a browser control to a company website. When they keyboard is used to type into any text field on a webpage displayed in the browser control, only every other word is sent to that text box. Two key strokes are required to output one letter. What could be a possible cause of this and how might I go about fixing it?
ANY suggestions or help is much appreciated. Code examples in VB.NET, VB 2005, and C# are fine. C++ OK too but only if it's immediately applicable and can be converted easily to VB.NET.
Thanks in advance to anyone who contributes!!!!
Patrick
|
|
|
|
|
I know this was a while ago for you but I am facing exect same issue, did you manage to solve this?
Also I would like to hide the keyboard when receving field losses focus (other than to keyboard), did you implement this part too?
Thanks in advance,
Savita
Savita
|
|
|
|
|
If I have a big article with different fonts and mixed with some picture to represent in browser (with asp - client and c# - server) how can I do it?
If I have the document in any db and that dacument can be very larg to represent in a simple page. I wan to represent in simple page with 2 part like a book with 2 pages. But if document is biger then 2 pages I wan to put any button to go to another pice of document in that 2 pages.
I'm looking some think like word, but in server - client technice.
thnx Atdheu.
|
|
|
|
|
I have a car class with various fields some of which are colour, make, mileage. I then have a car collection which contains multiple car objects.
public List<Car> CarCollection = new List<Car>();
What I want to do is pass the entire colour field array from the collection to a method CarData. (The method will be used to perform analysis on whatever array is passed in).
CarData(CarCollection[].Colour);
I can't get it to work. Is this possible (I guessing not)? Do I need to create a copy somehow? Please suggest an efficient solution to my problem.
Thanks in advance for any help.
Haz
|
|
|
|
|
Hi,
there is no colour field array, you only have a lot of car objects, and some List containing
all the references to them. So the way you could access them is:
<br />
foreach(Car car in CarCollection) {<br />
Color col=car.Colour;<br />
... do something with col<br />
}<br />
but doing so the field name is baked in the code.
What you could do is:
- make your analysis method accept an IEnumerator<t>
- give your CarCollection several new properties, each returning an IEnumerator for
one of the Car fields.
So now you could do:
analyze(CarCollection.Colours);
analyze(CarCollection.Make);
with Colours returning an IEnumerator<colour>, etc.
assuming Colour is a type (string or whatever) that represents the color.
To actually implement the enumerator, I suggest you have a look at the yield keyword !
Not sure tho how much you can do in analyze(IEnumerator<t>) if T can be anything;
just check for duplicates, make histogram, ... ?
|
|
|
|
|
Thanks Luc for the useful info. I'm going to look into your suggestion about the IEnumerator. Such a steep learning curve only being new to c# .
Haz
|
|
|
|
|
I am assuming, the class car had array object color. When you try tp pass Array of color to the method CarData, because carCollection is a type of List, you need to past the index of the car collection which means:
CarData(carCollection[0].Color);
Cheers
|
|
|
|
|
There was a project on here that would fix the problem of seeing controls paint after calling .ShowDialog(). I believe it was just a trick where the form was painted into memory and then displayed - but it did make for a more pleasant user experience. I tried searching and cannot locate it.
Does anyone know the article, or know how I might go about doing this?
Thanks
|
|
|
|
|
Hi folks,
I've got a 16-bit Windows application that I'm trying to run from within a C# WinForms application, but it throws "Win32Exception was unhandled - the parameter is incorrect".
How do you call a 16-bit app from C#?
Here's what I've got. Apologies if this is too much information, but I figured I should err on the side of too much rather than too little.
System.Diagnostics.Process p = new System.Diagnostics.Process();<br />
p.StartInfo.FileName = "c:\\My16BitApp.exe";<br />
p.StartInfo.UseShellExecute = true;<br />
p.Start();<br />
p.WaitForExit();
I can run my 16-bit app successfully by going to Start > Run and typing in "c:\My16BitApp.exe" so I know XP can handle it. As a sanity check, I also created a batfile (RunMy16BitApp.bat) that contains the following:
c:\My16BitApp.exe<br />
pause
When I run that bat file from the command line (or Run dialog) it works fine. If I run the bat file from C# using Process.Start(), the following message is displayed in the cmd window:
c:\My16BitApp.exe<br />
The system cannot execute the specified program.<br />
<br />
pause<br />
Press any key to continue
What am I missing? Thanks for your help!
Cheers,
Kevin
[Edit]
MSDN has the following information, which brings me back to where I am (trying to run a 16-bit program from a 32-bit program):
Failure to Start
If the Shell function cannot start the named program, a FileNotFoundException error occurs. This can happen, for example, when you attempt to run a 16-bit program, such as command.com, from an application using System.Windows.Forms. For a workaround, you can run a 32-bit program that calls the desired 16-bit program. In the case of command.com, you can run cmd.exe as an alternative.
-- modified at 14:55 Sunday 1st July, 2007
|
|
|
|
|
Hi,
maybe there are some security issues, and .NET does not like 16-bit exe files, just like it
does not like exe files on a networked disk by default ?
You could try to run
cmd.exe /C your16bitApp.exe optionalArgs
using the Process class (with UseShellExecute=true)
Not sure this will help tho, and if it works, maybe the WaitForExit will not work properly !
Hope this helps.
|
|
|
|
|
Didn't work - same exception.
I appreciate the attempt, though!
Cheers,
Kevin
|
|
|
|
|
Hi again,
does this also happen with some other 16-bit app, or just the one ?
does XP include some 16-bit app so I could try the same ?
|
|
|
|
|
As far as I can tell, if the Visual Studio hosting process is enabled, then when Start Debugging is selected, no new process is added. If you look at the Task Manager Processes tab, you see xxx.vshost.exe when the IDE is open and still only see that when the application is being run (debugged). The place where you _can_ tell a difference is the Applications tab of the Task Manager. I know how to get the list of processes that show up in the task manager Processes tab. How do I get the list of applications that show up in the Applications tab?
Thanks ...
|
|
|
|
|
Hi,
I am not sure what you want, a debug build of your app can be running either with or without
vshosting, but both cases are "debugging".
If you want your app to know whether it is running through vshost or directly, have
it search Environment.CommandLine for ".vshost."
If you want your app to know whether it is a debug or a release build, the easiest way
is to conditionally include/exclude some code using #if DEBUG ... #endif
Hope this helps.
|
|
|
|
|
Thanks for the suggestions - don't think they will solve this problem. Yes, both cases are "debugging" but I specified I was interested in the case where vshosting is enabled because I can detect what I need to know in the case where it isn't. Environment.CommandLine won't tell me because it is another instance of the application that needs to know. I do not need to determine between debug and release versions. What will tell me what I need to know sits in the Applications tab of the Task Manager - do you know how to access that info? The other way I see is if there is some property of the vshost process which indicates whether it is running the application currently or not. Seemed easier to me if I could access the Applications tab of the task manager.
|
|
|
|
|
Hi,
getting the list of items shown by "app" tab in Task Manager is complex; it entails
finding the right window (i.e. knowing the names of the windows in its hierarchy),
then sending some LVM_... messages to the listview. It must be similar to enumerating
the notify icons in the system tray, and the icons on the desktop. Each of these
can be found in several CodeProject articles.
I dont think reading that list is a very good idea; it is complex and the names you would
get are Window titles, which does not necessarily correlate well with the process names...
Using TaskInfo I noticed the vshost.exe process has quite different characteristics
(CPU time, working set, number of windows, ...) when comparing an idle state with
an active debug state.
So if what you want to figure out is whether something is being handled by vshost,
I suggest you get hold of its PID (using Process class), then do a P/Invoke to
either get its main window title, or to enumerate all its windows (zero when not active).
|
|
|
|
|
The window title would work fine - doesn't need to correlate with the process name. I was searching for task manager before - I'll try your system tray idea - do seem to remember seeing some items on that. Will also look into your idea of vshost characteristics - thanks.
|
|
|
|
|
Hi,
some additional thoughts regarding Task Manager:
- it is not always running; so you cant enumerate its apps when it does not run
- when running, another tab may be visible; dont know whether it keeps updating tabs
that are not visible...
So I strongly suggest you go for the process characteristics...
|
|
|
|
|
Your idea of getting the main window helped. Thanks.
|
|
|
|
|
|
string exePath = Application.ExecutablePath;
exePath = exePath.ToLower();
if (Application.ExecutablePath.ToLower().IndexOf("devenv.exe") > -1)//design time
{
}
else
{
}
|
|
|
|
|
Evidently, there is no easy way to access the same information as that in the applications tab of the task manager the way one can easily access the same information as that in the processes tab. Or, if there is, it isn't obvious to any of us. Instead, I used the method below (resulted from suggestion by Luc Pattyn) to determine whether the IDE simply had the application open or was running it.
Note - non-relevant portions of code omitted (the ...'s).
const string IDE_INDICATOR = ".vshost";
Process current = Process.GetCurrentProcess();
string IDE_Name;
...
if (current.ProcessName.Contains(IDE_INDICATOR))
{
IDE_Name = current.ProcessName;
}
else
{
IDE_Name = current.ProcessName + IDE_INDICATOR;
}
... (looping through all processes)
if (process.ProcessName == IDE_Name)
{
IntPtr WindowHandle = process.MainWindowHandle;
if (WindowHandle != IntPtr.Zero)
{
}
else
{
}
}
|
|
|
|