|
How can i convert a class _variant_t variable to integer/long int?
Tried typecasting,ChangeType..dint help..
i want to be able to use '+'(mathematical)..
|
|
|
|
|
This appears to work but this is the first time I've tried this so be careful since I'm shooting from the hip...
_variant_t vtInput("1234");
int nInput=_wtoi(vtInput.bstrVal);
TRACE("Input + 3 = %d\n",nInput+3);
-- modified at 0:21 Saturday 17th June, 2006
This also appears to work
_variant_t vtInput("1234");
vtInput.ChangeType(VT_I4);
TRACE("Input + 3 = %d\n",vtInput.intVal+3);
|
|
|
|
|
What i think is this should do:
BSTR bstrText = ::SysAllocString(L"Number Text Here");
char* lpszText2 = _com_util::ConvertBSTRToString(bstrText);
int i=atoi(lpszText2);
SysFreeString(bstrText);
delete[] lpszText2;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thnx a lot!!dat worked!
|
|
|
|
|
_AnShUmAn_ wrote: _bstr_t to int
As _bstr_t is wrapper class for BSTR, it also Expose LPCTSTR operator:-
so you can easily call itoa directly on _bstr_t object!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks for the updation....
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: Thanks for the updation....
do you really need updation?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
codes:
CDlgBrower *dlg=new CDlgBrower;
dlg->Create(IDD_DLG_FILE);
dlg->ShowWindow(SW_SHOW);
how to judge that the dlg is destoryed?
if it didn't destroyed , show it!
else new a dialog and show it !
what to do?
Just my interest for these common things
|
|
|
|
|
Try this:
if(dlg)
{
dlg->ShowWindow (SW_SHOW);
}
else
{
dlg=new CDlgBrower();
dlg->Create(IDD_DLG_FILE,this);
dlg->ShowWindow (SW_SHOW);
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
u can use the IsWindow function to check whether a handle is a valid window handle.
if( IsWindow( dlg->m_hWnd ))
{
// Window exists
}
else
{
// Invalid handle
}
nave
|
|
|
|
|
xuwenq88 wrote: CDlgBrower *dlg=new CDlgBrower;
dlg->Create(IDD_DLG_FILE);
dlg->ShowWindow(SW_SHOW);
When ever your Dialog is destoyed or closed are you calling Delete on Object?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
dlg is created dynamic
Destroy it by click the close title
I dont know it was destroyed or still existed!
so I search a way to solve this problem!
Just my interest for these common things
|
|
|
|
|
Do we have any good effective WIN32 API which can tell whether my application is running on a system with a color v/s monochrome monitor attached.
A sample code snippet will be helpful.
Am using the following sample and apparently its not giving correct results always.
bool bColorMonitor = false;
// Get the display information
DEVMODE devmode;
if (::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode))
{
//If dmDisplayFlags is set to zero then monitor is colored otherwise GrayScaled.
bColorMonitor = !(0x01 & devmode.dmDisplayFlags);
}
else
{
dirTrace.Error(_T("EnumDisplaySettings() failed"));
}
|
|
|
|
|
Hello,
I need to draw 1 line and 1 bar chart on 1 plot.
I can't find a way how to do that.
I tried the following:
<br />
1 - VtChChartType2dBar<br />
3 - VtChChartType2dLine <br />
<br />
MSChart1.SetColumnCount(2);<br />
MSChart1.SetColumn(1);<br />
MSChart1.SetChartType(1);<br />
...<br />
<br />
MSChart1.SetColumn(2);<br />
MSChart1.SetChartType(3); <br />
Didn't work, it affects both series. So, both of them become lines.
I also tried this:
<br />
1 - VtChSeriesType2dBar<br />
6 - VtChSeriesType2dLine <br />
<br />
MSChart1.SetColumnCount(2);<br />
MSChart1.SetColumn(1);<br />
MSChart1.SetSeriesColumn(1);<br />
MSChart1.SetSeriesType(1);<br />
MSChart1.GetPlot().GetSeriesCollection().GetItem(1).SetSeriesType(1);<br />
...<br />
<br />
MSChart1.SetColumn(2);<br />
MSChart1.SetSeriesColumn(2);<br />
MSChart1.SetSeriesType(6);<br />
MSChart1.GetPlot().GetSeriesCollection().GetItem(2).SetSeriesType(6); <br />
No effect at all. Did I miss something or it's not possible at all?
I apprciate your help.
Regards,
Martin.
|
|
|
|
|
I have been exploring MSChart for sometime now and I have never come across the ability to have some of the chart bar and some of the chart line. I don’t think it is possible at all.
Let me know if you find differently....
Chris
|
|
|
|
|
I am an avid Visual Basic programmer and I would like to know what the advantages of using Visual C++/MFC are over Visual Basic.
For what kinds of scenarios can you not use Visual Basic?
|
|
|
|
|
gongchengshi wrote: the advantages of using Visual C++/MFC are over Visual Basic
The performance of a program in C++ code is better than in VB.
The API of Platform SDK is in C.
Visual BASIC code is sort of managed one, not able to do too much lower level tasks.
Etc ...
Maxwell Chen
|
|
|
|
|
Individual Opinion:
Visual Basic is very weak compared to VC++ in terms of functionality and interaction with the hardware. Here are a few things you can't do in VB.
Pointers = NO(C++ has this), Run on Linux/Unix = NO(C++ Runs), Talk to Hardware = NO(C++ is very rich with hardware interaction).
But if you are to create simple windows application and you need to do it fast, use VB otherwise VC++.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
gongchengshi wrote: I would like to know what the advantages of using Visual C++/MFC are over Visual Basic.
different between VB and VC is different between bottled Food and SelfMade food
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
is there a function that I can use on CString that's the same as sscanf?
I tried to:
int numArgs;
CString userInput("device, cmd, in1, in2");
CString device, cmd, input1, input2;
numArgs = sscanf(userInput,"%s %s %s %s", &device, &cmd, &input1, &input2);
i could have sworn this was possible but i get:
c:\...cpp(73) : error C2664: 'sscanf' : cannot convert parameter 1 from 'CString' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
thanks,
Kitty5
|
|
|
|
|
|
Hmmm.. _stscanf() would probably be a better idea..?
--
100% natural. No superstitious additives.
|
|
|
|
|
Michael Dunn wrote: Your build settings are set to unicode,
What are the advantages and disadvantages of using unicode settings?
Kitty5
|
|
|
|
|
Pros: you can support more languages, runs faster on NT and upwards (native strings are unicode)
Cons: Strings are represented using 16 bit characters - eats up twice as much memory as ordinary ascii strings, requires conversions back and forth if you need to read/write text files from/to other (non-unicode) apps, runs slower on win9x (you need the unicode layer).
--
100% natural. No superstitious additives.
|
|
|
|
|
This CDialog is launched from a dll called by another app. After the app is done I hide it, and the dialog stays up. Now if some other windows happen to obscure this CDialog, there is no icon in the task bar with which I can bring it up again. I have to minimize the windows that obscured it and then I can see it again. I gave the CDialog minimize/maximize buttons (though that would fix it). Any way to get around this?
thanks,
sb
|
|
|
|