|
Just adding to Carlo's reply, here's an essay[^] that describes the usage of worker threads.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Do we have any api or any code snippet which can check whether remote machine is accessible or not.
|
|
|
|
|
You should already have it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello!
I want to use dynamic memory allocation for multi-dimensional arrays. While allocating there is no problem. But how to deallocate the memory? If I use the Method-1 will it be okay or will it cause memory leak or run time error? Which of the two methods are technically correct?
int nVal,i;
int **pVal=NULL;
pVal = new int * [5];
for(i=0;i<5;i++)
pVal[i] = new int [3];
Deallocation Method - 1
...
...
delete [] pVal;
Deallocation Method - 2
...
...
for(i=0;i<5;i++)
delete [] pVal[i];
delete [] pVal;
Any help in this matter will be highly appreciated. Thanks in advance.
|
|
|
|
|
Method-2 is the right way to do it.
Method-1 would cause memory leaks as it only frees the array of integer pointers and not the integer locations.
I would recommend you use one of the standard C++ containers.
Here is an example -
vector<vector<int>> ii;
vector<int> i;
i.push_back(10);
i.push_back(20);
i.push_back(30);
ii.push_back(i);
To access the value 20, you would do ii[0][1] or you can use iterators.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
In addition to the previous reply, there is one basic rule that you have to remember: for each call to the new operator, there should be a corresponding call to the delete operator if you want to avoir memory leaks.
So, your first solution is wrong because you call new 6 times and only call delete once.
|
|
|
|
|
As a further further reply, I'd recommend use of Boost.multi_array[^] rather than a raw array or a vector of vectors.
Why would I suggest this? Well, it's better than a raw C++ array because it's a single object and carries its bounds around with it. It's better than a vector of vectors because it's a single object that implies less memory allocations and also addresses a contiguous range of memory.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you all. Your suggestions have helped me a lot.
|
|
|
|
|
Hello
Is it possible to convert .cpl to .msc?
Or the other way around? (if the other way around, I need a way to list only specify ones, such as .msc does with there MMC.
Would appreciate any advice.
Thanks in advance,
Panarchy
|
|
|
|
|
Not without significant rewriting, I'd have thought. An msc is a DLL implementing a specific set of COM interfaces, whereas a CPL is a DLL exporting a specific function[^] that responds to specific Windows messages. And that's ignoring the fact that Vista introduces a new style of Control Panel item[^]...
Architect the thing right (layer it so the UI-independent stuff, i.e. the actions you want the control panel item or MSC to do, are decoupled from the UI part of the code) and the task should be a lot simpler.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The purpose of this conversion, is that I would like an MMC with;
- Disk Management
- System Properties (only need to know RAM)
- Scheduled Tasks
- The backup directories
Currently I only know how to add Disk Managment to an MMC, and I can't work out how to add the other tools I need.
Please help me create, or find, the tools which I need.
Thanks in advance,
Panarchy
|
|
|
|
|
I reckon you're out of luck there - without source code, I don't know of any way that you can get CPLs to run in the MMC.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I see.
Well could you please help me create an MMC with MSC SnapIns which can do the following;
☑ Checks RAID (or Opens Disk Management)
☐ Checks and shows to the screen how much RAM (in GB) within local machine
☐ Checks Scheduled Tasks (or just opens up the folder within an MMC window)
☐ Opens up the Backup Directory (there are 3 different backup directories, only 1 exists at a time, so will need if & else commands here)
Thanks in advance,
Panarchy
|
|
|
|
|
You really don't ask for much, do you....I would suggest you start here[^] and learn how to do it yourself - you'll find it a lot more educational that way.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I ended up working it out myself!
Action->New Taskpad View
Thanks anyways for the help!
|
|
|
|
|
In Recordset::Open(const _variant_t & Source,const _variant_t & ActiveConnection,
enum CursorTypeEnum CursorType,enum LockTypeEnum LockType,long Options );
the function takes a _variant_t Source and _variant_t ActiveConnection as values.
But even if i create a _bstr_t connstr("Data Source= LibDB;"";,"";");
and a _bstr_t sqlQuery("SELECT * FROM lib_book_details ORDER BY ISBN");
and use it in Open(sqlQuery,connstr,adOpenDynamic,adLockOptimistic,adCmdText);
It still takes a _bstr_t.
Why doesnt the compiler throw an error ? 
|
|
|
|
|
_variant_t has a constructor that takes a constant reference to a _bstr_t object.
What is happening here is an implicit conversion from _bstr_t to _variant_t.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
In that case,why does it not take a _variant_t value.
Cause when i try to change the _bstr_t sqlQuery(...) to _variant_t sqlQuery(...) and then pass it to the Recordset->Open(...)function it gives a compile error : error C2664: 'Open' : cannot convert parameter 1 from 'class _variant_t' to 'class _bstr_t'
Why is that so ?? 
|
|
|
|
|
Are you sure this error is on that same line?
Is this the call for an ADO recordset?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
i think even u would get this error if u try it in ur program.I have checkd it its the same line that gives an error. 
|
|
|
|
|
vital_parsley2000 wrote: Cause when i try to change the _bstr_t sqlQuery(...) to _variant_t sqlQuery(...) and then pass it to the Recordset->Open(...)function it gives a compile error : error C2664: 'Open' : cannot convert parameter 1 from 'class _variant_t' to 'class _bstr_t'
It shouldn't. Could you please post the relevant code (i.e. recordset declaration, ecc..)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Interesting - when I try an equivalent bit of code:
#import "libid:B691E011-1797-432E-907A-4D8C69339129" no_namespace rename("EOF", "adoEOF")
_RecordsetPtr rs;
rs.CreateInstance(__uuidof(Recordset21));
_variant_t connstr("Data Source= LibDB;"";,"";");
_variant_t sqlQuery("SELECT * FROM lib_book_details ORDER BY ISBN");
rs->Open(sqlQuery, connstr, adOpenDynamic, adLockOptimistic, adCmdText);
it compiles successfully with VS2008. I would use Visual Studio's 'Go To Declaration' feature (right-click on Open) to see how your Open method is declared.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi All
How can i read List control CString values?Plz help me
|
|
|
|
|
CListCtrl::GetItemText[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Vietnam I
The level of the average programmer.
Sorry, because I asked many questions.
Assembler too difficult, I do not know it.
I see the bochs-2.4-msvc-src but I do not know.
Please, help me Who wrote the CMOS Boot from USB to 1
Partition of the HDD is divided into 4 Partition.Using
memory: 510K.
Boot-> create 1 window with Style, interface (GUI) by
my style + 1 ImageButton with event: Shutdown
computer.On window that displays mouse position.
All use VC6.Please, sourcecode no book
Vietnam
Thank you very much!
Vietnam is very beautiful country to invite me.

|
|
|
|