|
I don't know the handle of the window that had the focus before.
Think of this: the user works in notepad. Now he switches to my app and does something. My app must lose the focus and he must be in notepad again.
Idea?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
GetFocus() return a pointer to the window having the focus.
SkyWalker
|
|
|
|
|
Could you be more explicit?
If the user wants to go back to notepad, he clicks that window, so that window gets the focus.
I'm afraid I do not understand what you need
SkyWalker
|
|
|
|
|
Maybe you know my project KeePass Password Safe. The user has the option to auto-type some string, i.e. the KeePass window loses the focus and the window that had the focus before will receive simulated key-presses.
Now I face the problem of losing the focus without minimizing. If I just say ShowWindow(SW_MINIMIZE) the window automatically loses the focus and the keys are typed into the right window. But now I need a method to lose the focus, without minimizing.
Idea?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
1. To simply lose the focus, you call SetFocus(NULL);
2. MSDN says that:
"Windows created in different threads typically process input independently of each other. That is, they have their own input states (focus, active, capture windows, key state, queue status, and so on), and they are not synchronized with the input processing of other threads. By using the AttachThreadInput function, a thread can attach its input processing to another thread. This also allows threads to share their input states, so they can call the SetFocus function to set the keyboard focus to a window of a different thread."
Maybe one of these help?
SkyWalker
|
|
|
|
|
> Maybe one of these help?
Unfortunately not
1. looks good but doesn't work. The previously used window doesn't get the focus.
2. I couldn't get the AttachThreadInput function to work... It doesn't seem to do anything...
Thanks and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Could SetWindowPos be what you are looking for? You can use that to push your window to the back of all others.. Just an idea.
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
When I do
SetWindowPos(&CWnd::wndBottom, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); it gets nicely into the background, but doesn't lose the focus...
More ideas?
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
The WM_ACTIVATEAPP message gives you the thread ID of the app that had or is getting the focus from your app. You might be able to use EnumThreadWindows to find the window associated with the thread. When you want to set focus back to that window use SetForegroundWindow.
Hope this helps, as it is all quessing. Never done this myself.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Sounds interesting, I'll have a look at it! Thank you!
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Mircea Puiu wrote:
I'm afraid I do not understand what you need
Same here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Hi everybody , i want to write a application similar to "Program Control" that firewalls have, when a firewall is asking you to allow or deny acces to given program to internet , when this program tries to connect to internet.
Can anybody give me link to any web site or any article where i can find information regarding this.
Thanks in advance
m0n0
|
|
|
|
|
|
Hi all,
Who had worked on Pocket PC please help me!
I'm using CPtrArray to store a array of pointer(as below, it is pointer of CData class).
+ Firstly, I allocate memory for objects (using operator "new") , and add them to CPtrArray.
+ Then, I get these pointers and using "delete" operator to free allocated memory.
However, even though I freed all allocated memory, but for the frist times of runing this source on Pocket PC, memory always increase.
Of course, for next times of runing, memory is not changed.
(I monitor memory by go to "Setting\Memory")
Here is my source code:
class CData
{
public:
CData();
virtual ~CData();
private:
wstring m_strFullName;
wstring m_strNativePlace;
wstring m_strDescription;
int m_nAge;
int m_nHeight;
int m_nWeight;
bool m_bSex.
}
CPtrArray lstData;
CData * pData;
int nSize = 10000;
for (int i = 0; i < nSize; ++i)
{
lstData.Add(new CData());
}
for (i = 0; i < nSize; ++i)
{
pData = (CData*)lstData.GetAt(i);
delete pData;//free memory
}
lstData.RemoveAll();
lstData.FreeExtra();
Many thanks for your help.
|
|
|
|
|
Your code appears to be fine.
Maybe since your PocketPC application uses a certain 'maximum' amount of memory, that memory is now available and 'allocated' by the OS for use by your program from a pool. Within the 'pool' your application undergoes subsequent suballocations. You might need to see if the PocketPC API has some other type of memory compaction routine you need to call. Then you might see the memory footprint reduced.
|
|
|
|
|
Thanks Blake Miller,
I have just try your idea and You are correct!
I created 2-buttons on a dialog. And on LButtonDown event of those buttons, I implemented as the same source code to allocate memory, add pointers to array and finally, free them.
At first, I clicked mouse on Button 1, and of course, the memory was increased.
But, I clicked mouse on Button 2 later, the memory was not changed.
However, I have not found a API function as you suggested.
My PDA configuration is "HP iPAQ hx2410".
I'm a beginer of programing on PDA.
please help me!
|
|
|
|
|
I have no idea if there is such a function, I just suspected that you had to look for one.
Sometimes the memory management software on handhelds behaves this way.
|
|
|
|
|
I need to write a winsock application that captures localhost process packet information. That includes Server host name, ports, all the requests and responses.
How to do that in MFC/SDK. Do i need to write a asychronous raw socket application that monitors the localhost or write a dll injector that monitor all the host process api calls.
Which is better?
|
|
|
|
|
Hello Programmers ...
I am trying to develop a software which enables the PC to comunicate with a bluetooth device ...
I want an SDK or anything to help me with this ...
The function i want to use are:
search -> searchs for bluetooth devices and returns the avalible ID's.
Find -> bool function that searches for a certain ID.
send -> sends a file to a certain ID.
and thank you very much for your time ...
when i was right no one could remember me ...
but when i was wrong no one could forget me ...
(I saw it on an icecream truck when I was kid)
|
|
|
|
|
MSDN have many functions provided to manage the Bluetooth protocol...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
do you have a link that can give me more information ??
I searched for "MSDN bluetooth" in google .
I got many ruls bu I don't know which I should use ...
-*-*-*-*-*-*-*-*-*-*-*-*-*-*
when i was right no one could remember me ...
but when i was wrong no one could forget me ...
(I saw it on an icecream truck when I was kid)
|
|
|
|
|
you found this[^] ?
what are you lookin for exactly ?
for me, everything you need is dispatched into the 3 sections explained there...
...but you have to install the SDK...!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I was hoping that I could get some tips on how I could structure a (piece of a) program that does the following:
* Listens for incoming UDP broadcasts (using recvfrom ) on port 1337.
* Send periodic UDP broadcasts (every 5-60 seconds or so).
* Maintains a table of IP addresses of recently received broadcasts and periodically checking if no broadcasts have been received from a particular address in, say, 5 minutes.
Address | Last received
--------------------------------
192.168.0.1 | 12:43:11
192.168.0.101 | 09:11:27
193.129.163.12 | 23:23:07
One way of doing it would be using three separate threads (pseudocode):
thread T1 {
loop {
Listen for broadcast
Add to/update table
}
}
thread T2 {
loop {
Send broadcast
Sleep for 30 seconds
}
}
thread T3 {
loop {
Check timestamps in table
Take appropriate action if a timestamp is too old
Sleep for 2 minutes
}
}
This will work but involves more threads than I feel is needed (unnecesary risk of sync problems etc.) since none of the actions really need to be interleaved. Any suggestions?
Johan Tibell
|
|
|
|
|
I agree, that in the described level of functionality are three threads an unnecessary overhead.
Just firing from the head - you can join at least threads T2 and T3 to one.
then it would be something like:
threadT23
{
loopCounter = 0;
loop
{
Sleep for 30 seconds
Send broadcast
if( loopCounter == 4 )
{
do the T3 work
}
loopCounter++;
if( loopCounter > 4 ) loopCounter = 0;
}
}
similary you can join the T1 with T23, only thing you need is some sort of nonblocking listen.
This is just an idea from the scratch, so not necessarily the best one, but at least something...
|
|
|
|