|
This one doesn't work
m_listFiles.ModifyStyle( 0, LBS_EXTENDEDSEL | LBS_MULTIPLESEL );
|
|
|
|
|
Romiks wrote: This one doesn't work
How are you verifying this? After this runs, you should be able to use Spy++ to see the list of styles that particular control has. You should see LBS_EXTENDEDSEL and LBS_MULTIPLESEL in that list. Of course if you want the control to be single-select, I doubt that adding the LBS_MULTIPLESEL style will work.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ok, I did single select ListBox and trying to add styles like this:
m_listFiles.ModifyStyle( 0, LBS_EXTENDEDSEL | LBS_MULTIPLESEL );<br />
m_listFiles.UpdateWindow();
SPY shows me LBS_EXTENDEDSEL and LBS_MULTIPLESEL styles present, but actually the list is single select
|
|
|
|
|
Then you may have found a style that cannot be altered at run-time. There are several.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What about not using ModifyStyle?
I mean get the style, style = style | ~NonDesiredMode and SetStyle (style) another time... can it work?
Greetings.
--------
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?
|
|
|
|
|
Nelek wrote: can it work?
Why not try it and see?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are quite right, thanks
I'll try to find another way.
|
|
|
|
|
Can anybody tell me with VC++ 6.0 which latest version of MFC we use and release
date of MFC 4.0???
ThankXXX
There Is Nothing Right & Wrong
|
|
|
|
|
|
Fish see here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
NOOOOO! Now we have three (you, me and Mark), is that enough to start a club?
Oh frack I guess I should have googled that[^]!
|
|
|
|
|
Hi -
I have a problem that's been bothering me for quite a while. I really hope that someone can help me...
I'm writing my code in visual C++, which seems to have very poor documentation for the datagrid. I've seen some C# code to do this, but it can't really be transferred to C++, it seems.
I have a DataGrid with 2 checkbox columns. I also have a button called "update". The goal is the following:
1) When the user clicks the update button, the application scans through the datagrid and determines which checkboxes are currently checked (for both columns)
2) This information is then used for something else, which is not relavant here.
Thanks in advance.
Kim
|
|
|
|
|
|
please help me i want read some of hardware serial ?
hamed
|
|
|
|
|
Have you considered the Win32_MotherboardDevice and Win32_DiskDrive WMI classes?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
Is there any posibility in MFC/WinAPI to bring a parent dialog window for a modeless dialog on top of the modeless dialog ?
I've tried BringWindowToTop and SetWindowPos but the results are limited on activating the parent dialog only and not bringing it on top of the modeless one.
(I want to know if it is possible or not exactly the way that I specified. I know that it is possible if on the Create call for the modeless dialog I specify another window as parent and not the calling dialog.)
Many thanks in advance for any replies
|
|
|
|
|
to make the nextBuf and workBuf in the following code multi-thread save,
is it correct to replace "static" with "__declspec(thread)" in the code?
or it should be "__declspec(thread) static" ?
THANKS FOR THE HELP!
------
static int nextBuf ;
static char workBuf[8][64] ;
char * GetBuf()
{
nextBuf++ ;
if( nextBuf >= 8 ) nextBuf = 0 ;
return workBuf[nextBuf] ;
}
|
|
|
|
|
chenggong wrote: multi-thread save
I guess you meant "safe"? You did not specify your problem. So deducing your intent from your code it seems you are trying to share the workbuf[] array across threads? If so, you need to synchronize access to the GetBuf() function, not put the array into TLS as _declspec(thread) would do. Not to mention putting the array but not the indexer into TLS would certainly produce undesired behavior.
Also your design is, well less than [whatever]. Have you ever heard of the Singleton Design Pattern? Any Design Patterns?
Are you sure you should be writing multi-threading code?
|
|
|
|
|
The static just says that the variables are local to the module (.cpp file).
That is, they are not going to be directly used (by name) in any other module.
Both will work, but since you have already marked them as static i would keep that.
Also, you should init your global vars, even though in this case it still works without doing so.
Also, since the variables are (should be) only used in the function you may want to put them there.
i.e.
char* gb( void ) {
__declspec(thread) static int i = 0;
__declspec(thread) static char b[8][64];
if( i >= 8 ) i = 0;
return( b[i++] );
}
...cmk
Save the whales - collect the whole set
|
|
|
|
|
|
It seemed to me like this was a rather simple problem, but for some reason, I can't think up a good way to do this.
Say, I have class Base and class Derived : public Base . I also have a function that takes in a Derived pointer Func(Derived* derived) In my code, I have tried the following:
Base* bPtr = new Base();
Derived* dPtr = dynamic_cast<Derived*>(bPtr);
Func(dPtr);
Unfortunately, this is unsafe, which means that dPtr will always be NULL. Is the only way to do this one that involves using a self-implemented copy constructor that takes in Base* and copies all of the individual members? It seems to me that there must be another solution to something like this... (but I may very well be mistaken)
|
|
|
|
|
If you've only constructed a Base object it can't be a derived object.
The only way to have a Derived object is to create a Derived object (or a class derived from Derived).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Tell that to all the MFC developers that do things like:
CEdit *pEdit = (CEdit*)GetDlgItem( IDC_EDIT ); And think it is always a real CEdit object that they have on their hands! :P
Newbies: the above will only return a real <small>CEdit</small> pointer in a particular scenario. You only see it used so much because calling <small>CEdit</small> -specific methods works - they are wrappers for <small>SendMessage</small> and do not use any <small>CEdit</small> -specific data members, so you just happen to get away with it. But that does not make it right, and (IMHO) is a really bad habit to get into.
Peace!
--modified at 11:27 Thursday 16th August, 2007 - Mark's Suggestion
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Ooohh I forgot about that one. Yeah, you need to really know some internals of MFC
to do that
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You should switch the part of your post in small font to BIG font,
especially the "does not make it right...".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|