|
I'm new to using the Visual C# 2005 Express - is the console window
supposed to just flash up and disappear when displaying output from
a console program? The book examples I'm using seem to assume so.
I've found a code snippet: System.Console.ReadLine();
which does the job, but is it usually necessary to include this line
or something similiar to keep the output window from disappearing please?
-- modified at 22:31 Saturday 18th November, 2006
|
|
|
|
|
Well, usually you'd execute a console app in a command prompt window, so the app would execute and return to the command prompt.
If you double click it in explorer, it will open a command prompt window, execute, and when your program is done, it closes the window.
ReadLine is waiting for user input, so the app hasn't ended yet, which keeps the window from closing.
In other words, it's a hack to keep the window open.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
No this is supposed to run under the MS Visual C# IDE. I have two "step-by-step" type books
and both expect the programs to run using the IDE environement; neither seem to consider this
problem...
|
|
|
|
|
But that's exactly what's happening! You app starts, the console window appears, and when your app is done, the console window closes and you're returned to VIsual Studio. The only way to keep the window open is to put the ReadLine statemnet in there.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
So the fault is the books I'm using then? It just seemed strange to me
that two books could have missed the apparent need for such a statement.
(I used to use Getchar() in C, but it's not in C#.)
|
|
|
|
|
Maybe I'm confused or not sure what you're asking.
If your console app has no ReadLine at the end, and you run it under the IDE, you'll get "Press any key to continue" prompt. [edit]At least in VS2003[/edit]
If you double-click your .exe in windows explorer, it will run it and close the window immediately.
Are you saying they need to put Console.ReadLine in there samples, or they shouldn't have it in there?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
"If your console app has no ReadLine at the end, and you run it under the IDE, you'll get "Press any key to continue" prompt. [edit]At least in VS2003[/edit]"
This must be why my books don't include the readline statement - I'm using the latest version
and without the readline the console window behaves the same as in C when you omit the getchar()
statement - it briefly flashes and disappears. Presumably they had their reasons for making the change...
|
|
|
|
|
Somebody probably complained that they didn't have an "any" key on their keyboard, so they removed it from VS2005
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Or your compiling and running the app in Release, instead of Debug mode.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Please pardon me if this is the incorrect place to be posting this question:
I'm trying to use the Canon Software Development Kit (EDSDK v1.3 to be exact) to include support for Canon RAW images in my application written with C# in Visual Studio .Net 2005. So far I've met with some success, but seem to have hit the proverbial wall. I'm able to use the Canon libraries to connect to the RAW (CR2) image files, access the image properties, etc, but am currently unable to display the image on screen. I'm hoping someone out there has already run across (and hopefully already solved!) this problem, or something similar and might be able to lend me some advice.
BTW, the SKD libraries are freely available from Canon (after you go through the trivial approval process) here: http://www.usa.canon.com:80/consumer/controller?act=SDKHomePageAct&keycode=Sdk_Lic&fcategoryid=325&modelid=9808&id=3464[^]
Any help? Am I barking up the wrong tree?
Thanks!
|
|
|
|
|
I've never worked with the RAW SDK ( it returns raw bitmap data as opposed to JPEG, right ? ), but for the other SDK, I had to write a wrapper, which passes a delegate in C++/CLI to provide the function pointer to pass the HWND to.
Christian Graus - C++ MVP
|
|
|
|
|
Christian,
As best I can determine, the SDK does return raw bitmap data in one form or another. The latest version of the SDK does come with a C# wrapper around the dlls which contain the actual SDK, but unfortunately no C# sample code on how and what to call to get the image information to display. What I've been able to decipher so far is from an included C++ sample application which I've muddled through, but I'm not a C++ developer, so that's been an iffy proposition!
The included C# wrapper around the dll's allows the functions to be called from C#, but as best I can figure the function call which actually returns the image returns a pointer the a memory stream containing the image. Muddling through the included C++ example, that 'stream' gets re-arranged slightly to build the actual image. It's at that point that I'm stuck. I can see what the C++ function is doing, but haven't a clue how to write the C# equivalent. Canon unfortunately offers no support, so they're of no help. I'm hoping someone may have already figured out the solution.
|
|
|
|
|
f1nut wrote: The latest version of the SDK does come with a C# wrapper around the dlls which contain the actual SDK, but unfortunately no C# sample code on how and what to call to get the image information to display.
Really ? This is the one that has JUST been released ? Do you know if the other SDK has a RAW wrapper ? That's awesome news, I've been working on a wrapper for the latest SDK for a while now.
If the stream represents the image data, you could look at my image processing articles on how to pass the bits into a bitmap.
Christian Graus - C++ MVP
|
|
|
|
|
Yes, there is a C# wrapper to the dll's in the latest sdk from Canon. At least the EDSDK v1.3 has one.
|
|
|
|
|
I am a C# programmer with about 4 years development experience. I currently busy with an Equipment Management System. I want to add a Vehicle Tracking feature on the system. I have done a couple of searches on the net, but the results I get are not specific.
Can anyone plz tell me what Hardware and software I need to use GPS on my windows application.I would most propably appreciate a list of all hardware and software necessary for my application to work, and possibly a step-by-step guidelines.
Programming is not a skill, it's an art.
|
|
|
|
|
|
i am new in c# but i have a c# haw to program book, can any one help me to find the answers of this book plz
|
|
|
|
|
Book are generally used to hide information in, especially the kind of book you are talking about. So the answers are in the book, not somewhere else.
---
b { font-weight: normal; }
|
|
|
|
|
Your question makes totally no sense. It also beggars belief. Without telling us what the book is, what can we possibly tell you about it ?
If the book has questions and no answers, it's kind of useless. If it has source code listings and you want to download them, do a google.
Christian Graus - C++ MVP
|
|
|
|
|
first very thanks for your reply ,
it is a cool book but all questions in the end of chapter contains some very hard questions that can not be answer.
|
|
|
|
|
tamerana2004 wrote: it is a cool book
But you're still not telling me what book it is...
tamerana2004 wrote: but all questions in the end of chapter contains some very hard questions that can not be answer.
I'd give a 95% chance that the questions are designed to make you think about the chapter you read, and the answers are not listed because it's assumed you know them, because they are in the pages you just read.
Christian Graus - C++ MVP
|
|
|
|
|
very thanks for your reply but can u help me to answer some questions like that . or give me the idea
Create class SavingsAccount. Use static variable annualInterestRate to store the interest rate for all account holders. Each object of the class contains a
private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide a static method ModifyInterestRate that sets the annualInterestRate to a new value. Write a driver program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest and print the new balances for each of the savers. Then set the annualInterestRate to 5% and calculate the next month’s interest and print the new balances for each of the savers.
|
|
|
|
|
What is the book ? Can you do NONE of this ? If so, I suggest either the book is useless, or programming is just not for you.
Christian Graus - C++ MVP
|
|
|
|
|
Is there a method in the .NET framework that I can call to get the window with the current focus. All I've been able to find on the net is this:
// Return the handle of the window that has the focus.
[DllImport("user32.dll")]
public static extern IntPtr GetFocus();
This isn't built into System.Window.Forms?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
No, it is, by definition a PInvoke call to load a function out of user32.dll and call it.
Christian Graus - C++ MVP
|
|
|
|