|
You're welcome!
Never underestimate the power of stupid things in large numbers
--- Serious Sam
|
|
|
|
|
Hello!
I just want to pass through all the siblings of a parent CTreeCtrl node.
So I do something like the code from msdn http://msdn.microsoft.com/en-us/library/xfh3f9zt.aspx[^]:
if (m_TreeCtrl.ItemHasChildren(hmyItem))
{
HTREEITEM hItem = m_TreeCtrl.GetChildItem(hmyItem);
while (hItem != NULL)
{
hItem = m_TreeCtrl.GetNextSiblingItem(hItem);
}
}
The problem is that, GetNextSiblingItem never returns null. When all the siblings are passed through and the function should return null, it just returns the first sibling. So it enters into an infinite loop. I just cannot understand why it does so.
|
|
|
|
|
I had used this code several time without any problem ... so, check your code again, eventually load the tree with few simple test items ...
|
|
|
|
|
|
I had created an dialog based project, where I put an tree control, named m_Tree, and in OnInitDialog I wrote following code:
HTREEITEM hItem = m_Tree.InsertItem(_T("One"));
m_Tree.InsertItem(_T("Test1"), hItem);
m_Tree.InsertItem(_T("Test2"), hItem);
m_Tree.InsertItem(_T("Test3"), hItem);
m_Tree.InsertItem(_T("Two"));
m_Tree.InsertItem(_T("Three"));
HTREEITEM hRoot = m_Tree.GetRootItem();
if(m_Tree.ItemHasChildren(hRoot))
{
HTREEITEM hChild = m_Tree.GetChildItem(hRoot);
while(NULL != hChild)
{
TRACE("%s\n", m_Tree.GetItemText(hChild));
hChild = m_Tree.GetNextSiblingItem(hChild);
}
}
which are similar with yours, and I get this:
Test1
Test2
Test3
You could try it ...
modified 13-Jan-14 3:48am.
|
|
|
|
|
Thanks for your answer!
I know it works, because I tried another similar tree myself. But I really do not know why it does not work in a particular case. What I am trying to do is to copy a CTreeCtrl from Dialog1 to Dialog2. So I do something like Dialog1::_tree1.GetNextSiblingItem(ci) and then put ci in _tree2 which is in Dialog2, like this _tree2.InsertItem(csChild,NULL, NULL), where csChild = Dialog1::_tree1.GetItemText(ci).
So it may be that this cross dialog thing is the problem.
|
|
|
|
|
How can I know which are short time format programatically ? Just like Windows Explorer show on files date modified ... Thank you.
|
|
|
|
|
I'm not really sure what you are trying to do but the Locale[^] functions may help you.
Veni, vidi, abiit domum
|
|
|
|
|
I think I found something: GetLocaleInfo with LOCALE_SSHORTDATE ... thank you.
|
|
|
|
|
I didn't find LOCALE_SSHORTTIME in GetLocaleInfo, so how can I find short time format ?
modified 6-Jan-14 8:22am.
|
|
|
|
|
|
Yes, that I had checked in MSDN help, but none of these shows the short time format, just long time format ...
|
|
|
|
|
It was introduced with Windows 7. In any case, the short format is typically the long format minus the "ss" pattern.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes, indeed, I saw no short time format in XP ... thank you all.
|
|
|
|
|
|
i have main.cpp ,makefile , build.bat
//----------main.cpp----------------------------
#include <iostream>
int main()
{
std::cout << "hello world." << std::endl;
return 0;
}
//--------------makefile-------------------------
foo: main.cpp
CL main.cpp
//-------------build.bat--------------------------
@echoOFF
echo buid by commnand line
nmake
echo =============================
echo run main.exe
echo =============================
main.exe
i use "Visual Studio command prompt " to run build.bat file .
+ with visual studio 2010 : ok
+ with visual studio 2008 : error
please help me how to fix on visual 2008 .
Thanks
Thong LT
============================visual studio 2010================
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd c:\Users\ttle\Desktop\
demo
c:\Users\ttle\Desktop\demo>build.bat
buid by commnand line
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
CL main.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled. S
pecify /EHsc
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
=============================
run main.exe
=============================
hello world.
//====================Visual studio 2008 ----------------
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : war
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\
VC\BIN\CL.EXE"' : return code '0x2'
Stop.
=============================
run main.exe
=============================
'main.exe' is not recognized as an internal or external command,
operable program or batch file.
|
|
|
|
|
Thong LeTrung wrote: LINK : fatal error LNK1104: cannot open file 'kernel32.lib' You should investigate why this message is being produced, and what directories are missing or not available in the 2008 build.
Veni, vidi, abiit domum
|
|
|
|
|
Hi,
I am a beginner in QT. I need to take static build of my QT application. (I am working in windows platform.)
I have done the following steps for the same.
1. Edit the qmake.conf file in C:\QtSDK\Desktop\Qt\ mkspecs\win32-g++ With
QMAKE_LFLAGS = -static -static-libgcc -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
2. Run command prompt
And change the path to C:\QT\QtSDK\Desktop\Qt\4.8.0\mingw
3. Run command configure -static –release.
4. Edit the project’s .pro file with
CONFIG += static
5. Restart QT.
But error occured in step3. The error was as follows .
unable to detect the platform from environment. Use -platform command lineargunt or set the QMAKESPEC environment variable and run configure again. See the README file for a list of supported operating systems and compilers.
I would like to know, how to set the QMAKESPEC environment variable and is there any other way to build qt application statically, to create independent executable files?
Thanks in advance,
Neethu.
modified 6-Jan-14 0:00am.
|
|
|
|
|
|
Most probably the QTDIR environment variable is not set. You can set it in your system [...]
How to set an environment variable[^]
Veni, vidi, caecus | Everything summarizes to Assembly code
|
|
|
|
|
I have set the QTDIR Variable with value D:\Qt\4.8.0
and QMAKESPEC=win32-msvc2008.
Updated PATH variable to include %QTDIR%\bin.
But still it is not possible to build the standalone executable file. On running my exe, it says that mingwm10.dll is missing. On copy pasting the same it asks for another dll QTCore4.dll.
|
|
|
|
|
Running Qt-Code has some pre-conditions. Try to copy the contents of %QTDIR%\bin into the folder which is your executable is located in and try to run the program again.
Veni, vidi, caecus | Everything summarizes to Assembly code
|
|
|
|
|
But my requirement is like I have to run the exe without copying any dependent dlls like mingwm10.dll.
Is it possible?
I have updated the myproject.pro file with the following code.
static { # everything below takes effect with CONFIG += static
CONFIG += static
CONFIG += staticlib # this is needed if you create a static library, not a static executable
DEFINES += STATIC
message("~~~ static build ~~~") # this is for information, that the static build is done
mac: TARGET = $$join(TARGET,,,_static) #this adds an _static in the end, so you can seperate static build from non static build
win32: TARGET = $$join(TARGET,,,s) #this adds an s in the end, so you can seperate static build from non static build
}
|
|
|
|
|
|
ok thank you. I shall try again.
|
|
|
|