|
Hi all..
How do i insert a slider control in the mainframe of an mfc application.
Bye
|
|
|
|
|
Put something like:
m_wndSlider.Create(TBS_HORZ | WS_VISIBLE, CRect(5, 100, 500, 150), this, 1234); in the OnCreate() method, where m_wndSlider is a CSliderCtrl object.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
How do i change the background color of the dialog and all the dialog items to different color as easyly as possible (programatically).
thank you,
Toughest Steel Comes From Hottest Furnance
|
|
|
|
|
SetSysColors() is the easiest way (but it will change the colors of all the dialogs on your system).
Otherwise, override CDialog::OnPaint() to paint the dialog background, and handle WM_CTLCOLOR for all the child controls.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanx i will go with the latter.
Toughest Steel Comes From Hottest Furnance
|
|
|
|
|
You'll need to override the OnCtlColor() virtual function of the dialog class and handle the returned brush color.
You can then change the background color of the dialog, edit controls, static text, except the Button controls.
Search for Q117778 on the MSDN website for further examples.
I Dream of Absolute Zero
|
|
|
|
|
I'm trying to pass my local variables of one function to another fuction, all within the main. I get errors saying that the variables score1-score5 are undeclared. Here is what I'm trying to do so far:
#include <iostream>
using namespace std;
void getvalues();
void findlowest();
void calcaverage();
int main()
{
getvalues();
return 0;
}
void getvalues()
{
static int score1, score2, score3, score4, score5=0;
cout << "What is score 1? ";
cin >> score1;
cout << "What is score 2? ";
cin >> score2;
cout << "What is score 3? ";
cin >> score3;
cout << "What is score 4? ";
cin >> score4;
cout << "What is score 5? ";
cin >> score5;
findlowest();
}
void findlowest()
{
if (score1 < score2 && score1 < score3 && score1 < score4 && score1 < score5)
{
return score1;
}
if (score2 < score1 && score2 < score3 && score2 < score4 && score2 < score5)
{
return score2;
}
if (score3 < score1 && score3 < score2 && score3 < score4 && score3 < score5)
{
return score3;
}
if (score4 < score1 && score4 < score2 && score4 < score3 && score4 < score5)
{
return score4;
}
if (score5 < score1 && score5 < score2 && score5 < score3 && score5 < score4)
{
return score5;
}
}
|
|
|
|
|
Hi!
first, you dont pass the local variables declared in main() to the findlowest() function.
you have to declare it like this
int findlowest(int score1,int score2 ... int score5);
and I think, the minimum search can be done better:
if(score2 < score1)
score1=score2;
if(score3 < score1)
score1=score3;
if(score4 < score1)
score1=score4;
if(score5 < score1)
score1=score5;
return score1;
|
|
|
|
|
Please check your grammar book.
Give your fun some parameters to need!
Hello World!
|
|
|
|
|
Isn't this some joke ?
Ok, first of all you shold study something about arrays and loops.
Like
int score[5];
...
min = GetMin(score,sizeof(score)/sizeof(score[0]));
....
int GetMin(int *score,int count)
{
int i,min = score[0];
for (i=1; i<count; i++)
if (min>score[i])
min = score[i];
return min;
}
rrrado
|
|
|
|
|
Dear all,
I want to copy a directory to other location by myself, is there any fast way to copy folder and all of its child contents?
I just think the stupid way is create main folder, and then copy its child folder and contents every time...
I hope there is a good way for doing that~, anyone can give me some ideas??
Thank you~`
|
|
|
|
|
SHFileOperation() should do the trick.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Is it possible to access a SQL Server database from a CHTMLView the same way you would in an asp script using IIS?
Thanks,
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
Hi,
We have an activex control thats viewed by our customers
through IE. The activex control communicates back to our
servers for its operation. Some of our customers are
behind ISA servers. To make it easy on our customers, we
would like to be able to seamlessly connect even if there
is a ISA server in between. Can someone give me some
pointers to get started on this - URLS/books/code samples -
any thing to get started.
TIA,
|
|
|
|
|
I'd like to know how to append a file with a string. For example, I have a CStdio file or CArchive file. How to add a string at the end? I tried the following code:
StdioFile file(fileName, CFile::modeCreate|CFile::modeReadWrite);
file.SeekToEnd();
file.WriteString("New String");
file.Flush();
but it will wipe the old content away. The only way I can think of is to store the content first and then write stored strings and new string in. But that is too stupid. Is there anything easy to solve this problem.
Thanks a lot in advance.
|
|
|
|
|
The reason for the failure is not in the way you write to the file; it is in the way you open it. The CFile::modeCreate flag instructs the constructor to create a new file. If there is an existing file with the same name, it is truncated to zero length, thus wiping it clean.
In order to accomplish the desired result, you must open the file with a combination (OR) of flags CFile::modeCreate and CFile::modeNoTruncate . This combination will, if the file exists, open the file normally, and if it doesn't, it will create a new file. Removing both flags causes the function to fail if the file doesn't exist.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
|
Thank you very much. Best wishes.
|
|
|
|
|
Hello.
I have problems with my homework...i'm a newbie in programming. I did some easy progs by my self, but i'm stucked with this one, if anyone had done similary program please help me.
The computer have N-CPUs. On this computer is executing M jobs at the same time. Every job have it's own execution time. Write a program, which find the optimal arrange M-jobs on N-CPUs. Optimal is, when the time of executing all jobs is smallest.
I must write this with a recursion...but I almost gave up.
I was looking about permutations...but here isn't really same story...cause of N CPU-s.
I don't need whole program or anything, if anyone just know some advices, pleas help me.
tnx.
my english sux...
|
|
|
|
|
Let us approach the problem from a completely abstract level..
Firstly, your problem description does not specify the environment of the CPUs. If they are capable of multithreading, there should be some reference value of how many jobs one processor can simultaneously execute. But, as none is given (?), we will assume that each processor handles a single job first before accepting a new one.
This assumption will quickly lead us into mathematical equations: considering that the execution time of a random job is X seconds and is independent of the selected processor (equal speeds), then the equation would form up to something like "time = (M/N)*X".
As for the actual programming problem, recursion is a very effective way in solving equations that have an exponential form, such as 2^4. It would be a recursive function that multiplies 2 by 2 and gets executed 3 times. Your job here would then be to find the minimum of variable 'time' from the above equation. Needless to say, probably, that if X is equal on each job, the optimized result is when M = N.
Unfortunately I have no prepared example code for this purpose. The best way is to dig up some pen and paper, then attempt to create an exponential expression for 'time'. This expression can then be easily formatted into a recursive function.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I need to figure out a way to drop objects, text, images (of buttons, checkboxes, listbox's, etc) on a control/form and be able to click on them at a later point and move them around. A great example of this dialog editor in Visual Studio, in the resources tab where I can drop text, controls, etc...
Thanks
Ralph Krausse
|
|
|
|
|
I'm trying to make an Owner-Draw Button Class in pure Win32 SDK (without any MFC Class), but I can get a WM_DRAWITEM message.
I changed the default WNDPROC for the control, so it can deal with his own messages, like WM_MOUSEMOVE, WM_MOUSEHOVER and WM_MOUSLEAVE, using:
m_OldWndProc = (WNDPROC)SetWindowLong(m_hWnd, GWL_WNDPROC, (LONG)BottonProc)
Nether, the window and the control receive the WM_DRAWITEM.
I’m not using a dialog template or resource. I’m drawing the dialog with code.
I don’t know what’s happened, what to do, or when to draw the button.
If anybody knows how to do it, please let me know.
Thanks.
|
|
|
|
|
Have you set the owner draw style bit when you created the control?
onwards and upwards...
|
|
|
|
|
Yes!
I create the button this way:
hButton = CreateWindow("BUTTON", "X", BS_OWNERDRAW, x, y, 30, 30, hWnd, NULL,(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL)
|
|
|
|
|
Dont forget the WS_CHILD and WS_VISIBLE styes to make sure the window is shown correctly
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|