|
realloc() is not "re-entrant" (i'm not sure about how to say this in english. this C function is to avoid. Moreover, we have powerful tools in the Standard C++ Library that are optimized to do plenty of arrays' size modifications...
Another thing : vector<> do only need <VECTOR> header to be included in the source, but no DLL at all...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
STL requires msvcp60.dll which, ironically, is not present on a freshly installed Win2k or WinXP.
|
|
|
|
|
strangely, i never encountered the problem...
so, you'll answer, oh, that's because i've just said "on a freshly installed Win2k or WinXP". yep, BUT, i already programmed on "freshly installed WinXP" (on VMWare if you know) cause my own PC was running under Win2K... the only problem i had is that the Bluetooth functions I needed were not present on the pack I had of MS Visual Studio .NET, but no problem with vectors...
i can't explain more, i don't think i have a ghost that installed "msvcp60.dll" on my system when i was watching at it... :->
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
MS Visual Studio .NET is the ghost in your case.
Its just my experience, believe it or experience it yourselves
|
|
|
|
|
it is a program of MSDN , which i have written in console win32 application because in win32 applicaiton it was also giving problems.It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters....Plz help me out i also used debug mode still i was unable to derive the hardware list
#include <windows.h>
#include <setupapi.h>
#include <stdio.h>
DWORD Err;
HDEVINFO DoDeviceEnum( GUID InterfaceClassGuid)
/*
Routine Description:
Retrieves the device information set that contains that contains
the devices of the specified class.
Parameters:
InterfaceClassGuid - The interface class GUID.
Return Value:
If the function succeeds, the return value is a handle to the
device information set.
If the function fails, the return value is zero.
*/
{
HDEVINFO DeviceInfoSet;
HDEVINFO NewDeviceInfoSet;
// Create a device information set that will be the container for
// the device interfaces.
DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
if(DeviceInfoSet == INVALID_HANDLE_VALUE) {
Err = GetLastError();
printf( "SetupDiCreateDeviceInfoList failed: %lx.\n", Err );
return 0;
}
// Retrieve the device information set for the interface class.
NewDeviceInfoSet=SetupDiGetClassDevsEx( InterfaceClassGuid,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,DeviceInfoSet,NULL,NULL);
if(NewDeviceInfoSet == INVALID_HANDLE_VALUE)
{
Err = GetLastError();
printf( "SetupDiGetClassDevsEx failed: %lx.\n", Err );
return 0;
}
return NewDeviceInfoSet;
}
int main(int argc, TCHAR* argv[])
{
DoDeviceEnum(NULL);
return 0;
}
|
|
|
|
|
i included the windows.h,setupapi.h,stdio.h
i want the computer to enumerate the hardware devices like
mouse,key board, NIC etc....
thanks
|
|
|
|
|
search in the forum, this question has been asked few days ago...
(maybe it was you )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
this question has been asked few days ago...
(maybe it was you)
Indeed, at least three separate times.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i need the similar which can read quickly and show quikly within 'CWnd',
compability diff format graph such as 'gif', 'bmp', 'png' etc.
specialy, biggest graph!!!
I know CxImage is a very strong libaray for dealing diff format graph, but it don't support biggest graph that can read and show image, thus, i will search other...
who can help me? thanks!!!
|
|
|
|
|
i am kinda new to C++. So, here is a question: what does enum type make the program different? personally, i see it as an array. am i wrong?
|
|
|
|
|
Check this article out.[^]
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
- -Uknown.
|
|
|
|
|
I'm not much of a C++ programmer myself, but I see enum variables as integers with a restricted set of values, like the old set type in Pascal. The list of possible values for an enum are mapped to integers which can be assigned explicitly or automatically. The declaration
enum Colors (Red, Blue, Yellow);
assigns integer tokens to represent the words "Red," "Blue," and "Yellow" but in the program you don't have to worry about what value was assigned; you only have to worry about trying to assign a variable of the type Colors a value other than one of those in the list.
If you're worried about it you can also assign the integer values -
enum DaysOfTheWeek (Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6, Sun=7);
If you later declare a variable
DaysOfTheWeek Today;
You can assign it the value of 3 or Wed and still get the same result:
Today=3;
if (Today == Wed) doSomething();
will execute doSomething().
Enums greatly improve program readability, and help to reduce maintenance costs. In a way they are like arrays, or more accurately vectors as they have only one dimension. But arrays and vectors are not limited in the values they contain (other than the limitations of their types). Enums are, by definition, restricted to certain values that you define.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
if i m using C in MFC right, in ListBox_GetSelItems(hCtrl, count, intArray) will it stores all the selected no in the intArray??
i m using the method below, but its stil not working!!can i know why???
total = ListBox_GetCount(hCtrl);
ListBox_GetSelItems(hCtrl, count, &lstItems);
// ListBox_GetSelItems(hCtrl, count, ArrayInt.GetData(hCtrl));
_stprintf(TextDisp, "Count = %d", count);
DispMsg(TextDisp);
for(i = 0 ; i < total ; i++)
{
if(iCount <= count && lstItems[iCount] == i)
{
DispMsg("True");
ListBox_GetText(hCtrl, lstItems[i], tmp );
hCtrl = GetDlgItem(hDlg, IDC_LVLSQ_SESSADJ );
ListBox_AddString(hCtrl, tmp) ;
DispMsg(tmp);
iCount = iCount + 1;
}else
{
DispMsg("False");
}
}
please Help me anyone...i hav try this for too long!!
|
|
|
|
|
Is this any better?
int nCount = ListBox_GetSelCount(hCtrl);
int *pArray = new int[nCount];
ListBox_GetSelItems(hCtrl, nCount, pArray);
for (int x = 0; x < nCount; x++)
{
ListBox_GetText(hCtrl, *(pArray + x), tmp);
DispMsg(tmp);
}
delete [] pArray;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Dumb question.. I'm sure it's super easy but I can't figure it out for what ever reason...
How can I replace all the 0x0a char's in a string with " \\line " ?
Right now I am taking a char converting it into a CString and converting the string into RTF.. I'm having problems getting the 'new line' or 'line returns' put into the string.
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
|
Damn I knew it would be easy.. LOL
Thanks!
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
|
hi all,
is it possible an application crashed but the dr. watson and windows event log not able to detect it?
i have a server application running daily. it have a simple dialog and a tray icon. today, i found it disappear from the screen in lunchtime, just like being killed by taskkill.(the tray icon is still here) i cant find any eventlog for application crash and dr. watson have no dump for this, which suppose logged for the crash i found b4.
i added taskkill in the scheduler to kill the application at 5pm and i experienced some strange behaviour of this schedule b4. (like it run a long while later than our schedule time..)
so, i wonder if the killtask killed the application abnormally. i dont think it is a reasonable answer anyway! so, i want to ask u guys experience any an application crash but windows cant detect? (just like the application disappear suddenly, no dialog asking u to report MS, no eventlog and no dr.watson dump)
and, i have tried to make another simple application with bug to crash and test in that server. the crash of that application able to create the eventlog and all the dumps i said b4... of course, this crash may not the same as the crash of that application. just want to make sure the windows started dr.watson and all debug monitoring tools.
pls help!
i just feel to frustrate this problem appear. i have no hint what happen...
thanks,
jim
|
|
|
|
|
I wish I knew the answer... I run Win2k Server at home, and it has never invoked Drwatson on failure. I've never seen any mention of it in any documentation, either - maybe that's no longer installed automatically as it was in WinNT. The failure of the Event log is more serious - that should have happenned on any application failure. I'll be watching this space just in case someone can give you an answer! Thanks for asking...
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
i have tested with another application. i make it crash. i can still see event log capture this event even dr. watson failed to get the dump.
i heard that dr watson only dump for some problems will affect the OS.
anyway, the event log and drwatson should be running. (at least, it can capture the crash i make) however, i just dont know my target application is really crashed or being killed by somebody.
|
|
|
|
|
I am working on a program in c++ called permutations can you help me.
This is the exercise.
a program that inputs a value n and generates all n! permutations of the numbers in the set {1, 2, 3, …, n}.
Pebbles
|
|
|
|
|
There are some permutations article in CodeProject.
|
|
|
|
|
I know I have looked at them. I am a beginner at this. I am trying to make the progra work as follows..
cout<<" enter a set of numbers"<<
cin>>ser of number;
I need n numbers not a specific string.
Please help
|
|
|
|
|
|