|
When you use the window in the worker thread,
they will not execute since windows depend on the
message loop to dispatch mesgs.
And obviously your worker thread does not have a mesg loop.
So the next best solution is to have a function in the
view and have the worker thread post a mesg which will
be handled and acted upon by the main ui thread with
the PostThreadMessage.
Use a user defined message which will map to the said fn.
|
|
|
|
|
Hey folks..
I have a dialog based application who's background is a DARK_CYAN color. I have two TabControls on this dialog, each of which need to have a different background brush.
When I call:
SetClassLong ( hwndFirstTab, GCL_HBRBACKGROUND, (LONG) hDarkCyanBrush );
It sets the background of both tab-controls to be DarkCyan, and understandably so, "class" = controls of type in Win32.
Anyone have any tips that would give me what I want, without getting my hands into CustomDrawing?
I've looked at SetWindowLong() for an option to change the background brush, but no luck.
Thanks!
Mike
doner@obtain.com
|
|
|
|
|
Mike Doner wrote:
Anyone have any tips that would give me what I want, without getting my hands into CustomDrawing?
Sorry, but i think drawing it yourself is going to be the way you have to go. Shouldn't be too hard i think, handling WM_ERASEBKGND should do it.
If you need something fancier, there are two nice articles on owner drawn tabs here on CP.
---Shog5---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
I've converted my source code to work with the new Standard C++ library headers. i.e. iostream, fstream, etc. But, I can't seem to open files in binary mode for read/write cuz my data is all screwed up. The documentation says setmode() no longer can be used for the new iostream library.
I'm using...
open(fileSpecPassed, ios::in | ios::out | ios::binary);
Does the iostream library not work with files in a binary mode?
|
|
|
|
|
Well, the new iostream s library supports the binary mode. I've done it in the past, so your problem is hopefully solvable Could you post a little code showing how you use the library?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I keep running into the same ol' crap again. I'm converting some code that works in Borland C++ 5.01 to VC++ 6.0. Anyways, code that worked in Borland obviously doesn't in MSVC. You were right, it does work in binary. It turns out that the sizeof operator does not work the same between versions so I was off in reading contents of objects.
Previous programmer had statements like:
stream.Read(&site.peArray, sizeof(site.peArray));
where peArray was defined as:
#define MAX_PE_PER_SITE 4
TPerEcho peArray[MAX_PE_PER_SITE];
The object is 6 bytes long, a float + a short but it kept coming up with 8 bytes from the sizeof() operator (actually 32 instead of 24).
|
|
|
|
|
sizeof always works the same, it's the way the compiler packs structures in memory that changes. see "pragma pack".
-c
The ants are my friends. They're blowing in the wind.
|
|
|
|
|
Like Chris suggested, use pragma directive.
Never give-up on code, it will come back to hunt you some day.
Well not always if it ain't broke, but just never know...
Good luck!
"One good thing about getting older, you don't loose the ages you've been!"
|
|
|
|
|
BTW, how did you put it in binary mode? The way I did doesn't seem to work since when I did a Quickview on the parameters passed, it equaled 0x23 instead of 0x83 where 0x80 equals ios::binary and ios::in = 0x01, and ios::out = 0x02. The 0x20 value in the first set came from ios::nocreate which when added up equals 0x23.
I gave up and went to the old library but would like to know if it works in the Standard C++ iostream library.
|
|
|
|
|
In a HTML Dialog box pressing F5 refreshes the page. How do I disable it?
|
|
|
|
|
Hi,
I think that sinking the event 'OnBeforeNavigate2' and returning
a value of false for the 'Cancel' param should stop it.
[I am speaking in reference to the MFC wrapper class, but u should
be able to map to what ever programming u r using]
|
|
|
|
|
I have a class handling a dialog that stores user input using DoDataExchange(pDX). The user's data is to be accessible to a few other classes. I know I have to instantiate the dialog class to bring the object w/ its data into existence. If, however, I do that, I'll end up with the constructor's data (as oppose to user-defined data). How may I make dialog data accessible to the entire program? Thx.
ralf.riedel@usm.edu
|
|
|
|
|
Ok,
the design that the data is common to many classes and
still only resides in the dialog class ...???
Well I think that u can see whats' wrong here ..??
The design is wrong, IF you want the data to be accessible to all
classes you should put the data as a seperate entity and then
you should use that to instantiate the data(or simply a pointer to the
data in the dialog will be enough)
Although there may(will) be technical work arounds to this prob,
I think that a change in design will eliminate any other problems
you might encounter in future.
|
|
|
|
|
I suppose one way is to make the input variables static (and public) members of your dialog class. This will allow you to access them from other places using the CMyDialog::m_myStaticMember notation. However, I recommend you spend some time to think about where these variables really belong and how they will be accessed.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Hi, my name is Rui, i'm using VC++ 6.0 with WXP!
I ahve a form with lots of objects, and i need to acess each object0s member variable in a dinamic way. In VB it was quite easy to create an array in order to control a number of objects, but in VC++, i don't know how to do that!
Can you help me?
Thank you for your time!
|
|
|
|
|
You'll have to do it manually. Class Wizard won't help you there
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
You cannot do this using the class wizard.
But what you can do is something like this.
Assume that you have 10 edit boxes and you would like to
access them thru a string, then
declare in the header like this
CStringArray m_strEdit[10] ;
Now in the Dialog's DoDataExchange, you could write code like this,
DDX_Text(pDX, IDC_EDIT1, m_strEdit[0]);
DDX_Text(pDX, IDC_EDIT2, m_strEdit[1]);
DDX_Text(pDX, IDC_EDIT3, m_strEdit[2]);
..
..
Just a bit copy & paste and your r ready, by the way there
are many things in VC++ that u cannot do in VB(comparitively more more..)
|
|
|
|
|
Thank you, Prem, for your quick and easy-to-understand answer.
Even so, i get an error by using a CStringArray as the 3º parameter of the DDX_TEXT, the complete error sentence is :
- none of the 12 overloads can convert parameter 3 from type 'class CStringArray' -
What do you think i am possibily doing wrong?
|
|
|
|
|
I found the problem..
Thank you once more...
|
|
|
|
|
Hi, I can't seem to find help on the above in MSDN. I have added two radio buttons to my dialog. I have inserted them into a Group box.
Firstly, I'm not sure how to make another group of radio buttons that work separately from the first. In other words the two groups must not be mutually exclusive. Only the buttons in that group.
Secondly, I tried to use the class wizard to create member variables for the radio buttons. The class wizard does not give that option. It only allows me to handle events for each radio button. How do I make a radio button enabled or disabled. How do I check what radio option has been selected.
Thanks.
Rui
|
|
|
|
|
Groups of radio buttons are not defined by enclosing them in group boxes. Instead, check for the tab order of the radios. The n-th group consists of the n-th radio having the "tab stop" property, up to the (n+1)-th. I hope I made myself clear enough, my English is a bit sluggish today.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm not sure I understand having the tab stop property. Do you mean it must be set.
So if I add two radio buttons and make their order 1 and 2. Do I set radio 2's tab stop property.
Then if I add radio button 3 and 4. And make their tab order 3 and 4. Do I again set 4's tab stop property.
Does this make the 2 pairs of radios work independently, i.e. if I click 2 it deselects 1. But if I click 3 it will not deselect 2.
Thanks
Rui
|
|
|
|
|
It is sort of like you say, but the "tab stop" property marks the beginning of the group (if my memory serves me well.) Just try it out and get the hang of it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
As for the second question, the following determines whether a given radio (or check) button with identifier ID_WHATEVER is checked:
bool checked=(static_cast<CButton*>(GetDlgItem(ID_WHATEVER))->GetState()&0x003)==BST_CHECKED;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Do you mean to say that there is no easier way than this. Is there no way to assign a variable to the actual control, like all the other controls.
I need to manipulate other properties of this control?
Ruca
|
|
|
|