|
while using the timers after the particular time (ie in millisecends specifed in the triggering function ) Timer Function will be triggered.
In the OnInitDialog() function add the following ,
OnInitDialog()
{
CDialog::OnInitDialog();
.........
SetTimer(1000,5000,NULL);
ShowWindow(SW_HIDE);
return TRUE;
}
Implement the WM_TIMER using classWizard and add the following code
OnTimer(...)
{
ShowWindow(SW_SHOW);
KillTimer(1000); // 1000 is the Timer ID given in the SetTimer function
}
Here the OnTimer will be called after 5 seconds.
|
|
|
|
|
Hi Friends,
I want to know how to stretch the Icons like we do for the BItmap by using StretchBlt(...) function in MFC. and I also want to know how to Display the mouse cursor. and stretch the mouse cursor.
Salman
Live and Let live
|
|
|
|
|
For icons you can use ::DrawIconEx()
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
The DrawIcon(Ex) functions can also be used to draw cursors. If you want to stretch/scale them, then I recommend that you create a Memory DC, draw the icon/cursor onto the memdc, get the bitmap from the memdc and use StretchBlt to scale it onto the real DC.
onwards and upwards...
|
|
|
|
|
please have a look at my programm below:
BOOL CMy06aDialog::OnInitDialog()
{
CBrush m_redBrush(RGB(255,0,0));
CBrush m_yellowBrush(RGB(255,255,0));
.........
}
HBRUSH CMy06aDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{ if(nCtlColor==CTLCOLOR_DLG )
{pDC->SetBkColor(RGB(255,0,0));
return m_redBrush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{pDC->SetBkColor(RGB(255,255,0));
return m_yellowBrush;
}
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
but the result is :only the edit control ,their background color is yellw as i expected,but dialog background color is still gray,why?
|
|
|
|
|
Try it this way:
HBRUSH CMy06aDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG )
hbr = m_redBrush;
if(nCtlColor==CTLCOLOR_EDIT)
hbr = m_yellowBrush;
return hbr;
}
Steve
|
|
|
|
|
hi:Steve,thank you,i try first according your advice,but dialog control have no color as i set
|
|
|
|
|
Hi,
Good morning, everyone here
I meet a trbouble, a client quited withour sending message to my server, when checking the connection, I remove the socket from the list and delete the memory, but here the trouble appered, the server quited immediately. I know it is because the delete operation, but i have no idea what should I do?
Any advice is appreciated ,
thank you!
|
|
|
|
|
is your serveur mono-client?
don't understand well where's your probleme...
TOXCCT >>> GEII power
|
|
|
|
|
My server is muti-client.
problem: When a client quits without notifying the server, now server fails to send message to client and fails to delete the socket too.
Thank you!
|
|
|
|
|
do you check errors ?
send() and recv() return -1 if they coould not have sent what they had to...
recv() also return 0 if the other side of the connection has closed the connection.
normally, you might be crash-free...!
TOXCCT >>> GEII power
|
|
|
|
|
I want to put together a small program which will go
to a server can check to see if an update exists and
if so, to go get that update and replace the current
file.
I can do a WebGrab and get txt information, but I
don't know how to get the executable file from the
server and make it replace the current file. By chance,
does a sample project exist somewhere that shows how
to do this online update?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I'm certainly no expert, but it may be simpler to download a DLL, which you can then load dynamically and retrieve the addresses for your components from. Have a look at the documentation for:
FreeLibrary
LoadLibrary
GetProcAddress
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
If I've a CListBox derived class (say CListBoxEx ) that handles its own custom drawing messages, i.e. WM_MEASUREITEM and WM_DRAWITEM , is it possible for me to change the parent window of this window (using SetParent ) without the fear of not receiving the above specified messages? Actually, I need to change the parent window more than once.
I'm using VC++ 6.0 SP5 and MFC
Thanks in advance
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I can only think that it may be possible to attach to a hidden window as a parent and therefore not get these messages. Though I am not 100% sure on this.
Ant.
|
|
|
|
|
How can i design application, can toggle like vc dialog?
|
|
|
|
|
I doubt anyone who reads this will have any idea what you mean. Do you mean a dialog box that has a section that can be shown or hidden ? The trick is just to use ::SetWindowPos to resize the dialog to hide/show the section you want to toggle, and set the text on the button you use to reflect the current state. If that's not what you mean, try to explain a bit better.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Like christian said. i am confused..
Which VC dialog ??
|
|
|
|
|
I was design a typeset software, so i want my user can auto change layout like "vc dialog layout"
|
|
|
|
|
Hello,
Does anyone knows how to interpret Standard Test Data Format(STDF) file using VC++ program?
Thanks,
Mar
Mar Solero Jr.
|
|
|
|
|
Sorry about a non MFC question, but I thought we should have some good C++ Programmers here.
I have a base class and a inherited class.
class base<br />
{<br />
base()<br />
Initialise();<br />
};<br />
class derived : public base<br />
{<br />
derived();<br />
Initialise();<br />
}<br />
base *root;
Within my view class I want to initialise root as either the base or derived class. I do this with the following code.
switch(version)<br />
{<br />
case 0 : root = new base; break;<br />
case 1 : root = new derived; break;<br />
}<br />
root->Initialise();
This howerver always calls base::Initialise instead of the derived even for case 1.
What can I do to call derived::Initialise ?
Of course I could create a pointer to derived and typecast chamber_root, but I dont want to do that. Also I could derive another class from base and use that instead of base.
---
|
|
|
|
|
Coremn wrote:
What can I do to call derived::Initialise
Declare Initialise() as virtual in the base class:
virtual Initialise(); BTW, it's always a good idea to specify a return type for the method, even if it returns nothing. Not specifying it is non-portable and susceptible for misinterpretation by others.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thankyou, that was easy and quick. (quick *slap* to the forehead)
(and yes I do actually have a return type)
---
|
|
|
|
|
Hi,
Just a quick question. I have a bitmap resource in my project and I load it by calling
LoadBitmap but how can I resize it on the fly so that it fits neatly into my window?
I need to do it before I display as I don't have control over the BitBlt display code in the MFC control.
Thanks.
|
|
|
|
|
You need to create a new bitmap that is the right size, then stretchblt your bitmap into it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|