|
|
hi all,
i'm developing an application using MFC dialog. I have to position the buttons and other controls depening on the Size of the screen.can anybody tell me how to do that, if possibel with sample code.
My dialog properties is set to MAXIMIZED
||SnAkeBed||
|
|
|
|
|
Do you want to use of WM_SIZE?
|
|
|
|
|
ya .. could you tell me how to use that properly
||SnAkeBed||
|
|
|
|
|
You should have a message handler for WM_SIZE message in your CDialog class. While resizing, the handler will be called with the dialog's width and height value. Deciside where to place your controls with respect to the size.
To position the controls you can use
SetWindowPos(...)
or
MoveWindow(...)
Do your Duty and Don't expect the Result
|
|
|
|
|
|
SnaKeBeD wrote: can anybody tell me how to do that, if possibel with sample code.
See if the Extras section of this article is of any help.
"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
|
|
|
|
|
hai,
i am working in IOCP Socket programming..in this i want to craete multiple thread pools, which means 5 thread pools and each contains 100 threads...
like this...how to create this,,,
If u Knows,reply me...
Mani
Born to win...!
|
|
|
|
|
|
What does it have to do with a thread pool ?
|
|
|
|
|
You mean you want to have 500 threads for your application ? Wow, that's a lot ! You'll probably spend more time switching between the different threads than doing usefull stuff. Why do you need so much threads ?
|
|
|
|
|
hai,
thanx for ur reply,actually the main task is banking transactions..so none of the request should not get failed... thats why my requirement is 500 threads...is there any problem,...? to handle this...
Born to win...!
|
|
|
|
|
Why do you need one thread per request ? You could simply have one thread to queue the requests and one thread (or more) to process them.
|
|
|
|
|
i am having 100 threads in my server IOCP.. and it is listening for incoming connections.ok..
in client side i am using 500 threads, to send connection request to the server..!
why 500 threads i am using is, 500 simultanous user trying to access server at a time....
now only 400 client requests are processed(accepted)...remaining 100 error ocurred...
what to do for this..?
Born to win...!
|
|
|
|
|
D.Mani wrote: what to do for this..?
Try using Overlapped IO. In most cases it has proven to be more scalable than hand built threading schemes. Based on the description you provided it will likely be an improvement.
What bank is this for? I want to make sure an never use it.
|
|
|
|
|
How many processors does your server have?
500 threads is a huge waste of resources on a machine with say, 4 processors.
See Tip #2 here: INFO: Design Issues When Using IOCP in a Winsock Server[^]
You should be able to handle thousands of connections with at most, a couple threads
per CPU.
Regardless, IOCPs don't have multiple thread pools. The thread pool size is
determined by how many threads you have waiting on GetQueuedCompletionStatus().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Can anyone help me regarding adding menu dynamically in MFC project ...
|
|
|
|
|
You must load your menu with LoadMenu and then use of SetMenu.
|
|
|
|
|
Hi,
I m try to develop an editor that can open file from a web folder. For example a microsoft word file is placed on local host. How can i open it in a windows appllication. Please let me know if there is any article or solution about that. It would be so nice of you.
Arslan Ilyas
Pakistan Interactive
|
|
|
|
|
hai..,
in ur local host if u want to run or open any file..U can use ShellExecute API. u wnat like this only ..or...any other method...
Born to win...!
|
|
|
|
|
i gonna check it out. Any ways thanks alot
|
|
|
|
|
I write a program to count the number of objects. But when I compile it, I met with link errors. How can I resolve it?
Head files:
template <class beingcounted="">
class Counted
{
public:
class TooManyObjects{};
static int getObjectNum()
{
return m_ObjectNum;
};
protected:
Counted();
Counted(const Counted& count);
~Counted() { --m_ObjectNum; };
private:
static int m_ObjectNum;
static const size_t m_MaxObjectNum;
void init();
};
int Counted<class beingcounted="">::m_ObjectNum = 0;
const size_t Counted<class beingcounted="">::m_MaxObjectNum = 5;
class Printer: private Counted<printer>
{
public:
static Printer* makePrinter();
static Printer* makePrinter(const Printer& rhs);
~Printer();
void reset();
void performSelfTest();
using Counted<printer>::getObjectNum;
using Counted<printer>::TooManyObjects;
private:
Printer();
Printer(const Printer& rhs);
};
in definition file:
template <class beingcounted=""> Counted<beingcounted>::Counted()
{
init();
}
template <class beingcounted=""> Counted<beingcounted>::Counted(const Counted& count)
{
init();
}
template <class beingcounted=""> Counted<beingcounted>::init()
{
if(m_ObjectNum > m_MaxObjectNum)
{
throw TooManyObjects();
}
++m_ObjectNum;
}
Printer::Printer(){}
Printer::Printer(const Printer &rhs) {}
Printer::~Printer() {}
Printer* Printer::makePrinter()
{
return new Printer();
}
Printer* Printer::makePrinter(const Printer& rhs)
{
return new Printer(rhs);
}
error LNK2001 private static int Counted<class printer="">::m_ObjectNum"XXX" is unresloved
error LNK2019 protected: _thiscall Counted<class printer="">::Counted<class printer="">(void)
"private _thiscall Printer::Printer(void)"
why? Does the static memeber of a class can only be initialized by its base class. How about its derived class?
Many thanks
|
|
|
|
|
error LNK2001 private static int Counted::m_ObjectNum"XXX" is unresloved
In the definition file, you need to declare it also. ( One time in the .h and one time in the .cpp)
I hope it resolves this error
|
|
|
|
|
baerten wrote: One time in the .h
You don't need it.
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.
|
|
|
|