|
Tnx for the quick responce both of ya!
Got it then there is just one more qeustion
So I have to use a worker thread! Because of the LPVOID param right? Can you tell me why it not possible to do that in a UI thread...why is there no LPVOID param i the UI thread? (it dont make no sence to me)
Am I missing something here...
|
|
|
|
|
Got it
Just read something from Alexpro's post
Tnx again everyone
Regards
Frank
|
|
|
|
|
Read this article about worker threads and how you should pass data among them.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi everone,
I was just wondering on how to do this, assume you have a string like this:
string String1 = "MR AND MRS DAVID MACDONALD";
How would you sort this so that it will look like this:
"AND DAVID MACDONALD MR MRS"
Any Idea? please feel free to share it
Thanks/Regards
Sidney
|
|
|
|
|
I'd break up the string, and pass the words into a map as I go, then walk the map ( which is a sorted container ).
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
How about adding them to a vector, and then sorting the vector?
I would be interedted to see which was quicker. I suppose with the map, the sorting would be quicker, as you sort as you add to it, but walking a map is slower then walking a vector. hmmm
I love the STL.
|
|
|
|
|
If all strings are added at once and then sorted, it will probably be faster to uses a vector and sort it at the end.
On the other hand, if you want to add strings afterward a map would be faster since you won't start the sort again for each added items.
In pratice, in most situation a map (or multi-map if duplicate are allowed) would work fine and be easier to code...
Philippe Mori
|
|
|
|
|
Let All the Windows' Title Set by My Presetting String when they Created.
In simple words, I want to make all windows display the same title.
Who can do it?
|
|
|
|
|
Easy. All Windows on the system ? There is a function to enumerate all Windows, I forget the name. Do that, and call SetWindowText on them all in your callback function.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Does that only give you actual windows, or will it provide the HWND derived controls too?
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
From memory it return windows that cannot be seen as well, so some check like ::IsWindowVisible is necessary, but it does not list child controls.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
But By this method ,I have to set a Timer to check whether a new window is created and set its title.
I want to change the title when the windows is created.
|
|
|
|
|
Then I guess you need some sort of system wide hook.
With newbies, the thing is often that they ask HOW do do things, but the people who read the questions wonder WHY. What sort of user hostile UI disaster are you scheming here ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Are all of these windows that you want to change yours?
Basically, call SetWindowText for each window that you want to set the title of.
If you do not have a handle to each and every window then you can start with the main window in your program and call GetWindow to navigate through the chain of windows.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
yes, but how can I know when a window is created and I could set the title at once, or I set a Timer ??
|
|
|
|
|
I am curious as to what you intend to do with such a program. Is it part of an annoyance utilities package?
Just kidding pal
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Nish - Native CPian wrote:
Is it part of an annoyance utilities package
LOL. I think we've just found the next killer app
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
I have a tab control on that i had placed a list controls .
If i select some item in the list control & move some other window over that then close that window.Now my list control will disapper.If i won't select anything in the list control,then it works fine.
Any idea?
Neha
|
|
|
|
|
How can a move this part of the complex.cpp into the header file:
double A,B,C,D;
char letter;
cout << "s Sum\nd Differnce\np Product\nq Quotient" << endl;
cout << "The operation is ";
cin >> letter;
cout << "A is ";
cin >> A;
cout << "B is ";
cin >> B;
cout << "C is ";
cin >> C;
cout << "D is ";
cin >> D;
//complex.cpp
// Complex
#include <iostream.h>
#include "complex.h"
main()
{
double A,B,C,D;
char letter;
cout << "s Sum\nd Differnce\np Product\nq Quotient" << endl;
cout << "The operation is ";
cin >> letter;
cout << "A is ";
cin >> A;
cout << "B is ";
cin >> B;
cout << "C is ";
cin >> C;
cout << "D is ";
cin >> D;
complex com1(A,B);
complex com2(C,D);
switch(letter)
{
case 's':
(com1+com2).print();
break;
case 'd':
(com1-com2).print();
break;
case 'p':
(com1*com2).print();
break;
case 'q':
(com1/com2).print();
break;
}
return 0;
}
// Header File
#ifndef _complex_h
#define _complex_h
class complex
{
public:
complex();
complex(double,double);
complex operator + (complex);
complex operator - (complex);
complex operator * (complex);
complex operator / (complex);
void print();
private:
double r, i;
};
complex::complex()
{
r=0;
i=0;
}
complex::complex(double a, double b)
{
r=a;
i=b;
}
complex complex::operator+(complex value)
{
double a,b,c,d,x,y;
a=r;
b=i;
c=value.r;
d=value.i;
x=a+c;
y=b+d;
complex answer(x,y);
return answer;
}
complex complex::operator-(complex value)
{
double a,b,c,d,x,y;
a=r;
b=i;
c=value.r;
d=value.i;
x=a-c;
y=b-d;
complex answer(x,y);
return answer;
}
complex complex::operator*(complex value)
{
double a,b,c,d,x,y;
a=r;
b=i;
c=value.r;
d=value.i;
x=a*c-b*d;
y=a*d+b*c;
complex answer(x,y);
return answer;
}
complex complex::operator/(complex value)
{
double a,b,c,d,x,y;
a=r;
b=i;
c=value.r;
d=value.i;
x=((a*c)+(b*d))/((c*c)+(d*d));
y=((b*d)-(a*d))/((c*c)+(d*d));
complex answer(x,y);
return answer;
}
void complex::print()
{
cout << r;
if (i>=0)
cout << "+";
cout << i << "i" << endl;
}
#endif
|
|
|
|
|
|
Anybody know a way to programmatically change the IE Connection Options? Is there an API or a specific registry key?
I need to change it from "Never dial a connection" to "Dial when a network connection is not present".
Like it or not, I'm right.
|
|
|
|
|
Look at the changes at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. When setting the value from "Never dial a connection" to "Dial when a network connection is not present" the value EnableAutodial changes from 0 to 1.
Easy util for monitoring registry changes: http://www.sysinternals.com/ntw2k/source/regmon.shtml.
Succes!
|
|
|
|
|
Thank you very much!
Like it or not, I'm right.
|
|
|
|
|
Hi everyone,
I have a question, I am curious about the greatness of Cstring, can I used this in non MFC projects? I was trying to use it like this:
#include <Cstring>
#include <iostream>
int main(){
String str("The stars are aligned");
int n = str.Find('e', 5);
cout << n;
}
Code above contains an error "error C2065: 'CString' : undeclared identifier"
Did i miss something? or CString does not work with non MFC projects?
Thanks/Regards
Sidney
|
|
|
|
|
CString will not work in non-MFC projects, it derives from CObject.
If you are going to use STL you may want to consider the basic_string<T> template class.
Or WTL contains a version of CString in the atl_misc.h file.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|