|
Well, I guess there is an "old school" that feels that pressing ENTER means "Take this input and process it". Some feel that it should then move the focus to the next item in the TAB order. It makes some sense to me although I would like nothing more at this point then to tell my users that this is the "new school" and "get over it". Unfortunately, I don't think they are going to drop this issue. I wish I could find a way...
Thanks again,
Mark
|
|
|
|
|
Looks like you'll have to handle it in the dialog that contains the edit control. PreTranslateMessage is probably a good place to do this. Check for WM_KEYDOWN, use GetFocus to see if focus is on your edit control, check for VK_RETURN and do your stuff.
|
|
|
|
|
Hi Nishant:
I'll give that a try.
Thanks for your suggestion.
Mark
|
|
|
|
|
I'm thinking you could probably trap the WM_KEYDOWN/VK_RETURN in your PreTranslateMessage function, and then fake a WM_KEYDOWN/VK_TAB. You should do the same for WM_KEYUP. That way you can reuse the tab code for the dialog.
However, I really wish you would reconsider doing this. This will annoy the hell out of some people, me included (well, in principle.. I don't know if I'm a user of your apps! ). I'm using an app at work which uses enter as a means of navigating to the next field, while tab doesn't do it at all. This goes against everything I expect out of a Windows program, and makes me make a lot of mistakes. Mistakes that costs time, and makes me less productive. It's f**king with people's minds!
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Hi,
I wrote an application that has to warn a user of a certain state.
I want to make sure the user sees my window.
How do a I force it to be always on top of all other applications running ?
This window is a simple CDialog derived window.
Thanks in advance,
Shay
|
|
|
|
|
Does SetWindowPos() or BringWindowToTop() work for you?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Almost there....
I want to force it on top of all windows and SetWindowPost seems to do the best work. However, I need a way to get the exact size of the bottom right corner.
This code is crashing for me:
<br />
LPRECT lpRect;<br />
this->GetWindowRect(lpRect);<br />
this->SetWindowPos(&CWnd::wndTopMost,10,10,lpRect->right,lpRect->bottom,SWP_SHOWWINDOW);<br />
|
|
|
|
|
Shay Harel wrote: LPRECT lpRect;
Change to:
RECT Rect;
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
this one worked, thanks !
|
|
|
|
|
Also, you could be seriously jacking up your window position, if it is already positioned near the upper left corner with only a little bit of the lower right corner showing.
I strongly recommend something like:
this->SetWindowPos(
&CWnd::wndTopMost,10,10,
Rect.right - Rect.left, // its width
Rect.bottom - Rect.Top, // its height
SWP_SHOWWINDOW);
Or even
this->SetWindowPos(
&CWnd::wndTopMost,10,10,
max(Rect.right - Rect.left, 100), // its width
max(Rect.bottom - Rect.Top, 100), // its height
SWP_SHOWWINDOW);
If you are REALLY paranoid, like me
|
|
|
|
|
What is the difference between IsBadReadPtr and IsBadStringPtr?
thanks!
|
|
|
|
|
One specifies a nul-terminated string, the other does not.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Be cautious when you use these functions. Especially so the IsBadWritePtr, as it works by "trying" to write to the provided memory area inside a structured exception handling block. If it fails with an exception, it makes the function return false. If it succeeds, it writes back the contents which was in the buffer before the write. Clearly, this introduces race conditions in a multithreaded environment.
There are also other sinister possible side effects. Unfortunately I can't remember what those were, but if my memory serves me right, Raymond Chen[^] has an article about it somewhere.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Hi ,
I have VC++ application which listens on socket and get msgs, most of time one msg per second and I use MS Access to store my messages. Then I distribute these messages in different MS Access tables . My problem is I am getting error like record is blocked by Admin , can't access that record .
Now I want to know that how MS Access locking system works ? like If one thread is reading from Table 'A' so can other thread write to that table ?
And my senior collegue told me that he tried MS SQL server earlier to store these msgs but it did't work as it jammed the SQL Server.
Regards,
ZINC
ZINC
|
|
|
|
|
What are you using to access the database? For instance, if your using ADO updateable recordsets, then that will create a lock on the table that you have open. ADO has a lot of options in the locking so that you can avoid most collisions.
|
|
|
|
|
Hi ,
Thanks for your reply , I have inherited my class from CRecordset , and use its open menthod to open recordset to write and read data , liek this
RS->Open(AFX_DB_USE_DEFAULT_TYPE,NULL,CRecordset::readOnly);
And what is the difference between the locking mechanizm of SQL Server and ACCESS ?
And is there any major difference , regarding locking ,between ACCESS 97 and ACCESS 2000 ?
Thanks,
ZINC
|
|
|
|
|
There is a international exhibition center which has 40 floor, and 10 elevator.
Constrain condition
1. The movement rule of the elevator:
E0.E1: can reach any floor of the building
E2.E3: can reach 1 and 25~40 floor
E4.E5: can reach 1~25 floor
E6.E7: can reach 1 and the even number of 2~40 floor
E8.E9: can reach the odd number of 1~39 floor
2. The maximum weight that every elevator can support is K people (suggest: people number is range from 10 to 18)
3. Before the simulation, every elevator is randomly parked in random floor in accordance with its movement rule, empty inside.
4. After the simulation, N (N=0~1000) people arrive 1 floor of this international exhibition center in M minutes randomly, and begin the activity of embark.
5. The floor that every passenger wants to arrive is random at the first time, and he waits the coming of the elevator at proper parking place.
6. After every passenger arrive the specified floor by proper elevator, settle (rest for a while) 10~120sec randomly, and go on going another floor randomly, the rest may be deduced by analogy. After every passenger embark the elevator L times (every people has the different L value, when a passenger come into being, this value is randomly specified from 1 to 10),the L+1 times will be down to 1 floor and finish the activity. The simulations also finish.
7. The velocity of the elevator is S second per floor (S=1~5), every people getting up or down time is T second (T=2~10).
8. The direction of the elevator is judged by the demander who first request, the later demander is not allowed to change the current direction of elevator, unless it is the empty elevator which is still not requested.
9. When there is passenger in some floor push the requesting button, the nearest to the passenger and satisfy term 8 and fastest elevator is preferential.
10. Not allow the elevator surpass its supporting ability.
Developing result:
1. The event created cycle is 1 second; every time can create 0 or more events.
2. Pseudo-random number producer specifies every random event.
3. Design a interface that can understand easily, dynamically display carrying passenger and working situation of the elevator, dynamically display passenger settle situation of every floor and request embark situation; dynamically display the time from the beginning of the simulation to current time.
4. You should display the passenger and his requested floor. For example, 12-32 express the passenger whose identity is 12 want to go 32 floor.
5. Statistical list the working and idle time of every elevator; statistical list the waiting time that every people ask for embark elevator; display these times after the simulation.
6. K.N.M.S.T parameters should be input from command line.
-- modified at 11:12 Tuesday 6th December, 2005
|
|
|
|
|
this is an homework assignment, and as there is no particular question about a specific C/C++ problem, i won't provide any answer here...
in brief : do your homework by YOURSELF !!!!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
A more helpful answer might be... "Start at #1, then work your way down the list until you are done....if you have any problems, ask your teacher."
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
if I know how to do it I will not ask for help,if you know how to work it why not provide some methods on it,perhaps you also don't know it
|
|
|
|
|
chen1000 wrote: if I know how to do it I will not ask for help
indeed...
chen1000 wrote: if you know how to work it why not provide some methods on it
assignments are made to test you a your knowledge... so if you don't know the principle, it's your problem, not ours.
now, you can always ask the forum for a particuliar question on a specific point, but don't give the entiere subject you were assigned to, or you will always get flamed !!
chen1000 wrote: perhaps you also don't know it
i help programmers in help here only because i want it as a pleasure... i'm not forced, not payed, so i'm not obliged to.
if you want an answer, read Chris Maunder's message here[^]...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
-- modified at 6:42 Wednesday 7th December, 2005
|
|
|
|
|
ok, let's start again.
there's no question, so i don't know exactly what you're looking for...
is the analysis already done ?
does it have to be object oriented (i suggest to though) ?
does you project have to be built upon a DataBase ?
what are E1~E9 ? different situations to be played ? or only management rules ?
i'm waiting for more precisions sir.
ps: look at my profile, i'm not american
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
Hi,
Is there anybody knows how to change the row height in the function OnCustomDraw below ? Is there an easy way to change the current font that the CListCtrl uses to Bold ?
void CColoredListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
int iRow = lplvcd->nmcd.dwItemSpec;
switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT :
{
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
// Modify item text and or background
case CDDS_ITEMPREPAINT:
{
lplvcd->clrText = RGB(0,0,200);
SelectObject (lplvcd->nmcd.hdc, m_fFont);
// If you want the sub items the same as the item,
// set *pResult to CDRF_NEWFONT
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
// Modify sub item text and/or background
case CDDS_SUBITEM | CDDS_PREPAINT | CDDS_ITEM:
{
if(iRow %2){
lplvcd->clrTextBk = m_colRow2;
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
else{
lplvcd->clrTextBk = m_colRow1;
*pResult = CDRF_NOTIFYITEMDRAW;
return;
}
*pResult = CDRF_DODEFAULT;
return;
}
}
Regards,
sdancer
|
|
|
|
|
Hi All
Which would be the best way to pass a CString to a TCHAR myVar[]
for example
what i want to do is something like
CString myStr = "hello";
TCHAR myVar[] = myStr;
thanks
si
|
|
|
|
|
si_69 wrote: Which would be the best way to pass a CString to a TCHAR myVar[]
Variables do not get passed to each other.
You can, in some cases, convert from one type to another.
CString myStr = _T("hello");
TCHAR *myVar = (LPTSTR) (LPCTSTR) myStr;
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|