|
Hi all
I add these code in a standard single document project
<br />
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
...<br />
m_wndStatusBar.SetPaneText(1,"A");
m_wndStatusBar.SetPaneText(2,"B");
}<br />
I can see "B" in the "NUM" status edit, but I can not see "A" in any where.
|
|
|
|
|
See does this[^] helpful?
|
|
|
|
|
I need to develop a download manager with resume support. should i Go for cURL or WinInet API.
Application is Windows based. So platform independence is not an issue. I just want to know which is batter for developing download manger like application in term of
Ease of Use
Features
stability
http://Faq.Programmerworld.net
(FAQ and Tips for programmers)
|
|
|
|
|
See URLDownloadToFile Im not sure it supports resume or no.
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for point to that great post but they are suggest REST command which is specific to FTP protocol. I need something for http.
http://Faq.Programmerworld.net
(FAQ and Tips for programmers)
|
|
|
|
|
Hello everyone,
Why "if classes provide their own new but forget to provide nothrow new too, nothrow new will be hidden and won't even work."
http://www.gotw.ca/publications/mill16.htm
BTW: I understand we should avoid nothrow new, and now I am just interested to know why if only provide normal new, there will be issues?
thanks in advance,
George
|
|
|
|
|
Why don't you read his previous column?
Maxwell Chen
|
|
|
|
|
Thanks Maxwell,
I have read through the article, and I think if we only provide one version of new in current class, compiler will stop in current class searching for the other 2 forms of overloaded new even if current class does not provide it (they are defined in base class or global space).
The issue of providing only one form of new is, when other class uses the other two forms of new, since in current class, it is not implemented, there will be compile error.
My understanding correct?
BTW: from the article, I am not sure why it is a compile time error, it should be more like a runtime error?
regards,
George
|
|
|
|
|
Why don't you ask the author of that article, Mr. Sutter?
I'm sure you are already aware of this, but most of the folks that help on this forum have jobs, and only answer questions when they have time. Asking us to read through other people's articles just to see if you understand them is just plain stupid.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I think you agree with my points.
--------------------
If we only provide one version of new in current class, compiler will stop in current class searching for the other 2 forms of overloaded new even if current class does not provide it (they are defined in base class or global space).
The issue of providing only one form of new is, when other class uses the other two forms of new, since in current class, it is not implemented, there will be compile error.
--------------------
regards,
George
|
|
|
|
|
dear all
the following gbest is a constant array which was calculated previously, but how to make constant which values of whole this array keep fixed, don't change along with for loop below: thanks.
gbest = [9][3][4], but here 9 maybe change between 0-9 in next time.
for ( int ii =0; ii<10; ii++)
{
for (int j = 0; j<3; j++)
{
for (int k = 0; k<4; k++)
{
vn[ii][j][k] = w*v[ii][j][k] + c1*rand()*(pbestArray[ii][j][k]-
x[ii][j][k]) + c2*rand()*(gbest[ii][j][k]-x[ii][j][k]);
v[ii][j][k] = vn[ii][j][k];
xn[ii][j][k] = x[ii][j][k] + v[ii][j][k] + a1*(g-fitness[ii]);
x[ii][j][k] = xn[ii][j][k];
}
}
}
thanks a lot.
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: the following gbest is a constant array which was calculated previously, but how to make constant which values of whole this array keep fixed, don't change along with for loop below: thanks.
gbest = [9][3][4], but here 9 maybe change between 0-9 in next time.
I'm dizzy from reading this? Please explain.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
the following is my code:
for (int i = 0;i<10;i++)
{
minValue = fitness[9];
if (fitness[i] <= minValue )
{
minValue = fitness[bb];
for (int j = 0; j<3; j++)
for (int k = 0; k<4; k++)
gbest[i][j][k]=x[i][j][k];
for (int ii =0; ii<10; ii++)
{
for (int j = 0; j<3; j++)
{
for (int k = 0; k<4; k++)
{
vn[ii][j][k] = w*v[ii][j][k] + c1*rand()*(pbestArray[ii][j][k]-x[ii] [j][k]) + c2*rand()*(gbest[i][j][k]-x[ii][j][k]);
v[ii][j][k] = vn[ii][j][k];
xn[ii][j][k] = x[ii][j][k] + v[ii][j][k] + a1*(g-fitness[ii]);
x[ii][j][k] = xn[ii][j][k];
}
}
}
}
}
}
dear friend
firstly, i need to determine gbest in first 10 loop, and then the following formaula is following second l0 loop apart from gbest, because gbest is constant relave to second loop..but how to make gbest is a constant,,no change according my first loop.....so far, gbest could not get value from s[ii][j][k], i don't know why? could help me? thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
Could you explain more clearly your requirement?
It seems you want to keep constant gbest in the last loop, but you code actually keeps gbest elements constant inside the loop.
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.
[my articles]
|
|
|
|
|
li zhiyuan wrote: firstly, i need to determine gbest in first 10 loop...
What are you needing to determine?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
make counter for how many time you were running the loop. Via checking the counter you decided to change your gbest value.
int looped = 0;
....
if( looped < 10 )
{
gbest....
}
//loop end
looped ++;
Greetings from Germany
|
|
|
|
|
dear all
how to use getchar(), when i used, compiler showed i need to declare first. i use win32 console applicatioin so far. thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
So did you include stdio.h like the documentation shows?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all. Im trying to find out whether a window is active or not. This is what i have so far...
<br />
#include <iostream><br />
#include <windows.h><br />
using namespace std;<br />
<br />
int main(){<br />
Sleep(1000);<br />
if(strcmp("00315434", GetForegroundWindow()) == 0){<br />
cout << "Notepad found! " << endl;<br />
}<br />
return 0;<br />
}<br />
</windows.h></iostream>
But i get an error.
error C2664: 'strcmp' : cannot convert parameter 2 from 'struct HWND__ *(__stdcall *)(void)' to 'const char *'
How do i compare what GetForegroundWindow returns so i can make my app look for a specific window? Thanx in advance!
|
|
|
|
|
dellthinker wrote: But i get an error.
error C2664: 'strcmp' : cannot convert parameter 2 from 'struct HWND__ *(__stdcall *)(void)' to 'const char *'
The GetForegroundWindow() function returns a handle to the foreground window, while the second argument to strcmp() is a null-terminated string (to compare). Of course, you already knew all of this.
dellthinker wrote: How do i compare what GetForegroundWindow returns so i can make my app look for a specific window?
By also employing GetWindowText() . Otherwise, checkout FindWindow() .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ok so now im using GetWindowText() and it seems to capture all window titles. But i need it to look for a specific window, Notepad in this case.
Here is my code:
<br />
#include <iostream><br />
#include <windows.h><br />
using namespace std;<br />
<br />
<br />
int main(void)<br />
{<br />
HWND currenthwnd,hwnd;<br />
char s[1024];<br />
hwnd=NULL;<br />
while (1){<br />
Sleep(1000);<br />
currenthwnd=GetForegroundWindow();<br />
if (currenthwnd!=hwnd){<br />
hwnd=currenthwnd;<br />
GetWindowText(hwnd,s,1024);<br />
printf("%s\n",s);<br />
}<br />
if(strstr(s, "Notepad") == 0){<br />
cout << "Notepad is open! " << endl;<br />
}<br />
else{<br />
cout << "Its not open " << endl;<br />
}<br />
}<br />
return 0;<br />
}<br />
</windows.h></iostream>
Problem is when the program is running it prints Notepad is open when it really isnt. Can someone help me fix this? Thanx in advance!
|
|
|
|
|
dellthinker wrote: Problem is when the program is running it prints Notepad is open when it really isnt.
dellthinker wrote: if(strstr(s, "Notepad") == 0)
Shouldn't that be
if(strstr(s, "Notepad") != 0)
cout << "Notepad is open! " << endl;
}
?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanx Mark, your solution worked.
|
|
|
|
|
hi, dellthinker
The string "Notepad" can be in any other window's title.
strstr(s, "Notepad") == 0 doesn't mean any thing.
Try this one, hope it will be helpful.
HWND hWnd = FindWindow("Notepad", NULL);
if (hWnd)
{
printf("Notepad is open! ");
}
else
{
printf("Its not open");
}
============
Einstein
Seeing is believing.
|
|
|
|