|
The timer itself doesn't implement timeouts because the function you use to wait for the timer does. WaitForSingleObject[Ex] and WaitForMultipleObject[Ex] do.
|
|
|
|
|
I am writing a property-sheet application (actually a dialog app with tabs - nothing to do with properties !). The property pages contain various controls including edit boxes. For some reason the property page receives a PSN_KILLACTIVE notification whenever the user makes a change in an edit control. This calls CPropertyPage::OnKillActive() which calls UpdateData().
This not only makes the tab look as if it has lost focus, it also completely messes up the range checking in DoDataExchange() - for example if the user deletes a character, or all the characters, in order to enter a new value, the value goes out of range and is trapped by DoDataExchange() before the user can enter the new value.
This doesn't appear to happen with other controls such as radio buttons.
Has anyone elese experienced this? Is it a bug? Is there a work-around?
Dave
Dave
|
|
|
|
|
I've noticed that sometimes when saving data to a (JET) database while using ADO, a query performed right after the changes may not contain the changes....in particular if you have more than a single connection object to the same database.
I've played with events to make sure that the data is actually commited to the database (the CommitTransComplete method is getting called), but haven't found any solution except to hard-code a wait which I suspect is a very very bad idea.
Anyone have any ideas or know have an idea what I'm fighting against??
Thanks!
Paul
|
|
|
|
|
my understanding is that changes are not broadcast across multiple connections as the potential traffic on the network (in a multiuser scenario) would be grim
the solution we came up with was either to build in an auto-refresh every minute or two, or to give the users a refresh button on the data entry screens
sql server works this way to in fact
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
The information seems to be available within a few seconds (somewhere between 2 and 4 seconds) so refreshing every minute wouldn't really help any....and I need the data within a second of having saved it to the database.
I don't want to hardcode a wait into the application, and the whole point of the current set of work that I'm doing is to optimize for speed....having just saved the user 10 seconds, I'd hate to have to give half of it away waiting for data.
I've come across a Q article which indicates that Jet has "lazy" writes and caches information within the connection. I've set a connection property that is suposed to make sure that transaction data is to be saved right to the file, but haven't found any way of making sure that the other connection's cache is refreshed. ;(
Paul
|
|
|
|
|
I had the same problem a couple of months ago with an Access 2000 database and ADO. The solution looks like the following:
pConnection->BeginTrans();
//modify data base in some method
pConnection->CommitTrans();
After CommitTrans() other connections will see the change that occurred between BeginTrans and CommitTrans. This will flush the result back to the database.
There is an article in the MSDN library that explains transactions in ADO. Search MSDN for "Using Transactions in Your Solutions" as an exact phrase. There should be one article, its in Visual Basic but the solution is similar in VC++.
John
|
|
|
|
|
Now I have a dual-monitor system. Is there any API function with which I can enable or disable the second monitor, but not by using control panel?
Thanks in advance!
Wang Huaizhi
|
|
|
|
|
Hi everyone,
My problem seems simple, but I don't know where to start. The problem is :
Having a process Id or Handle, how do you get the name of the process (whether the process is iexplore, netscape, or something else)?
Thanks for all your help
|
|
|
|
|
GetModuleFileName(processHandle,buffer,buffersize) (9x,NT)
or
GetModuleBaseName(processHandle,moduleHandle,buffer,buffersize) (NT4/5)
|
|
|
|
|
void CTestKeyDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
UpdateData(TRUE);
char lsChar;
lsChar = char(nChar);
if (lsChar == 83)
{
AfxMessageBox("This is SS!w");
}
else
{
MessageBox("This is not SS!");
}
UpdateData(FALSE);
}
Ok, this is the code i use to get a message box to tell me if the keyboard button was "S" or not.
It works fine, but only if the dialog is complety empty, no buttons nothing at all.
I cant get it to work, any one have a hint to what i have to do??
Thank you a million zillion times
|
|
|
|
|
in an empty dialog the dialog itself has focus as there are no controls ... appwizaed sets the focus to the first control after InitDialog() so KeyDn() at the dialog level gets the input ... when you have controls on the dialog they get the focus
the HookWindow() stuff should help or i'm sure there's a more 'correct' way out there
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Well i couldt find any info on the
HookWindow() in MSDN, any tips on how to use it.
The thing i need to do, is i need to get focus on the dialog, not the button's or text
is there a way i can get the message if the focus is on a Button??? Like it dosnt matter
if there is focus on the buttons or dialog??
Thank you again.
|
|
|
|
|
Try searching for HookWindow - I got eight matches, including two very useful articles, ( one of which is a Paul DeLascia one on palettes I refer to from time to time )
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Use PreTranslateMessage(). Like this:
in TestKeyDlg.h
class CTestKeyDlg : public CDialog {
....
bool PreTranslateMessage(MSG *pMsg);
....
};
in TestKeyDlg.cpp
bool CTestKeyDlg::PreTranslateMessage(MSG *pMsg) {
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == 83)
MessageBox("That's S!");
return CDialog::PreTranslateMessage(pMsg);
}
With the best regards, Vitaly.
|
|
|
|
|
I get this error when i do the same as you do.
Error->(Sorry for the mess)
c:\documents and settings\administrator\my documents\c++\testkey\testkeydlg.h(16) : error C2555: 'CTestKeyDlg::PreTranslateMessage' : overriding virtual function differs from 'CDialog::PreTranslateMessage' only by return type or calling convention
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2568) : see declaration of 'CDialog'
TestKeyDlg.cpp
c:\documents and settings\administrator\my documents\c++\testkey\testkeydlg.h(16) : error C2555: 'CTestKeyDlg::PreTranslateMessage' : overriding virtual function differs from 'CDialog::PreTranslateMessage' only by return type or calling convention
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2568) : see declaration of 'CDialog'
C:\Documents and Settings\Administrator\My Documents\C++\TestKey\TestKeyDlg.cpp(128) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Generating Code...
Need a litle hint
|
|
|
|
|
I get this error when i do the same as you do.
Error->(Sorry for the mess)
c:\documents and settings\administrator\my documents\c++\testkey\testkeydlg.h(16) : error C2555: 'CTestKeyDlg::PreTranslateMessage' : overriding virtual function differs from 'CDialog::PreTranslateMessage' only by return type or calling convention
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2568) : see declaration of 'CDialog'
TestKeyDlg.cpp
c:\documents and settings\administrator\my documents\c++\testkey\testkeydlg.h(16) : error C2555: 'CTestKeyDlg::PreTranslateMessage' : overriding virtual function differs from 'CDialog::PreTranslateMessage' only by return type or calling convention
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2568) : see declaration of 'CDialog'
C:\Documents and Settings\Administrator\My Documents\C++\TestKey\TestKeyDlg.cpp(128) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Generating Code...
Need a litle hint
|
|
|
|
|
did u use class wizard to generate the correct handlers for the PreTranslateMessage() function?
otherwise you will in fact have different call sig / return value from the defined handler in the afxwin.h file
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Opss i was sleeping, i didnt get to much coffie in my cup
Thank you, and thank you all for helping me.
|
|
|
|
|
I would like to highlight any CWnd with a border like Spy++ does.
Now i just draw a rectangle but that overwrites any other window
that could be over the CWnd i would like to highlight. At it does
look very ugly afterwards.
But Spy++ manages to highlight windows without overwriting any
other windows that may cover. How does Spy++ do that?
|
|
|
|
|
SetCapture()
GetWindowFromPoint()
draw the line you want using a region to clip the drawing where other windows are on top
etc etc
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
IMHO Spy++ uses hooks. So it's dll is loaded in the that window's process. So it can implement it's own WM_NCPAINT handler and draw this lines as they drawn by that window itself.
GetWindowFromPoint() is only used to determine the window to do it with.
With the best regards, Vitaly.
|
|
|
|
|
And does anyone now how this can be done?
Any examples?
|
|
|
|
|
I have opened a comm port for non-overlapped I/O and set up a thread to watch for read events with WaitCommEvent. I have my main thread doing writes with WriteFile. Neither thread uses any windows.
The problem is that the WriteFile seems to be blocked by the WaitCommEvent in the background thread. This makes sense for file I/O but for serial comms the read and write operations should be completely independent and not block each other. I can overcome this by using overlapped I/O but it complicates things horribly.
Question: Does anyone know of a way to stop the comm Wait from blocking a non-overlapped serial write?
|
|
|
|
|
I'd like to mix two or more sound streams.
I don't want to use hardware mixer or DirectSound for two reasons.
i) I want to save the output to a file.
ii)I want absolut control of the timing.
(ex. mix 3463ms of source 1 with 3463ms of source 2)
Of course if you know a way to do both of the above by using DirectSound it whould be welcome.
What i tried is for each WORD of sound1 and sound2
to get differce, divide it by 2 add add it to the lowest value.
What i get was terrible.
A second though is to multiply the two WORDs and divide the result
with 65536 (or shift by 16bits). Although it sounds to be faster,
i thing it's gona be the same. am'i right?
And now comes the real hard stuff.
What i wanna do at the end is to mix 2 -or more- sounds, and
each sound having a weight,
like: sound1(60%) + sound2(31%) + sound3(9%)
any ideas?
Memory leaks is the price we pay
|
|
|
|
|
To mix several sounds with a specizific gain you have to scale every single sound by a factor and then simply add all sounds together.
this could be sa followed :
float gain1 = 0.6; // 60%
float gain2 = 0.31; // 31%
float gain3 = 0.09; // 9%
int mix; // your mixdown
mix = (int)(gain1*(float)sample1+gain2*(float)sample2 ....)
But BEWARE: If you add to much sounds you will surely get an overflow. So it is better to pre-scale all sounds with the same factor.
hope it helps
Greatings Mario ///
----------------------
www.klangwerker.de
mario@klangwerker.de
----------------------
|
|
|
|