|
Ok, I got it working, I had it right by the last response, the next error that came up was somewhere else unrelated and I was too tired to notice.
Thank you very much for your help.
|
|
|
|
|
Is there a specific reason why you don't want to use the containers from the STL (std::map, std::vector, ...) ? All these classes already provide support for what you are doing, so why do you want to rewrite that ?
|
|
|
|
|
Just an attempt to learn a little more.
|
|
|
|
|
I can't find any refrence any where(like this website, google, wiki).
-----------------How I found it-------------------------------------------
It's a Window's string message(0xC000 through 0xFFFF).
I got this from my [MFC Dialogbased Program]:
create a new [MFC Dialogbased Program], put a breakpoint here:
thrdcore.cpp
BOOL AFXAPI AfxInternalPumpMessage()
{
_AFX_THREAD_STATE *pState = AfxGetThreadState();
if (!::GetMessage(&(pState->m_msgCur), NULL, NULL, NULL))
Do nothing but start you program, you will get a message over 0xC000.
Use spy++ or GetClipboardFormatName you will get "MSUIM.Msg.*" //* may be Private
|
|
|
|
|
Dear all,
I met a problem where after i patch my VC++ 6.0 to service pack 5 and patch processor pack onto it, my application crash and pop up message saying that there is a stack over flow.
The problem is before patch, the same source code does not crash stack over flow.
Is there any setting i need to set after pack processor pack? Or what can i do.
The error message is :
During run time, the error message is :
The instruction at "0x09e02ebc" referenced memory at "0x00000004". The memory could not be "read".
But when i debug the release version:
Unhandled exception in MyApplication.exe (MyApplication.DLL) : 0xC00000FCD:Stack Overflow.
Please advice .
Thank you !!
|
|
|
|
|
I have a xml in a remote machine. This remote machine is accessible to some machines, and not accessible to some machines. In a scenario we try to load the xml. We are getting a delay in the UI when machine which is not able to access the remote machine , is trying to load the xml from the remote machine. How to handle this scenario. Is there any way to check whether remote machine is accessible or not before loading that xml. Or any other better solution.
Thanks
|
|
|
|
|
If you don't want the UI looking like 'frozen' then you may use a worker thread to perform the connection with the remote machine.
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]
|
|
|
|
|
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 ??
|
|
|
|