|
You didn't say what your solution was?
I was going to guess you had accidentally switched Release and Debugging mode switches - I got surprised by that one time (was exporting the debugging version over the release one)
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
Is any body know how to retrieve all process, like task manager, without enumerate windows on system.
Thank you.
|
|
|
|
|
If you're on NT/2K, you can use EnumProcesses in the PSAPI.
On Win9x/2K, but not NT4, you can use the ToolHelp API, see Process32First/Process32Next.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I have a workspace consisting of five projects. Let's call them Project A through E. The structure I'm aiming for is the following:
A
/ \
B C
/ \
D E
I've updated the dependencies so that A is dependent of B and C, and C is dependent of D and E.
Project A is a regular application while B through E are static libraries providing functionality to the application.
My problem is that I have a couple of classes with identical names in the different projects. The classes aren't identical but play a similiar role in the different projects. When compiling I get warnings about the classes already being defined and that the second definition is ignored.
Since I'm still relatively new to VC++ I'm not sure if my approach is the right one. Maybe I should try another structure, but this is the one that feels most intuitive because of the way my projects are related.
Maybe I'm just not including my libraries correctly? Or is the problem that I have conflicting class names? Should I rename the classes within the projects, or is it possible to just add some sort of namespaces?
I would much appreciate some pointers to what I might be doing wrong. Examples of project settings and such.
Thanks in advance!
|
|
|
|
|
I'm a big fan of using namespace. I have a number of libraries that I have similiar named classes and I use namespace a lot. It helps too when I use a third party library which has a class named the same as one of mine.
Michael
|
|
|
|
|
Namespaces will most likely solve my problem so I'll give them a try. Unfortunately I'm not very familiar with them, but I'll go namespace hunting in the MSDN.
Thanks for your time!
|
|
|
|
|
quiet simple
in your class .h
namespace yournamespacename
{
class CMyClass
{
};
}
To use it, yournamespacename::CMyClass myclass;
Michael
|
|
|
|
|
Ok, but does this mean that I'll have to specify the namespace for each and every class in a library, or is there a way to specify a namespace for the whole library at once?
|
|
|
|
|
See the keyword: using namespace ...
You can see an example when you create a new "Win32 console application" project that supports MFC, right before _tmain().
I'm not an expert of namespaces, though, just know what to look for
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Yes I found the keyword and it will probably come in handy when I want to use my libraries.
But what I would like to avoid is to declare the same namespace several times, once for each class, in my library and instead declare a namespace for the whole library at once. I have no idea if this is possible though?
|
|
|
|
|
Have you tried to do:
namespace yournamespacename
{
#include "mylibrary.h"
}
I read somwhere that you can do something like that, but never tried.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Using this method I lost the warnings about classes already being defined. But I still get errors when compiling. This is how my code looks like now:
namespace LibA {
#include "LibraryA.h"
}
namespace LibB {
#include "LibraryB.h"
}
.
.
.
LibA::MyClass myClassInLibraryA;
LibB::MyClass myClassInLibraryB
When compiling this code I get several LNK2001 errors. So it seems the compiler can't resolve the namespace after all. It makes no difference if I try "using namespace LibA" instead.
Am I doing something wrong when trying to access my libraries?
Maybe I have to modify my code, so that I specify the namespace for every class, after all.
|
|
|
|
|
Some experimenting seems to reveal that my problem is happening because I try to use two libraries (with name collisions) from another library. I created a new project where my two libraries are used by a regular application, and that seems to work.
I guess I'll do some redesigning so that I don't need multiple library levels in my program.
Thanks for all your help!
|
|
|
|
|
Hi all,
I have a strange problem, I have inserted a lot of row in a sheet excel using sql statement "INSERT INTO tabname (A,B) VALUES ('xxx','yyy')" and all is ok.
then I open the excel file and copy and paste some row, from this moment the INSERT statement don't work! It send me a message: "impossibile espandere l'intervallo denominato" in italian, in english I think "impossible expand named interval"...
Anyone know why?
I'm sorry for my english...
|
|
|
|
|
Is it just my feeling, or it is impossible to catch and handle double-click on MFC CMonthCalCtrl control?
I have a modal dialog which contains only this control, and I would like to close it when user double-clicks on calendar.
I've tried handling mouse messages from both dialog class and CMonthCalCtrl-derived class, but apparently control takes the capture and WM_LBUTTONDBLCLK is never generated (which is also true for NM_DBLCLK notification messages).
Thanks
|
|
|
|
|
If that is the case, try SetCapture in the parent window.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Setting capture brings many problems, starting with how to maintain it. Parent window is a modal dialog; setting capture makes it unusable.
|
|
|
|
|
Not at all, it DOES mean you need to pass the messages on to your child windows. It's not pretty, but if the window doesn't inform you of click messages to itself, then it may be the only solution.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Hello, the codegurus around the world.;)
We can use PreTranslateMessage to capture WM_LBUTTONDBLCLK == message
and use GetFocus func to get which control is now get the input focus.
But, WM_LBUTTONDBLCLK may be a little ambigours since
one clicking the mouse is sometimes generated if we try to click the mouse twice?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
One less inelegant way to do it (compared to a nightmare of maintaining the capture) would be to handle MCN_SELECT notification in dialog class, and to check the time elapsed between subsequent notifications on the same date.
If a dialog receives two MCN_SELECT notifications selecting the same date within an time interval less than GetDoubleClickTime() milliseconds, it can be considered as a double click and dialog can be closed.
|
|
|
|
|
Hi,
No flames please, any idea how I can get a menu in a CMDIChildWnd frame? (Must be done for a customer.)
Thanks,
Old Simon HB9DRV
|
|
|
|
|
Hi,
I have an nested hierarchy of c++ objects that I am managing with stl containers. Consequently I have implmented the proper copy contructors and operators overrides that I need to add, delete, compare objects etc.
My question is, if I have classes that derive from a base class, how should I manage this in the copy constructor for the derived class?
I have implmented the copy constructor for the base class. Do I need to do any extra work in the derived class's copy contructor, other than copying the data members of the derived class?
I know that this is not strictly VC++, but any help appreicated.
Matthew
|
|
|
|
|
You have to explicitly call the base copy c'tor in the initialization list after the colon - but you already know that, don't you?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
I wish to programmatically determine the monitor frequency (in Hz), the video card name and its manufacturer and version. Any one has any clue? Is there anything similar to GetDeviceCaps...? (Where's the GetDeviceCapsEx when you need it!? )
If you're saying WMI, then please show me how to use it cause I stumped big time...
/T
|
|
|
|
|
WMI code is fairly complex and involved. It is too complicated to make up a solution for this problem. There are numerous examples of WMI usage on code project, code guru and in MSDN. I have some code I used to interrogate system performance data, but it is quite different from what you will need.
Here's a start from MSDN:
Use this provider first:
class Win32_VideoSettings : CIM_VideoSetting
{
Win32_VideoController ref Element ;
CIM_VideoControllerResolution ref Setting ;
};
Then interogate for the specific controller:
class Win32_VideoController : CIM_PCVideoController
{
uint16 AcceleratorCapabilities[] ;
string AdapterCompatibility ;
string AdapterDACType ;
uint32 AdapterRAM ;
uint16 Availability ;
string CapabilityDescriptions[] ;
string Caption ;
uint32 ColorTableEntries ;
uint32 ConfigManagerErrorCode ;
boolean ConfigManagerUserConfig ;
string CreationClassName ;
uint32 CurrentBitsPerPixel ;
uint32 CurrentHorizontalResolution ;
uint64 CurrentNumberOfColors ;
uint32 CurrentNumberOfColumns ;
uint32 CurrentNumberOfRows ;
uint32 CurrentRefreshRate ;
uint16 CurrentScanMode ;
uint32 CurrentVerticalResolution ;
string Description ;
string DeviceID ;
uint32 DeviceSpecificPens ;
uint32 DitherType ;
datetime DriverDate ;
string DriverVersion ;
boolean ErrorCleared ;
string ErrorDescription ;
uint32 ICMIntent ;
uint32 ICMMethod ;
string InfFilename ;
string InfSection ;
datetime InstallDate ;
string InstalledDisplayDrivers ;
uint32 LastErrorCode ;
uint32 MaxMemorySupported ;
uint32 MaxNumberControlled ;
uint32 MaxRefreshRate ;
uint32 MinRefreshRate ;
boolean Monochrome ;
string Name ;
uint16 NumberOfColorPlanes ;
uint32 NumberOfVideoPages ;
string PNPDeviceID ;
uint16 PowerManagementCapabilities[] ;
boolean PowerManagementSupported ;
uint16 ProtocolSupported ;
uint32 ReservedSystemPaletteEntries ;
uint32 SpecificationVersion ;
string Status ;
uint16 StatusInfo ;
string SystemCreationClassName ;
string SystemName ;
uint32 SystemPaletteEntries ;
datetime TimeOfLastReset ;
uint16 VideoArchitecture ;
uint16 VideoMemoryType ;
uint16 VideoMode ;
string VideoModeDescription ;
string VideoProcessor ;
};
Hope this helps,
Bill
|
|
|
|