|
I've got this problem with sorting items in my treectrl...
To sort the Children of a Parent i'm using the function SortChildrenCB. According to the Example in MSDN (CTreeCtrl::SortChildrenCB) 'the lParam of an item is just its handle'. This is incorrect in my situation, because the values of lParam1 and lParam2 represent my itemdata! Even with the exact code from the example from MSDN i receive the itemdata value als lParam...
Any tips/hints?
|
|
|
|
|
It's apparently an error in MFC documentation, lParam1 and lParam2 are item data. CTreeCtrl::SortChildrenCB is just a MFC wrapper over TVM_SORTCHILDRENCB message. The funny thing is that they have it documented correctly in "Windows Common Controls/Tree view":
"int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort);
[...]
The lParam1 and lParam2 parameters correspond to the lParam member of the TVITEM structure for the two items being compared."
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
So, now I know how to create an automation which open known Excel workbook and worksheet. But the aim of my job is, after this first step, to read and catch cells.value to be used in functions which are implemente with vc++. My question is how could I do that?
Thank you for your help
Gerald
|
|
|
|
|
Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...
|
|
|
|
|
Whenever u want the data on the dialog box to come into its vairables call UpdateData(TRUE) and whenever u want the data in ur variable to go into the dialogbox call UpdataData(FALSE)
I hope this is what u r looking for
|
|
|
|
|
Just a quick answer: call UpdateData() and your member variable will be up to date.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
There is no rule about calling base class functionality. If you need it to do its work before your work, you call it first. If you need it to do it after, you call it after. If you don't care either way, then do it one or the other, but always be consistent.
OnOK() calls UpdateData() during its processing, which you can do at any time you need to (though some say that having to call UpdateData() is a sign of a poorly designed program. I don't always agree, Dialog based apps often need to call it).
|
|
|
|
|
Is it possible to add my own custom control to a CommandBar?
I have made my own bar with a couple of buttons, but now I would
like to add a control of my own also.
Can it be done?
/Jerry
|
|
|
|
|
Hi all:
Do you know what is the POSITION type in VC++? How can we use it?
|
|
|
|
|
From MSDN:
POSITION
Placeholder for a linked list.
struct __POSITION { int unused; };
typedef __POSITION* POSITION;
Members
unused
Integer value that specifies the location of an item in a linked list.
Remarks
This structure can point to any element in a linked list, including null elements (such as an end-of-list marker). This structure will, however, become invalid if you delete the item it points to.
When you perform operations that return a POSITION pointer on a single list element, a successful operation sets it to an appropriate non-null value, while NULL indicates that the items position could not be found. When you perform operations on the entire list, the pointer represents a Win32 BOOLEAN value, where TRUE indicates success and FALSE indicates failure.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
POSITION type is nothing but a pointer to a structure. Container classes like CObList internally use a CNode pointer to store a single list element.
When we use POSITION CObList::AddTail(CObject* newElement) or such functions, a new CNode* is created and it is typecasted to the POSTION type. This position type is returned. Basically it is nothing but a pointer to CNode.
The POSITION type is useful when iteration of list is needed.
See MSDN.
|
|
|
|
|
i'm mading program that blocks word-unit in CView derived class.
for example, if mouse does double-click, the relevant word is blocked.
please let me know how to implement easily.
have a nice day
|
|
|
|
|
I'm sorry, but no-one in this office can figure out what you want. I presume you want to double click on a word to select it, but we cannot guess what you want to block this word *from*, or how or why you want to do this. Please provide some more information regarding your thought processes here.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
how can I change ip address with vc?
|
|
|
|
|
http://www.codeproject.com/internet/nwset.asp
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
For the life of me I can't get this function to not crash my program.
CTime somecoolvariablename, anothercoolvariablename;
somecoolvariablename.GetCurrentTime();
// do something
anothercoolvariablename.GetCurrentTime();
if(anothercoolvariablename.GetSecond() - somecoolvariablename.GetSecond() > 10) // CRASH HERE!
MessageBox(yadda yadda yadda);
I've tried it in as many contexts as possible, it always crashes. I tried using CTimeSpan, it doesn't wanna work for me either!
CTimeSpan supervar;
// do something
if(supervar.GetTotalSeconds() > 10)
MessageBox(yadda yadda yadda);
I must be missing something simple....
- John
|
|
|
|
|
I think that CTime has a habit of crashing. I faced a lot of problem due to this. Use COleDateTime instead and it has nearly the same function.
|
|
|
|
|
The problem come from the fact that you're using GetCurrentTime() in the wrong way; it is a static function that returns a CTime object filled with the current time.
Therefore, the following code should work:
CTime somecoolvariablename, anothercoolvariablename;
somecoolvariablename = CTime::GetCurrentTime();
// do some work
anothercoolvariablename = CTime::GetCurrentTime();
if(anothercoolvariablename.GetSecond() - somecoolvariablename.GetSecond() > 10) // CRASH HERE!
MessageBox(yadda yadda yadda);
|
|
|
|
|
I need have my controlling thread function for a second thread as a member function of a class. From what I've found out, this means that the function must be declared staticly. There was a good discussion about this previosly HERE. However what I need, is to be able to access the class's non-static member variables, which the above linked topic discusses, but does not provide a solution. Is this possible?
|
|
|
|
|
Well, yes - the usual trick is to pass a pointer to the class as the LPVOID parameter of the threadproc function. Then, inside your class, you can cast it as a pointer to the class and you have access. Kind of like making calls with an explicit this pointer, but it works.
|
|
|
|
|
|
Usually I implement it as follows:
class CMyClass
{
static UINT _MyThread( LPVOID pParam )
void MyThread();
void StartThread();
};
UINT CMyClass::_MyThread( LPVOID pParam )
{
reinterpret_cast<CMyClass*>(pParam)->MyThread();
return 0;
}
void CMyClass::MyThread()
{
}
void CMyClass::StartThread()
{
AfxBeginThread( _MyThread, reinterpret_cast<void*>(this) );
} Regards,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
Where can I find the C++ source code (MFC or ATL) of an ActiveX control that supports OLE Drag and Drog?
|
|
|
|
|
I am writing an application that makes extensive
use of an unlimited undo / redo mechanism, and I've also added the ability for my users to delete files off the hard drive through my gui. I am using the following code to delete a file and send it to the
recycling bin:
SHFILEOPSTRUCT OpInfo;
OpInfo.hwnd = ::AfxGetMainWnd()->m_hWnd;
OpInfo.wFunc = FO_DELETE;
OpInfo.pFrom = FilenameStringRaw;
OpInfo.pTo = NULL;
OpInfo.fFlags = FOF_ALLOWUNDO | FOF_FILESONLY | FOF_NOCONFIRMATION |
FOF_SILENT | FOF_NOERRORUI;
int result = ::SHFileOperation(&OpInfo);
MHogDeleteArray(&FilenameStringRaw);
Now that all works fine. The problem is---how do I let the user UNDO the
delete programmatically? The flag FOF_ALLOWUNDO suggests that this
should be possible, but I can't figure out how. Been looking everywhere.
Thanks.
Matus
====================================
Check out Aephid Photokeeper, the POWERFUL digital
photo album solution at http://www.aephid.com
|
|
|
|
|
http://www.msdn.microsoft.com/msdnmag/issues/01/04/c/c0104.asp
Good Luck.
Carlos Antollini.
|
|
|
|