|
When i disconnect my Networkcable from WindowsXP the Trayicon tolds me that "A Network cable is unplugged".
That is a status that i need in a Dialer with "seamless connectivity function". Does anyone know how to get these status? Doesent find anything about it in MSDN.
Only in MprAdminInterfacGetInfo is something, but that is for Serveradministration by remote connection.
best regards bateman
|
|
|
|
|
REQUIREMENT:: Application shud be sized to full monitor irrespective of the monitor size and current system resolution.
My APPLICATION:: Application is having four formviews in tabcontrol with many controls(AcitveX Lables and Buttons) on each forma view. My application is developed for best view in 15 inch and 800*600 resolution.
MY PROBLEM: i have written code to catch when resolution ic changed.and accorind to the new resolution m changing the each contols's client rect and moving the corresponding control to new client react. but reafreshing si becoming problem and some controls are painting over other controls.
AdiNarayana.vemuru
|
|
|
|
|
can any one send me code/url for DES Encrypyion/Decryption.
|
|
|
|
|
|
HI,
In this piece of code, On button click i disable that button and sleep for some time. But even though the button is disabled, if user clicks on it, the number of clicks are buffered and On button CLick code repeatedly processed.
Sample code :
OnButton1()
{
static int count=0;
this->GetDlgItem(IDC_BUTTON1)->EnableWindow(false);
/* Some print messages*/
sleep(1000); /* in reality this could actually some code*/
/* to access the b ack-end data*./
this->GetDlgItem(IDC_BUTTON1)->EnableWindow(true);
count++;
}
if the buttons is continuously clicked , even if after the button gets disabled, say 5 times, then the OnButton1() code gets processed that many number of times [Count becomes 5].
I don't want the Dialog to process the BN_CLICKED messages from the disabled button.
Could any one help me out.
Thanks.
|
|
|
|
|
You have to look at the problme in the point of view of the thread executing the code. In your case its the user interface thread. This means that during the sleep() command you are not processing any message in the message queue. So what happens in the thread is disable,wait, enable, process other messages.
What you need to do is disable the button and wait in a message processing loop for the time required. Then the additional button presses will be ignored.
A typical way to do this would be to do:
MSG msg ;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_REMOVE))
{
::TranslateMessage(&msg) ;
::DispatchMessage(&msg) ;
}
You will need to setup the correct timing of this to last the time required.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hi I solved it this way..
Disable the button.
Spawn a thread.. Within that thread do some processing And once its over enable the button back again..
E.G:
On ButtonClick()
{
GetDlgItem(IDC_Button1)-> EnableWindow(falsE);
AfxBeginThread(runThread,this);
}
static UINT runThread(LPVOID param)
{
((Class *)param) ->runFunc();
return 0;
}
void Class::runFunC()
{
// Do proceddgin or Sleep...
GetDlgItem(IDC_BUTTON1)->EnableWindow(true);
}
So no message Loops needed.
But i still don't understand how a button can generate clicks once it is disabled...
|
|
|
|
|
Hi,
I'm trying to use FtpFindFirstFile to know if a file is on server, and FtpGetFile to retrieve it.
The problem is when I try to download or list something that is not there. It just returns me an "operation was completed sucessfully", no matter what I do.
Is there any way of retrieve the error the FTP throws? Any sample?
tia
sms2k
|
|
|
|
|
Try using FtpOpenFile in conjunction with InternetSetStatusCallback to get more infomation.
|
|
|
|
|
dear all,
i want to pass a CArray object (newTask which is an array of a struct TASKS) in a function.
so how do i define a function which takes
1) CArray object (newTask) as parameter.
2)pointer to CArray object (&newTask)
thanx
rishabhs
|
|
|
|
|
Using std::vector this would be easy:
void wobble (const std::vector<TASKS>& tasks);
and
void wobble (const std::vector<TASKS>* pTasks);
but using MFC CArrays, I have not the slightest clue.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
[edit] first I'd bartered the function declarations .. but now it's ok
rishabhs wrote:
CArray object (newTask) as parameter.
I think passing as an object won't work. Use references instead:
void MyFunc( CArray(int, int)& array) {...}
...
CArray<int, int> myArray;
myArray.Add(1);
myArray.Add(111);
MyFunc(myArray);
rishabhs wrote:
2)pointer to CArray object (&newTask)
Pass it as you'd do with any other object:
void MyFunc( CArray(int, int)* pArray) {...}
...
CArray<int, int> myArray;
myArray.Add(1);
myArray.Add(111);
MyFunc(&myArray);
|
|
|
|
|
thanx Schlaubi,
but i want to pass my own structure (type) instead of int.
so this is the problem!
any ideas!!!
|
|
|
|
|
rishabhs wrote:
but i want to pass my own structure (type) instead of int.
so this is the problem
Well, the only thing you'd have to do is replacing int by TASKS. The rest wouldn't change. I took int for my example because .... I read over your TASKS - struct;)
|
|
|
|
|
You need to decide if the function will have read/write access to the array or just read access to it.
If it's going to have read/write access, you would just pass it by reference or pointer. By reference is easier since you can use the value semantics (dot notation), however I prefer to pass by pointer since it becomes more obvious that the function is going to change the array.
If it's only going to read the array, then the best way is to pass it by const reference. This gives you the benefits of value semantics while ensuring the array won't be changed (at least not without some ugly casting).
I also recommend creating an alias for the CArray< TASKS, TASKS& >, to make it easier to read (and write). You do that with typedef:
typedef CArray< TASKS, TASKS& > TaskArray;
rishabhs wrote:
1) CArray object (newTask) as parameter
void f1(TaskArray& tasks)
{
}
void f2(TaskArray* pTasks)
{
ASSERT(pTasks);
}
void f3(const TaskArray& tasks)
{
}
rishabhs wrote:
2)pointer to CArray object (&newTask)
TaskArray tasks;
f1(tasks);
f2(&tasks);
f3(tasks);
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
thanx, for a great gesture!
regards
|
|
|
|
|
Hai all
Iam working on a telelcom project...while reading from or wroting to a node we use to show a progress control and a "Cancel" button on it.Focus will be set ot this button while the process goes on in order to give the user to cancel the process at any time.but my button is not working(not responding) for the mouse click and is working fine if we press the space bar.can anybody solve my problem??
ThomasKennedyBose
|
|
|
|
|
Could you give some more information?
Is this a dialog box you are talking about, in which case did you create it using MFC, Class Wizard etc. and using the default id IDCANCEL for it?
Debbie
|
|
|
|
|
ya.....this is a dialog box , using the default id IDCANCEL for it....progressbar will be running in special thread....
ThomasKennedyBose
|
|
|
|
|
Sounds weird then. Are you sure the OnCancel is being called by the spacebar action? I'd override it to double check. Are there any other buttons on the dialog? Are they similarly affected?
Debbie
|
|
|
|
|
ya....OnCancel is being called by the spacebar action......there are no other buttons on it....
ThomasKennedyBose
|
|
|
|
|
Is the mouse working at all in the rest of the dialog box? Could you try putting in, say, a radio button and seeing whether that works?
Debbie
|
|
|
|
|
no debbi..... no other control is responding.
ThomasKennedyBose
|
|
|
|
|
Well, I'm stating the b. obvious here, so apologies, but at least you've got the cancel button out of the equation! You could try GetCapture to see which window has the mouse capture, but other than that I'm all out of ideas, I'm afraid.
Debbie
|
|
|
|
|
Hi,,
I tried with this code and it is working fine now
AfxGetMainWnd()->GetTopLevelParent()->GetLastActivePopup()->EnableWindow(TRUE);
ThomasKennedyBose
|
|
|
|