|
Did you call CommonControlsEx()[^] from InitInstance of you CWinApp derived class? If not, this should solve the problem.
|
|
|
|
|
It's not being called from either project. When I did call it from the first project (with Generate Manifest set to No), I still get an error about mfc90ud.dll being missing from my computer. So the DLL error seems to point to the Generate Manifest setting rather than the call to InitCommonControlsEx() .
"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
|
|
|
|
|
|
Jochen Arndt wrote: Using Google, I found this: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/545d9b69-5f27-473f-b6d1-bea106cde47f/[^]
That's not a solution. It's a band-aid at best.
"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
|
|
|
|
|
Please read the complete thread from my link and also the thread mentioned in the last post (the link does not work but it can be found by searching for the subject).
|
|
|
|
|
Hi,
I have a slider control on a dialog box. By default slider thumb moves by ticks when user clicks the slider bar. I want when user clicks on the slider bar, thumb should move to that position in one click not step by step. The thumb should move to the position where user clicks the mouse on the slider bar.
Anybody have any idea or sample code for the same.?
Any help will be appreciated.
Regards,
mbatra
|
|
|
|
|
Hi, I wanna develop a windows service to monitor the USB device insert/remove, and set a hook for mouse. I have successfully implemented the windows service program, I can also detection the event of USB insert/remove. But after I set the mouse hook, It seems that the system doesn't call the corresponding callback function defined in the hook. The windows service handler code is like this:
HINSTANCE hmodule = LoadLibrary(_T("MouseHookDLL.dll"));
if (hmodule == NULL)
{
WriteToLog("DLL Load Failed.");
FreeLibrary(hmodule);
return 0;
}
typedef BOOL (*pInstallHook)(HINSTANCE hmodule);
typedef BOOL (*pUnInstallHook)();
pInstallHook InstallHookFunction = (pInstallHook) GetProcAddress(hmodule, "InstallHook");
pUnInstallHook UnInstallHookFunction = (pUnInstallHook) GetProcAddress(hmodule, "UnInstallHook");
switch (evtype)
{
case DBT_DEVICEREMOVECOMPLETE:
{
WriteToLog("Remove USB Device.");
UnInstallHookFunction();
}
break;
case DBT_DEVICEARRIVAL:
{
WriteToLog("Insert USB Device.");
InstallHookFunction(hmodule);
}
break;
}
FreeLibrary(hmodule);
return 0;
In the MouseHookDLL, I defined the InstallHook(),UnInstallHook(), and the MOUSEHOOKDLL_API LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) functions. I debug the windows service program, I know I can call the InstallHook() correctly, but not the callback.
|
|
|
|
|
I wrote a numerical calculator engine in C++. It can do all the normal arithmetics, it has in-built and user defined variables and functions. The engine compiles with all the compilers I have: Visual Studio 2010 Ultimate and 2012 Ultimate RC, Embarcadero RAD Studio XE and gcc (both on linux and on Windows using mingw). But it does not give me the precision I would like to have.
Example:
Pi is defined in the program as:
3.1415926535897932384626433832795029L
When I convert it to string I got different results (the differences are in italics):
Visual Studio: 3.141592653589793 10000
Rad XE: 3.141592653589793238
gcc: 3.141592653589793238 512808959406186204433
I use long double as the data type, which for Visual Studio is the same as double that is 8 bytes long, for Rad XE it is 10 bytes (80 bits), while for gcc it is 12 bytes (where the last 2 is padding I think). The latter two compilers use the IEEE double sized numbers for long double which is 80 bits long. So the difference in accuracy is understandable.
But the calculator accessory in Windows gives
3.1415926535897932384626433832795
which is almost the same as the insanely large number of digits I entered. It misses the last 3 digits only. This means that
a) the calculator was not compiled with Microsoft compilers
b) or there is some trick which could be used to calculate with higher precision
c) or Microsoft was using some special high / arbitrary precision library
Can somebody help me to find either the tool or the method to achieve this high precision with the compilers I mentioned? Moreover I would like an open source solution, because I want to make the whole code to be open source.
|
|
|
|
|
afalco wrote: c) or Microsoft was using some special high / arbitrary precision library
Yes, the standard IEEE floating point library was replaced with an arbitrary-precision arithmetic library (but that's been a few years back).
"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
|
|
|
|
|
Thanks. Do you know which one?
I was thinking about using one myself but I haven't found a library yet which does not only do arithmetic but also the usual set of functions (sin, etc).
|
|
|
|
|
Some info here[^].
Veni, vidi, vici.
|
|
|
|
|
|
I have a NMS application running in Windows 2003 server. The application usually has a working set of 35.000 KB aprox, but lastly I've seen that the working set climbs slowly until 600.000 KB aprox. or more...
I have revised the too large code with a static analysis tool and I haven't found no suspicious memory leak...
I would like to localize the thread that is consuming a big amount of memory but I don't know how to.
Do you know any aplication that monitors the memory usage of the several threads of a specific process?.
In addition to this, I have found something surprising... Usually I monitor the server by establishing a remote desktop session, when I disconnect the remote desktop session the working set of the application is freed, I mean, It down from 600.000 KB to 30.000 KB..., someone could tell me why?
|
|
|
|
|
If everything else fails to find the memory leak, you can try increasing the memory used ten-fold at single points in your application, one at a time. When you see the working set start to climb ten times faster, you've found the leak. I call this approach the "Signal Flare".
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
I can recommend using VLD[^] and compile your application in release mode with the define VLD_FORCE_ENABLE.
|
|
|
|
|
There are any number of free and commercial libraries and other tools used to find memory and resource leaks in C++ code.
However you haven't really identified so far that your application has a "leak". What you have identified is that it uses memory. Which of course any application does. A leak is somethere where memory is consumed unintentionally until all memory is gone.
|
|
|
|
|
I use treecontrol to build a tree, it is a 3 level tree has one root node ,there are several children nodes which is under root node, and some leaf nodes are under children nodes,but some are not, they are under root nodes. for each level node I have a popup menu, but for the leaf node which is under the root node, it can't tell which menu it should popup.
In the code I set up a level_num to decide which node popup what kind of menu,but leaf node in the children level,it has same level_num of children node,so could anyone can help?
if(iCode)
{
if(level_num == 4)
m_Menu.LoadMenu( IDR_DELETE_SUBPRJ) ;
if(level_num == 3)
m_Menu.LoadMenu( IDR_ADD_SUBPRJ);
if(level_num == 2)
m_Menu.LoadMenu( IDR_ADD_GROUP);
p_Menu = (CMenu*) m_Menu.GetSubMenu(0);
if( p_Menu != NULL)
p_Menu->TrackPopupMenu( TPM_RIGHTBUTTON|TPM_LEFTALIGN, pos.x, pos.y, this);
p_Menu = NULL;
}
|
|
|
|
|
You could always check the level of the parent node. Alternatively make sure that each node has a level which actually matches its real level in the tree.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I'v already solved it,I use setItemData to assign a enum variable when I initial the tree nodes, so when I need to decide which menu should be popped up I use getItemData to get that enum variable to decide.
Thank you anyway
|
|
|
|
|
Hi all,
on NM_CLICK i have process the lit item and it takes some time,at this time when i click on the list ctrl whether it disable its working and the click goes in message queue so when 1st click process ends those cilcks automatically perform their action.
i just want to avoid this message queue,
i want no click goes in message queuq while the process is not finish.
please help me how can i do this.
thanks in advance.
|
|
|
|
|
You may disable the list control window while performing time consuming tasks. With disabled windows, mouse and keyboard input is ignored:
CMyListCtrl::OnNMClick(NMHDR * pNMHDR, LRESULT *pResult)
{
CWaitCursor wait;
EnableWindow(0);
EnableWindow(1);
*pResult = 0;
}
|
|
|
|
|
i have already tried this,
but same same situation occur here
while list is disabled ,when click on list control that time the click event not working but after ending of previous process this event work.
|
|
|
|
|
Hi all,
I'm trying to use EnumFontFamiliesEx to get all the fonts on a Windows 7 system, and it only returns one font: "System".
I tried to follow the incomplete documentation for this function here: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k%28%22WINGDI%2fENUMFONTFAMILIESEX%22%29;k%28ENUMFONTFAMILIESEX%29;k%28DevLang-%22C%2B%2B%22%29;k%28TargetOS-WINDOWS%29&rd=true[^]
but with no luck. Here's my function (in a dialog-based MFC app):
void CAllFontsDlg::fillListBoxWithFonts ()
{
lb = (CListBox*) GetDlgItem (IDC_LIST1);
CDC* pDC = GetDC ();
LOGFONT lf;
lf.lfFaceName[0] = '\0';
lf.lfCharSet = DEFAULT_CHARSET;
HRESULT hr;
hr = EnumFontFamiliesEx (pDC->m_hDC, &lf, EnumFontFamExProc, 0, 0);
}
And here's my callback function (which is called exactly once):
CListBox* lb;
int CALLBACK EnumFontFamExProc(
const LOGFONT *lpelfe,
const TEXTMETRIC *lpntme,
DWORD FontType,
LPARAM lParam)
{
lb->AddString (lpelfe->lfFaceName);
return 0;
}
Can anyone see what I'm doing wrong? Thanks!
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
Solved my own problem! The "return 0" in the callback function was terminating the enumeration the first time through! My fault...
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
can any one explain why this code...
#include <boost\logic\tribool.hpp>
using namespace boost;
using namespace std;
tribool test1();
tribool test2();
int _tmain(int argc, _TCHAR* argv[])
{
if( !test1() || !test2() )
cout << "test failed" << endl;
return 0;
}
tribool test1()
{
cout << "test1" << endl;
return true;
}
tribool test2()
{
cout << "test2" << endl;
return false;
}
gives the following output..
test2
test1
test failed
According to the documentation on the || operator the
The operands of logical-AND and logical-OR expressions are evaluated from left to right. If the value of the first operand is sufficient to determine the result of the operation, the second operand is not evaluated. This is called "short-circuit evaluation." There is a sequence point after the first operand. See Sequence Points for more information.
I fixed the "bug" by changing my if statement to
if( !static_cast<bool>(test1()) || !static_cast<bool>(test2()) )
I did notice in the disassembly that the boost function boost::logic::operator|| was being called and wonder if this what was effecting my logic.
Thanks in advance
Thanks,
Robin.
|
|
|
|