|
Use :
<br />
GetSelectionmark() <br />
SetSelectionMark()
Cheers
"Peace of mind through Technology"
|
|
|
|
|
ive tryed them everything works but it does not highlite the new line
|
|
|
|
|
locoone wrote: how can you make a listboxctrl show what line is selected without clicking on the line? a list of mp3's say i click the first one its hilited but when i click the next button i need it to hilite that one but i cant figure it out i tryed all the commands i could find.
See the following API's
SetItemState(...) in CListCtrl control
SetCurSel(...) in CListBox control
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
for SetitemState this is copied from msdn
nState
New values for the state bits.
nMask
Mask specifying which state bits to change
i dont know what they are asking for i cant find anything on what i should put in themi mean does nState mean CHECKED or WM_CHECKED i have no clue what they want.
|
|
|
|
|
If the fous is not current in the listctrl, set the Focus to listctrl using
SetFocus()
Then call
SetItemState( nItem, LVIS_SELECTED , LVIS_SELECTED );
nave
|
|
|
|
|
well that makes it highlite the next one but the firstone doesnt unhighlite im tired i might just be missing something will check tomorrow
|
|
|
|
|
Set the Single Selection style( LVS_SINGLESEL ) of the List ctlr. If this style is set only one item in the list ctrl will be selected at a time.
nave
|
|
|
|
|
that worked thanks dude
something is wrong somewhere my listctrl var is m_list but when i type m_list. it dont popup that windows with all the things i can do.
-- modified at 4:27 Saturday 17th June, 2006
|
|
|
|
|
hi,
if you know please tell me where i can get gSpan source code, it belongs to Data Mining to find out supgraph.
Thanks so much.
|
|
|
|
|
|
Thanks so much
-- modified at 0:37 Tuesday 20th June, 2006
|
|
|
|
|
Hi.
Do you still have the source code?
Thanks
|
|
|
|
|
Do we have any good effective WIN32 API which can tell whether my application is running on a system with a color v/s monochrome monitor attached.
A sample code snippet will be helpful.
Am using the following sample and apparently its not giving correct results always.
bool bColorMonitor = false;
// Get the display information
DEVMODE devmode;
if (::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode))
{
//If dmDisplayFlags is set to zero then monitor is colored otherwise GrayScaled.
bColorMonitor = !(0x01 & devmode.dmDisplayFlags);
}
else
{
dirTrace.Error(_T("EnumDisplaySettings() failed"));
}
|
|
|
|
|
|
This is not giving what I want. It doesnt tell you whether the monitor attached to your system is a color or a monochrome monitor.
If some one tell me as to why EnumDisplaySettings doesnt work consistently with all types of monitors then that should be fine too.
|
|
|
|
|
If you want to consider a 'gray scale' monitor to be 'color' then you can just check the bits per pixel for the devmode.
If the BBP is 1, then it is monochrome. If it is more than that, then it is 'color' even if the color is shades of gray. You obviously need to do something else to distinguish color from gray scale, but at least this tells you 'basic' monochrome from 'everything else'.
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
Ok, I've got a question about making modular applications. At least that what I call them. Basically, I have a bunch of classes, or rather just headers. Now for the implementations, I want to be able to create multiple implementaions of any class, and not have to recompile the whole program. So basically, say I have a class cWindowMaker. It has a Create_Window(x, y, width, height) function, and maybe some callbacks, but lets say it just has the Create_Window function. Now, I make an implementation that basically creates a window with all the bells and whistles, like the title bar, all the titlebar buttons, resizable, etc. And then I somehoe compile that implementation in a DLL file. Then, I load that DLL dynaically, create an instance of the class and call my Crete_Window function. Now, imagine I make another implementation, that basically makes a window without anything, no border etc. Make another DLL and now I want to use it. Well, obviously I jus have to replace the old DLL and restart my app and voila. The hard part? HOW do I make all that work?? Can't wrap my head around it. Can anybody please help? Im sure this kind of stuff has been done by somebody here before...
Thanks in advance.
rara avis in terris
|
|
|
|
|
A better approach would be to go through polymorphism: create a base class CWindowMaker that does nothing and create a class that inherits from it and implement its functionalities for a specific type of window (let's call it CWindowType1). You can create as many subclasses as you like and each of them implement a specific behavior.
Now, you can choose one or the other by using a pointer to the base class and create it the type you want:
CWindowMaker* pMyWindow = new CWindowType1;
Your pointer is still considered as a pointer to the bass class but in fact implements all the functionalitites defined in your CWindowType1 class. Using this mechanism, you can of course select your window at run-time (for example, ask the user to select the type of window and depending of his choice, create the correct instance, via a switch for example).
I suggest you read maybe some documentation about polymorphism, it could be helpfull.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
well, at least i got *A* reply...I do understand what you mean, get polymorphism quite well(ok, cant say i'm godly with my C++, but im fairly good). I do understand what youre saying. My original question is, however, how would I organize the same thing, but with CWindowType1 being implemented in a separate DLL...
say, CWindowType1 is implemented in WindowClass.dll
also, CWindowType2 is implemented in WindowClass2.dll
now, in my app I *somehow* tell it to load a DLL called "WindCls.dll", and call a function returns me a pointer to the class. The rest is as you say, yes. So, if I rename WindowClass.dll to WndCls.dll, then I get a pointer to a CWindowClass1. If however I rename WindowClass2.dll to WndCls.dll, I'd get a pointer to CWindowClass2. SO thats all fine and dandy, but the problem is how to actually make it so that I get that pointer from a DLL.
Hope that made a tiny bit more sense.
Thanks for the reply.
rara avis in terris
|
|
|
|
|
This can be done quite easily (I think ). Make the base class a pure abstract class (so, an interface: no data and all method are pure virtual functions). So, you just have a header file for your base class.
Create dll1 and dll2 in which you implement CWindowType1 and CWindowType2 respectively. Both of these classes inherits from your interface (so, you have to include this base class in the dll's and in your project, that's why it's better to make it a pure abstract class).
In both dll's, add a public method called GetWindowClass (for example) that returns a pointer to the Base class (but in fact create a pointer to the derived class):
CBaseClass* GetWindowClass()
{
CBaseClass* pNewWindowClass = new CWindowType1;
return pNewWindowClass;
}
This way, you can handle every dll's exactly the same way and yet still implement different functionalities in it. Of course, you need to load your dll explicitely (with LoadLibrary and GetProcAddress) otherwise this cannot work . Are you familiar with that technique ? If not, I suggest you take a look in the MSDN for more information.
So, what you will do at your program startup, is load the specific dll ("WindCls.dll" for example) and get the address of the function GetWindowClass (with GetProcAddress). Call it to get the specific pointer to the "windows system" and you can use it.
You need also to free this pointer later on but this can be done only in the dll. So what you have to do is implement a FreeWindowClass function in the dll that will simply delete the pointer.
And, as a bonus : what you could also do, is write a factory class that will take care of loading several dll's so that you can change the windowing type whenever you want without needing to change the dll's names. But that's just for fun
Hope this helps
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
I love you.....in a non-homosexual way.
Thanks. I kinda got the idea of DLL loading with LoadModule and GetProcAddress while waiting for a reply, but was just wanting something that others would recommend.
Thanks again.
rara avis in terris
|
|
|
|
|
2ASoft wrote: I love you.....in a non-homosexual way.
That was really funny.
Glad it helped.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi,
I have a class that wraps a COM object and has only 1 member, a pointer to the COM object (interface pointer) and several methods. It could also be any other pointer.
The size of an instance of this class is 4 bytes, there are no virtual methods or other members.
class CIntPtr<br />
{<br />
public:<br />
void AddOne () { (*m_pMyInt)++; }<br />
int *m_pMyInt;<br />
};
Is it now safe to cast an int* to an CIntPtr*?
int myInt = 0;<br />
int *myIntPtr = &myInt;<br />
<br />
CIntPtr *myIntWrapper = (CIntPtr *) &myIntPtr;<br />
myIntWrapper->AddOne ();
The code runs fine and I don't see any problem with this. Actually I would even say it is better than creating a new object and calling the constructor which makes a copy of the pointer. There is also no additional object that needs to be deleted.
But maybe this causes problems I'm not aware of.
|
|
|
|
|
I'm new to C++ (just a question), how can you use *m_pMyInt before you intialize it?
class CIntPtr<br />
{<br />
public:<br />
void AddOne () { (*m_pMyInt)++; } <-------use<br />
int *m_pMyInt; <-------intialize<br />
};
Just wondering.... or am I just stupid?
"C++ will solve any problem."
|
|
|
|
|
#hackC++ wrote: how can you use *m_pMyInt before you intialize it?
Have a look at the other code, I'm 'faking' an object.
Or do you mean declare instead of initialize? It's common practice to have the members at the bottom of the class and the methods at the top.
|
|
|
|