|
Not creating another instance, but rather creating a child dialog [of which I am clueless]. I prefer dto do a modeless version, but want to see Modal code as well.
And thanks for the tip on "at the point of when you are through with it", but what I meant was where does the code GO? Probably CSomeClassName::OnDestroy(); but could you "dumb it down" for me? does code to destroy a child dialog go in the .cpp file for that dialog, or the .cpp file for the main dialog [parent that calls it]?
"Not in a child dialog" means :
that any code I write, [which is correct], will execute properly when used in the main dialog and by clicking the appropriate button on the main dialog. The exact same code will not work for a button on any of the child dialogs, except for the default AboutBox that MSVC6 included in the project. My guess is that I am not construction method[s] are wrong for the child dialogs that I made.
Thanks for the help .... message me on Y! at digitalmythogy
-digitalmythology -dm
|
|
|
|
|
digitalmythology wrote: Not creating another instance...
But you are in a CInvenStoryDlg method when you create another instance of CInvenStoryDlg . Is that your intention?
digitalmythology wrote: ...what I meant was where does the code GO?
You call DestroyWindow() whenever you are done with the modeless dialog. It's up to you to determine where that is.
digitalmythology wrote: My guess is that I am not construction method[s] are wrong for the child dialogs that I made.
I suspect this is true. Notice how the About box has its own CDialog -derived class.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there a simple way to change the BG color (and maybe text color also) of an editbox? I only need two colors to be toggled by clicking a button. I wanted to toggle the color of the button, but found out that it can only be done using images as buttons, which seemed too complicated for me.
|
|
|
|
|
Not really. An edit box is really nasty, as it paints itself outside the normal WM_PAINT method, so any owner drawing tends to get erased as you type. It can be done, but not without flicker, and not as trivially as, say, a button. To change the color of a button, you can derive a class from the button class, and draw the background yourself. No bitmap needed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
"To change the color of a button, you can derive a class from the button class, and draw the background yourself. No bitmap needed."
Can you explain furthur please?
|
|
|
|
|
acerunner316 wrote: Is there a simple way to change the BG color (and maybe text color also) of an editbox?
Check out the WM_CTLCOLOREDIT message.
|
|
|
|
|
This doesn't work when you've also changed the background color of the dialog box itself.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: This doesn't work when you've also changed the background color of the dialog box itself.
ummm. no Maybe you are thinking of WM_ERASEBKND?
Try it.
I posted an MFC example below.
|
|
|
|
|
Here's a Christmas edit box (adjust colors for your region/season/religion/etc):
(This is MFC code but API calls are similar)
CBrush RedBrush;
...
RedBrush.CreateSolidBrush(RGB(0xFF,0x00,0x00));
...
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor == CTLCOLOR_EDIT)
{
pDC->SetTextColor(RGB(0x00,0xFF,0x00));
pDC->SetBkColor(RGB(0xFF,0x00,0x00));
hbr = RedBrush;
}
return hbr;
}
-- modified at 11:25 Tuesday 5th December, 2006
|
|
|
|
|
Mark Salsbery wrote:
Christmas edit box
he he he
<div class='ForumSig'>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you </div>
|
|
|
|
|
No no no...
That's "Ho Ho Ho"
|
|
|
|
|
No way
" Nothing is easy , u have to work hard "
Vikas Amin
EATON
PUNE
|
|
|
|
|
|
Hi All,
I need to write some application that send some file ( it can be word document or some exe file ) to some other machine that have with him TCP connection.
The TCP connection is not my problem - my problem\question is - how to read the file and send it to other side ? I know that i need to send the file as byte order - but i don't know how to do it.
Thanks for any help.
|
|
|
|
|
just opent the file in binary mode (e.g. fopen("foo.exe", "rb") ), read from (e.g. using fread ) and the send it through the socket.
Where is it the trouble?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
With Windows Sockets there's the TransmitFile() API (NT 3.51+).
You can also open the file, read a chunk of bytes into a buffer, send the buffer.
On the reveiving side create a file, receive a chunk of bytes into a buffer, write the bytes to
the file.
There are no byte order issues.
Mark
|
|
|
|
|
Yanshof wrote:
he TCP connection is not my problem - my problem\question is - how to read the file and send it to other side ? I know that i need to send the file as byte order - but i don't know how to do it.
open file in binary mode and send chunk by chunk.. remember Sliding Window Protocol!
<div class='ForumSig'>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you </div>
|
|
|
|
|
how do i drag(move) dialog that doesn't hav title bar?
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
BlitzPackage wrote: ...and assign the necessary variables for the control, but it absolutely refuses to let me do so. I know there is some simple step that I'm forgetting.
Like using ClassWizard (Ctrl+W)? Of course, you can always do it manually.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Talking to yourself again?
|
|
|
|
|
Mark Salsbery wrote: Talking to yourself again?
No, BlitzPackage apparently deleted his post, thus orphaning mine.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Maybe he gets his answer then delete his question
|
|
|
|
|
Very stealthy.
The masked inquisitor strikes again!
|
|
|
|