|
Hi,
I have a slight problem with a tree control. I cannot manage to insert items again after having deleting the whole thing.
I tried this :
<br />
HTREEITEM hMyItem = m_TreeCtrl.InsertItem( "my item" );<br />
HTREEITEM hMyChildItem = m_TreeCtrl.InsertItem( "my child item", hMyItem );<br />
<br />
m_TreeCtrl.DeleteAllItems();<br />
<br />
m_TreeCtrl.DeleteItem( TVI_ROOT );<br />
<br />
hMyItem = m_TreeCtrl.InsertItem( "my item" );<br />
hMyChildItem = m_TreeCtrl.InsertItem( "my child item", hMyItem );<br />
Instead of having "my item" as the new root in my tree, I have a blank space and no child displayed. Also, the insert functions succeed as they return a value for the items. Any ideas ?
Thanks,
Vincent
|
|
|
|
|
not tested but do not believe it is system problem
(1 and 2 are the same)
don't you have any own TVN_DELETEITEM handler or WM_PAINT?
is it called in one fn like displayed?
(what when you will not insert children? when you will not delete?)
t!
|
|
|
|
|
No to everything : no special handler, no subclasssing, nothing fancy, not called in any special function, just from a button's OnClick function.
When I don't delete, my new items are appended to the previous ones, ie
<br />
|-myItem<br />
|- myChildItem<br />
<br />
becomes<br />
|-myItem<br />
| |- myChildItem<br />
|<br />
|-myItem<br />
|- myChildItem<br />
<br />
as expected if you delete nothing and append to TVI_ROOT.<br />
|
|
|
|
|
can't be problem any unpair disable/enable-draw?
t!
|
|
|
|
|
<br />
void CMyDialog::OnBnClickedButton1()<br />
{<br />
m_ctrlTree.InsertItem( "toto" );<br />
m_ctrlTree.DeleteAllItems();<br />
m_ctrlTree.InsertItem( "tata" );<br />
}<br />
Here is the code, cannot be simpler ... Maybe you could try it quickly, insert a tree, associate with a variable, insert a button, copy paste my code in the event handler and see what the tree looks like.
BTW, thanks for your time
|
|
|
|
|
sorry, can't reproduce, do you have another computer or system installed?
t!
|
|
|
|
|
Hi,
I have tested code as below and it works fine
HTREEITEM hMyItem = m_myTree.InsertItem( "my item" );
HTREEITEM hMyChildItem = m_myTree.InsertItem( "my child item", hMyItem );
// 1. I delete the items I just inserted
//--
m_myTree.DeleteAllItems();
// OR 2. (according to the MSDN that should do the same)
//--
m_myTree.DeleteItem( TVI_ROOT );
hMyItem = m_myTree.InsertItem( "my item" );
hMyChildItem = m_myTree.InsertItem( "my child item", hMyItem );
Have u checked required properties of CTreeCtrl.
I don't see any problem in your code.
The chosen One
|
|
|
|
|
Just made a test ...
works with Visual Studio 6 on another machine. Does not work on my machine with Visual Studio 2003 ! Same procedure, new MFC app with the wizards, insert a new tab control in the dialog, add a simple button, implement the event handler of the button to do: InsertItem; DeleteAllItems; InsertItem;
Glups. Does anybody have the same problem or does this just come from the piece of s**t behind my keyboard ?
|
|
|
|
|
How to stop other Process use ReadProcessMemory to Inject into my Process?don't use APIHOOK?
|
|
|
|
|
The only way is hooking the ReadProcessMemory system-widely and checking if a process wants to read from your process.
You could also patch the ReadProcessMemory function (patch on assembler level to immediately return), but I wouldn't do it. Patching can lead to serious problems. This would require that you need to overwrite the Windows kernels of the users, and I don't think that most users like it if their kernel is patched...
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
I've not tried this so it's simply a guess. ReadProcessMemory() requires that the memory being read be accessible for read access. Otherwise, the function fails. That implies that your process could somehow "lock" its heap memory.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello all,
I am using context menu (with TrackPopupMenu()).
When I use it with an usual window, all is OK.
If I use it in a "real" fullscreen window, it appears only now and then.
I used SetForeGround(motherWindow) before,
and postmessage (WM_NULL, ...) after
and I still get a variable behavior.
here is the code:
SetForegroundWindow(myHwnd);
int result = TrackPopupMenuEx(myMenu,TPM_RETURNCMD|TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON , pt.x, pt.y, myHwnd, NULL);
PostMessage(myHwnd, WM_NULL, 0, 0);
I also use fileDialog the same way (with setforeground and postmessage), which does not appear when called . I managed to get focused on it, but it takes my window out of fullscreen mode.
fullscreen window is a DX or openGL render space.
Hope someone will be able to help me ?
Thanks in advance
|
|
|
|
|
I only know that bool is a boolean type that only
return true(1) or false(0). Then what about BOOL?
I know they are different, but I don't know how
they are different.
|
|
|
|
|
A BOOL i simply a typedef of an 4 byte int .
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
bool -> true | false
BOOL -> TRUE | FALSE
BOOL is in fact a 4 byte long integer variable. But you should only set it to TRUE or FALSE.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Any more example? Why do we need two boolean logic data tpyes?
Does BOOL appear in C language?
|
|
|
|
|
Alex Ngai wrote:
Any more example? Why do we need two boolean logic data tpyes?
BOOL is a good choice for 32-bit applications
bool, naah, it works if you want to use it... but no...
Alex Ngai wrote:
Does BOOL appear in C language?
Just include windows.h and tada!
You can also define it yourself:
typedef int BOOL;
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
BOOL isn't standard C language no. It's defined in the Windows headers. It's used by Windows API functions to pass flags.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
The header file that I have says its a plain int;
Thank You
Bo Hunter
|
|
|
|
|
Right.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
There are no archive insertion/extraction operators defined in CArchive for "bool" so Serialization will not work.
Use bool as much as possible if u r not dealing with windows api.
while porting OS from 16 bit to 32 bit, sizeof "BOOL"( which is typedef of integer) also increased.If in future, while porting OS to 128 bit, size of BOOL(same as sizeof int) will b 16 bytes. R u going to tolerate this stupidity if u r not dealing with WinAPI?
If u r using more than one boolean variable in ur code, I 'll suggest u to use one bool with bitfields. This way u will accommodate upto 8 bool variables. I believe that MS Access stores boolean datatypes this way.
The chosen One
|
|
|
|
|
Well, I wonder if VS.Net support pure C language? Since there is no
C file that you can create when you open a new project in VS.Net.
|
|
|
|
|
Yes it does. Just rename the file to .c
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
By saying Pure C language, I mean C99, the latest ANSI/ISO standard
for C. Have you written a project that using only C, and does not
contain any code that is C++ stardand? And how is the result?
Is the result what you expected? Any strange error during compiling
and running?
|
|
|
|