|
I want to use CListCtrl's SortItem function. MSDN says there needs to be a comparison function which has to be:
The comparison function must be either a static member of a class or a stand alone function that is not a member of any class.
1. How do I make a static function of a class?
2. If it were a standalone function, I'd declare it in the .h file before the class definition (correct?). Would that be sufficient? Or do I have to specify the prototype in the cpp file before I use it?
Appreciate your help,
ns
|
|
|
|
|
in a .h
class MyClass
{
public:
static int MyFunction(whatever);
};
and then in a .cpp, you implement the function. this function cannot access any non-static member variables of the class.
-c
No matter how fast light travels it finds the darkness has always got there first, and is waiting for it.
-- Terry Pratchett,
|
|
|
|
|
Where is this line supposed to be, from MSDN. In which file is it supposed to be? In the cpp file? If so, in the constructor?
<code>float SavingsAccount::currentRate = 0.00154;</code>
currentRate is a static member variable(declared in the .h file).
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Where is this line supposed to be,
In the class's .cpp file (theoretically it could be in any .cpp file but the obvious place is that of the class), outside the constructor. It's just a variable initialization.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I'm trying to automated power point 2002... I have my own activeX, it Power Point 2002, I can activate it just by pressing double click ( then my ActiveX is up and running...).
BUT... in Power Point 2002, I have to go to Slide Show Mode to do that !!!!, is there anyway to activate it in the normal view ?
Thanks, so long
Braulio
|
|
|
|
|
http://www.codeproject.com/com/OLE_Automation.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
Sorry but..
Ms Word and Excel models for automation are not that bad, but things like Power Point, or Outlook, are hell !, just give try to detect when really Power Point has been closed ( yeah you will found a sink, but that sink is just executed right before the message that ask you to cancel or save, so...)...
So long
Braulio
|
|
|
|
|
Hi,all,
About the animal's simulation project, i have another problem to
ask. That is,Whether there is any one who can provide a source code, which can be used for generating a specail terrai manually. Of cause 3D is best, but at first step if a 2D contour map can be displayed, that is enough.
thanks a lot!!!
wang
|
|
|
|
|
|
This is a so very good shameless plug, your product looks very cool indeed !!!
Max.
|
|
|
|
|
Thank you very much, you just made my day.
Chris Richardson
|
|
|
|
|
One might also display that Free Software alternatives exists.
Also, googling for "free terrain generator GPL" might turn up some more interesting code (replace GPL with whatever license you fancy).
|
|
|
|
|
Yes, I could display that free software alternatives exist, but (A) I didn't feel like searching for it, and (B) my link was put inside < shameless plug > tags. Plus, most free software doesn't come with support, a lot of it can't be used for commercial work, etc.
Chris Richardson
|
|
|
|
|
The derived class has a deleteAllItems, so does the parent class (CListCtrl). I want to invoke the base function directly with a control variable of the derived class. Instead of
m_list1.DeleteAllItems() which is the derived class definition,
I want to call the listctrls base function: Is it possible to do that?
Appreciate your help,
ns
|
|
|
|
|
You could Cast into a base-Object:
CListCtrl* pListC = &MyDerivedListCtrl;
pListC->DeleteAllItems();
|
|
|
|
|
Thanks!
Appreciate your help,
ns
|
|
|
|
|
That would not work, if DeleteAllItems() is a virtual function. The syntax for explicitly calling a base member function is:
MyDerivedListControl.CListCtrl::DeleteAllItems();
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
hi all
how can we load a bitmap image in to a button control ,
which can change the background with the color of dialog/button control (changing the schemes through properties>>appearance tag)..
any idea..??
Regards
Renjith
A Programmer Never Dies...
|
|
|
|
|
no answer..??????????????????
A Programmer Never Dies...
|
|
|
|
|
no solution here.........?????????
ALAS...!!!!
Program The Life.
|
|
|
|
|
Hi,
I am almost an expert on system programming, so I hope this GUI related question is easy to one of you:
I have an app that installs an icon in the system tray. If the user clicks on the icon a dialog appears. Now the user may switch to some other app, so the dialog maybe active (has the focus) and in the foreground or somewhere in the background.
If the user now clicks again the tray icon, I want to do the following:
- If the dialog is not active, I want to activate it and bring it to front.
- If the dialog is active, I want to dismiss it.
My problem is to determine inside the tray notification handler if the dialog has been active or not. I already tried the following:
GetForegroundWindow() returns the handle of the system tray window. (Well, this makes sense, it is the active window during the execution of the notification handler...)GetFocus() always returns NULLGetActiveWindow() also returns NULL- Same for
GetLastActivePopup() It seems that if you click on a tray icon, the system calls the notification handler and afterwards silently reactivates the window that was active before. That's the reason why GetForegroundWindow() always returns the system tray window, but the "visibly active window" seems not to loose its focus. However, I need to know which window was active <it>before the icon was clicked.
Any ideas
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Trace the state in the dialog. In its WM_xxxFOCUS you will be notified which window actually receives the focus if it is not the tray some other app is activated.
This still leaves you with the problem when the user clicks on another trayicon first and then on your applications icon. Or clicks on the explorer bar and then on the app icon. Or does it by keyboard.
However, you should find a better design for your dialog solution.
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
Thanks Andreas,
However, you should find a better design for your dialog solution.
I thought a lot about it, but I don't think that a really nice design for this problem even exists. The dialog is deactivated if somebody clicks the icon and there is no chance to examine if it was activated before.
I now found a solution which is similar to what you suggested. I catch WM_ACTIVATE in the dialog and remember the current system time if the dialog is deactivated. In the tray icons handler I check the dialog was deactivated immediately before the handler was executed (less than 200 ms). If this is the case, it was deactivated because of clicking on the icon.
Not the cleanest design, but works fairly well - even on high system load.
Thanks!
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Hi,
I am currently trying to retieve the path to a CDwriter, I have the targetId of the scsi device and require the drive path. I have a solution for NT,2000 which uses the CreateFile function to obtain a handle to the disk device and then use this handle with DeviceIoControl function and a drive path to return a targetID thus correlating TargetIds to drivepaths.
Unfortunately this method does not work on 98 as the CreateFile function will is not supported for retrieving a handle to a disk volume on 98.
Does anybody know of a method to get a handle to the disk device on 98 or a completely different method which would produce a drive path from a targetId or TargetId from DrivePath.
Chris H
|
|
|
|
|
Chrish120 wrote:
Does anybody know of a method to get a handle to the disk device on 98 or a completely different method which would produce a drive path from a targetId or TargetId from DrivePath.
AFAIK you have to do it the ASPI way on Win9x. Sorry.
Btw, you do know you can do it "the other way around" even on NT-based OS'es? Grab the drive-letter and then use QueryDosDevices to find the device. Such code worked like a charm for me in the past for CDRecord (speaking of which, you might want to have a look at it since it already is a working CD recording solution).
++luck;
|
|
|
|