|
Hi Experts,
I am new to VC++ win32 projects.I would like to create Virtual Drive a have my UserControl in one Window when i Open that Drive.U can take the example of M-files.
please help me...
|
|
|
|
|
To mount a folder as a virtual drive you can use SetVolumeMountPoint[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi sir,
When i Explore it or i go to the Drive thru Open File dilog or double click on the Drive(Virtual Drive) i want mine own window with mine own Properties . Just as M-Files.
Help me Sir...
|
|
|
|
|
|
|
Is there any rule decided for it ? how to decide the use of each one..?
|
|
|
|
|
If there's a very large number of cases, you'd go for switch case. Otherwise, if-else should be good enough.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
A switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type. For instance, rather than the code
if (x == 1)
printf("x is equal to one.\n");
else if (x == 2)
printf("x is equal to two.\n");
else if (x == 3)
printf("x is equal to three.\n");
else
printf("x is not equal to one, two, or three.\n");
the following code is easier to read and maintain
switch (x)
{
case 1: printf("x is equal to one.\n");
break;
case 2: printf("x is equal to two.\n");
break;
case 3: printf("x is equal to three.\n");
break;
default: printf("x is not equal to one, two, or three.\n");
break;
}
Hope it gives you an answer
|
|
|
|
|
There is no such rule.
but only comfort and ease of coding matters.
functionally, both are same if they are used as per their exact syntax.
but in switch, you can program in such a way that, multiple cases carry the same body.
it all depends on the situation to decide which one would be better.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
One rule is of course the fact that switch-case needs to compare with constant values; you cannot put a variable in a case statement.
If you have constant values to compare with, and the range is rather small, the compiler is often able to generate a jump table which is faster in comparison.
However, if you have a large range of values and/or if they are widely spread, many compilers would generate the code as if you would have used the if-else solution. To create a jump table in such case would be far too complex to be built with a generic algorithm as a compiler would provide.
If you opt for the if-else solution, put the condition most likely to happen at the top, otherwise multiple conditions have to be evaluated before the right one is found for the major part of the calls.
There's some interesting notes here[^] as well.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
if there are only two state for a condition you can use ternary operator or if-else
For more than two and something that can be handled in a few if-else blocks you can use if-else
if there are a huge number of cases use switch-case
But if you are operating on strings if-else would be the choice as switch-case won't work
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
|
Although you are satified with all answers i want to mangle in the discussion. To my opinion If and Case are very different because:
If <condition>
and
Case <constant>
where <condition> is ANY expression that results in true or false, while the Case can only be a constant (from the same datatype as the variable named in the switch). As you see possible values of a variable as a domain then a Case construct is more like a domain-checker...
There are many if constructs that can not be rewritten to a Case construct. But all Case constructs can be rewritten to If-constructs, although performance can/will be worse. See the Case construct of a specialized version of If, losing some flexibility but gaining some performance...
Rozis
|
|
|
|
|
Hi.
I'm trying to write a program that automates outlook 2007 using c++. Found some samples, all requires "MSOUTL.H".
How do I generate "MSOUTL.H" from my "MSOUTL.OLB"? I'm using VS2005 and Outlook 2007.
|
|
|
|
|
Can I make a suggestion - rather than using whatever you are using to try and automate Outlook, use #import to do automation in C++ - it's the simplest and easiest way. Here's how I automate Excel 2007 (getting the active workbook name in this case) - automating Outlook just requires you to determine Outlook's libid (which, from the OLE COM object viewer, is 00062FFF-0000-0000-C000-000000000046):
#include <iostream>
#include <Windows.h>
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")
int main()
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
{
Excel::_ApplicationPtr xl;
if (SUCCEEDED(xl.GetActiveObject(__uuidof(Excel::Application))))
{
std::cout << "Getting name\n";
std::cout << xl->ActiveWorkbook->FullName << std::endl;
}
}
CoUninitialize();
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi
How can i convert from 'CString' to 'char'?
|
|
|
|
|
Why would you convert a string to a unique character ? Or do you want to retrieve the first character of the string ?
Did you take a bit of time to think about the 'validity' of your question ?
|
|
|
|
|
i want to do like that.
CString test="programming";
char final;
final=test;
Can you help me
|
|
|
|
|
Are you aware of the fact that a string is composed of multiple characters? And you're wanting to convert a string to a character. Doesn't this sound ridiculous?
Please do yourself a favour by reading an elementary book on C++ or rather start with C. You have a long way to go before you can post something meaningful here.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
MsmVc wrote: i want to do like that.
You want to make something that doesn't have any sense ?
Do you know what a character and what a character string are ? Why do you want to store an array of characters into a single character ? This doesn't make any sense at all. Do you want to use a char* instead ? If yes, as already told you a lot of times before, read the article that Rajesh suggested. Why do you keep asking the same type of questions again and again instead of trynig to understand the concept ?
|
|
|
|
|
MsmVc wrote: Can you help me
Yes, but you'll need to do this instead:
final = test[0]; I'll leave you with the exercise of figuring out why final only contains one character (instead of 11).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: I'll leave you with the exercise of figuring out why final only contains one character (instead of 11).
And tomorrow we'll do the advanced course - which character will final contain after the statement?
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|