|
where do i have to add that code. i tried adding it to the OnButton1() function. it is not working.
|
|
|
|
|
<br />
HICON my_icon = AfxGetApp()->LoadIcon(MY_ICON );<br />
<br />
m_button1.SetIcon(my_icon, 1 );<br />
OR:
<br />
HICON my_icon = (HICON)LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(MY_RESOURCE),IMAGE_ICON ,16,16,0);<br />
<br />
m_button1.SetIcon(my_icon, 1);<br />
Hope it helped.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
If /* This is for setting big or little, 1=big, 0=little */, then why does SetIcon needs 1 to load a small icon?
Not clear enough?
Oki.
If I generate a Dialog Based MFC App and I delete the call SetIcon(m_hIcon, FALSE) on OnInitDialog, the small version of m_hIcon will be loaded. But if I delete SetIcon(m_hIcon, TRUE), the big version will be loaded and converted to a smaller one.
Why is this?
Is my version corrupted or something??
|
|
|
|
|
What I was wanting to do, for demonstrative purposes only, is give the impression that my program is printing an item, followed by another, and so on.
The program is a dialog box. There is an Edit box that has a title of a chart to print. What I want the program to do is display chart one, generate a delay, then display chart 2, and so on, giving the appearance that the application is printing each chart.
The problem is is when I call UpdateData(FALSE), the dialog does not update immediatly, so of course the following doesn't work.
m_chart = "Chart1";
UpdateData(FALSE)
Sleep(1000);
m_chart = "Chart2";
UpdateData(FALSE)
Sleep(1000);
....
How do I go about doing this?
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
|
That looks like it should work perfectly.
Thanks Michael!
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
Well, there is another way instead of using control variables:
From MSDN:
<br />
CWnd::SetDlgItemText(int nID, LPCTSTR lpszString);<br />
So you would be able to type and run this:
<br />
SetDlgItemText(MY_RESOURCE, "I am alive");<br />
Applying this to your source code would be:
<br />
SetDlgItemText(MY_RESOURCE, "This is my first text");<br />
Sleep(1000);<br />
SetDlgItemText(MY_RESOURCE, "This is my second text");<br />
Sleep(1000);<br />
Hope it helped.
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
Hi there
I have a CFrameWnd with a CTreeCtrl and a CListCtrl ... If a user selects a control it automaticly got the focus (Yes its the truth ) ... but how to determine which control got the focus?
Thanks for reading
|
|
|
|
|
|
You could do something like this:
<br />
CWnd* pWnd = CFrameWnd::GetFocus();<br />
Then you can work with pWnd, when really you are working with the control that has the focus. For testing purposes you can try this:
<br />
CWnd* pWnd = CFrameWnd::GetFocus();<br />
<br />
pWnd->SetWindowText("THIS WORKS MAN !!");<br />
Hope it helped...;)
Written by: Rafael Fernández López.
void life ( bool me, bool her )
{
while ( her )
{
me = true ;
}
else
{
me = false ;
} }
|
|
|
|
|
thank you both for answering and helping
|
|
|
|
|
I'm looking for a way to limit the tcp/ip bandwidth of an application (or set of applications) from another application.
Basically I need to provide the facility to limit the upload and download KBytes/Sec of a set of processes, with the limits set by the application I am writing.
I know this is possible (as there are a number of applications out there that can do this, www.netlimiter.com is one example), however I need to be able to include the functionallity in my own program.
Any suggestions of what approach to take, where to look for ideas etc...?
Thanks...
Blade[DMS]
|
|
|
|
|
If it will help in your search, this technique is often called 'throttling'.
Elaine
The tigress is here
|
|
|
|
|
Thanks... Thats the word I was looking for
So far my search has lead me to "Packet Filtering" with potential solutions here on codeproject[^] for Win XP and 2000.
Not sure if this is the right direction to head yet tho...
Blade[DMS]
|
|
|
|
|
|
I'm currently modifying a program originally written in C, and I'm fairly inexperienced in programming using MFC and Visual C++
I have a class that gets read in from a menu command, which works OK.
How can I access this class from the automatically generated View classses so that I can display it?
Any help and/or comments are welcome
Keck
|
|
|
|
|
If you have the class in your document class use GetDocument() in your view class to get a pointer to the document and access the member variable from there.
John
|
|
|
|
|
Thanks - I realise now exactly what's going on in this case
thank you again
Working as intended
Keck
|
|
|
|
|
Hi, i want to block net access in pc (in a local network)
this pc connect to web althrought Proxy or connection
sharing. Can anyone help me, thank for advance.
|
|
|
|
|
Program the router to do so. For non sophisticated users, set up a firewall on the PC in question.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
I'm curious, is the intent here to keep another student or classmate from accessing the Internet?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thank, for your humour, but i search for this idea to
include it in my software dedicated for CyberCafe .
|
|
|
|
|
I see that when I step into OnHScroll() upon clicking the slider (not even sliding it, just clicking it) why does it step in three times and then finally show the adjusted display after exiting onHScroll?
Thanks,
ns
|
|
|
|
|
I saw that the third time, it steps in with nPos coming in as 0!!! Even though I scrolled right quite a bit, and nPos is NOT 0!. The nSBCode is END_SCROLL. Got around the problem by skipping the third step-in, but in another part of my project where the slider and SetBrightness() function both are in the same class (here they are in two different classes), the third time also, nPos is non-zero and really what it should be.
void CDlgSettings::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
pSld = (CSliderCtrl*)pScrollBar;
if (pSld !=0 && nSBCode != SB_ENDSCROLL)
{
if(*pSld == m_sliderBright)
{
m_pParentWnd->SetBrightness(nPos);
}
m_pParentWnd->DisplayLocal();
}
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
thanks,
ns
|
|
|
|