|
Hi All,
I have this global variable declared as in the below statement:
const LONG MYITEMID = MAKELONG(MAKEWORD('m','i'),MAKEWORD('d','0'));
Here when i try to build this i am getting the warning displayed 3 TIMES:
W8084 Suggest parentheses to clarify precedence
Can anyone tell me how to resolve this?
I have tried all types of typecasting.. but it didnt work.
Kindly help!
Priya Sundar
|
|
|
|
|
Hi Priya,
this is a Borland C++ warning, and it works well under Visual C++ (no error). If you would like to skip this please put # pragma warn -8084 .
Best regards,
Mihai Moga
|
|
|
|
|
Hi Moga,
You are right. it is a Borland c++ warning message.
But do you know why is this message coming for this sort of statement?
Thanks for the help. After putting that statement now it is working fine.
Priya Sundar
|
|
|
|
|
Hi Priya,
I'm not familiar with Borland C++, so I cannot answer to your question. Sorry!
Best regards,
Mihai Moga
|
|
|
|
|
|
Priya_Sundar wrote: const LONG MYITEMID = MAKELONG(MAKEWORD('m','i'),MAKEWORD('d','0'));
Here when i try to build this i am getting the warning displayed 3 TIMES:
W8084 Suggest parentheses to clarify precedence
Have you considered looking at how the preprocessor is expanding that statement? It might help you to see it in a different light.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
Im using List Control in my project. I have implemented the background color and text color of List Control.Everythig is working fine. But dint change the background color of header.How can i set the background color for header. Help me.
Thanks & Regards,
Anitha
|
|
|
|
|
Hi Anitha,
in order to change the background color of the CListCtrl's header you need to customize the header control. Please have a look to Matt Weagle's Using the Header Control[^] article. This should do it for you.
Best regards,
Mihai Moga
|
|
|
|
|
OnSelChange event of tab control i want to show a dialog
that dialog should with in the tab control (unable dialog move)
how can i set locatoin of dialog programatically ?
CTabCtrl *t=(CTabCtrl*)GetDlgItem(IDC_TAB1);
t->insertItem(0,"one");
t->insertitem(1,"two")
|
|
|
|
|
|
When using rand() from the standard cstdlib include files, how often should you seed the number generator?
Do you need to seed every time you use the rand() function, or just once at the start of the application?
Also, is srand((unsigned)time(0)); adequate for seeding purposes, or is something more complex a better idea?
|
|
|
|
|
Once. Otherwise you could seed it with the same time value which would result in the same number multiple times which is probably not what you wanted.
|
|
|
|
|
Iam having a MDI application.
I have two queris.
1. How to add the menu in childframe
2. For different child how i can add the different menu.
Thanks in davance.
Regards
Lavate Mallikarjun Avanna
|
|
|
|
|
In one project I used different Views with different Menus according to which was the active one. I did it creating the menus in the resource editor and then in the MyApp files (.h and .cpp) creating different CMultiDocTemplate one for each type of view, saying which menu was owned by which view.
BOOL CFPSApp::InitInstance()
{
AfxEnableControlContainer();
.
.
.
.
pDocTemplate = new CMultiDocTemplate(
IDR_FPSIITYPE,
RUNTIME_CLASS(CFPSDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CFPSView));
AddDocTemplate(pDocTemplate);
.
pParamRegMatTemplate = new CMultiDocTemplate(
IDR_VIEWTYPE,
RUNTIME_CLASS(CFPSDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CParamRegView));
AddDocTemplate(pParamRegMatTemplate);
.
}
this option is good when you know for sure how your project is going to be structured. There are other options to load/unload menus dinamically. If you use it you will have to load/unload the menu in the OnInitialUpdate and when your view loses and wins the focus another time. With the other way I have explained all is done automatically.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi
is it possible to show a single item's text in multiple line in a combo box?
Thanks
|
|
|
|
|
Hi sheshidar,
I really do not know if that's possible, but I would start by modifying Xiao Wu Guang's Multi Column ComboBox[^]. Hope this helps!
Best regards,
Mihai Moga
|
|
|
|
|
sheshidar wrote: is it possible to show a single item's text in multiple line in a combo box?
No. What exactly are you trying to accomplish?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My dao database application is not working on customers PC until I install VC++ there.
Application has no problem itself, problem is some functionalities are missing from OS, which may be problems of missing dll files or COM registers - I don't know why.
I posted similar question before and got no right answer, I hope I am luck this time.
How do you install dao database apps?
Thanks
|
|
|
|
|
|
includeh10 wrote: My dao database application is not working on customers PC until I install VC++ there.
Are you trying to deploy a debug build? Your symptom might be related to this. If you are trying to deploy release build and still having problems, make sure the libraries files for any libraries you use are in your installation package (i.e. MFC, STL, ATL, etc...).
In my deployment .msi, I'll usually include the redistributable components for any dependencies. Depending on your version of Visual C++, these redistributables might be in .exe format or .MSM files.
If targeting a specific Windows OS, assume there is no other software installed except the OS and whatever version of IE you require (for IE api specific functions). For example, to support NT 4.0, you would probably want to include the redistributable for MDAC you are targeting and the WMI redistributable (if using any of it's functionality), runtime libraries for Visual C++, library redistributables for MFC, STL, ATL and any additional libraries your app uses like zlib, GDI+, etc...
All too often, you can get false positives that your software will deploy properly if you have Visual Studio or MS Office installed on your test deployment box. You should build a clean OS installation (For each OS you support) and ghost it so you can reimage the machine over and over as you refine your installation packages.
Expect to put a reasonable amount of time into ensuring the installation .msi has everything your app needs. If the Visual Studio Installer cannot give you the option you need, you can use ORCA.EXE (in the Windows Resource Kits and the Windows SDK) to build .msi databases from scratch or apply post compile options to a Visual Studio Installer .msi. It can be a bit tedious and subject to error if you don't document what post compile changes you need to make so document each step so it can be repeated for each new version.
Hope that helps.
|
|
|
|
|
One of our applications and a couple of our installers need to be able to
determine whether or not certain programs are running. They do that using
FindWindow(), as in this article: http://support.microsoft.com/kb/88167.
The problem is, Vista came along and bit us in the butt, because one of the
programs that we need to detect is actually a service, and our detection
routine no longer detects whether or not that is running.
Is there a more reliable way to detect whether or not a program or service
is running that works across session boundaries and doesn't involve a whole
lot of pain. It should not involve .NET or anything else that has to be
installed onto an XP or Win2k system in order for it to work. (This is a
requirement for the installer; we don't want the installer to have any
prerequisites that are not present out of the box on our earliest supported
OS, which is Win2k in the version of our programs that we're currently in the
process of getting into beta. Also, as we are using Visual Studio 6 for the
development of that version, the solution must be compatible with that (i.e.,
using only Win32 API and/or MFC calls).)
Rob Holstein (BSc)
Software Developer
Delta Controls, Inc.
|
|
|
|
|
What about using CreateMutex() to create a named mutex?
A named mutex is system-wide in scope and can be obtained
atomically by any process.
You can use code similar to the following. The same code can be used
to prevent more than one instance of an app and to detect if it's running already...
HANDLE hMutex;
hMutex = ::CreateMutex(NULL, TRUE, _T("Global\\MutexNameUniqueToSomeApplication"));
if (hMutex)
{
DWORD err = ::GetLastError();
if (ERROR_SUCCESS == err)
{
}
else if (ERROR_ALREADY_EXISTS == err)
{
}
}
... (at exit)
if (hMutex)
::CloseHandle(hMutex);
*edit*<br />
Bug fix - thanks Randor!
Mark Salsbery
Microsoft MVP - Visual C++
modified on Saturday, July 19, 2008 1:19 PM
|
|
|
|
|
Excellent suggestion Mark, one minor bugfix:
The original poster implied that the application should be visible across session boundries.
hMutex = ::CreateMutex(NULL, TRUE, _T("Global\\MutexNameUniqueToSomeApplication"));
In order for the mutex to be globally accessible it should be prefixed with a proper namespace.
Further Reading:
Kernel Object Namespaces[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Excellent David, thanks!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In order to determine if specific applications are running during our installs, we simply try renaming it (or the directory that contains it).
For example, if I know the app is located in
C:\Program Files\MyApp\
in our installer, we rename C:\Program Files\MyApp\ to C:\Program Files\~MyApp\
If it succedes, we rename it back and continue (since windows wont let you move/rename/delete something that is currently running).
If it fails, we popup a message saying that the application is currently in use and to exit it and try the install again.
It isn't "pretty" by any means, however, this works in every version of windows available.
|
|
|
|