|
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...
|
|
|
|
|
At last!!!
Thanks a lot!!!
|
|
|
|
|
Is there a way to print a .net bitmap with mfc? Thanks
|
|
|
|
|
I have a dialog app and I'm trying to change the background of most of the controls on the dialog. This is the code I'm using, but it isn't changing the controls backgrounds.
if (nCtlColor == CTLCOLOR_STATIC)
pDC->SetBkColor (RGB (255, 255, 255)) This code is in the OnCtlColor function of my dialog class. When I run the program only static controls colors are changing and not my checkboxes or groupboxes. According to my reading CTLCOLOR_STATIC is the same id passed into the function for statics, groupboxes, checkboxes, and a couple other control types. Am I wrong? If so how do I go about changing the background of those controls.
Thanks.
- monrobot13
|
|
|
|
|
Hi,
First, I'm a beginner and I'm doing a little project in MFC and i'm using VS .NET 2003.
I want to put the current month concatenated with an other word as default save name when I save my document. So I want to be able to pass a CString variable to the IDR_MAINFRAME string.
Example: JanuaryDave.sav
I searched on the internet and found nothing on the subject.
Can someone indicate me an article or an example of what I want to do.
Thanks.
David
|
|
|
|
|
I have seen software where the user clicks Update
and the software goes and checks and then downloads
an update and replaces itself with that update. Does
a demo project exist that does something like this?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
the usual question, my application crashes and I can't really figure out where and what I did since yesterday ... and I'm kinda stumped
the only difference is that I "updated" my computer with the windows updater, maybe I need to reinstall VC service pack ( which I will, it doesn't hurt does it ? ). and build using BoundChecker instrumentation, ( but I scrapped the objects files and libs. and rebuild without instrumentation after !)
anyway, it's crashing/asserting in low level routines when allocating (with new ) and freeing (delete) objects; in DEBUG mode; if I continue (F5) it continues without a itch ...
it's an MFC application using Visual C++ 6 sp5.
( in the output window )
HEAP[app.exe]: HEAP: Free Heap block 1919740 modified at 19199e0 after it was freed
I know it's not much, but I can't reduce the error to some line of code that I post here.
any thoughts ?
Much Thanks ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I'd say whatever is causing this has been there all along and has decided to appear because of the PC updates, but has nothing to do with them. This is often the case with memory corruption problems unfortunately.
The Debug info is telling you that you are modifing memory that has previously been free'd. This will happen if you use a pointer that has been free'd or you have some erant code (pointers) writing into memory where they shouldn't be.
Break into the debugger when the error occures and dump the memory at the spec'd address and see if its contents means anything to you.
Also after freeing a pointer set it to NULL so you will get an exception if it used again. Make sure all pointers are initialized. Try to move away from using new and delete and look at smart pointers and RAII.
Hope that helps.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Neville Franks wrote:
Break into the debugger when the error occures and dump the memory at the spec'd address and see if its contents means anything to you.
will check this ... I never think of looking in the memory dump.
Neville Franks wrote:
Also after freeing a pointer set it to NULL so you will get an exception if it used again. Make sure all pointers are initialized. Try to move away from using new and delete and look at smart pointers and RAII.
yes I do this and I'm also maintaining old C code and I try to go update as much as I can when I can.
and what are RAII ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
and what are RAII ?
"Resource Acquisition Is Initialization". Do a Google search on "C++ RAII" etc.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|