|
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
|
|
|
|
|
you meant using _tcscpy() , strcpy() or strncpy() , not using operator=() , didn't you ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
non, the original poster just wanted to cast a CString to something alse, not make a copy ...
or at least that's what it looked to me.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
toxcct wrote: you meant using _tcscpy(), strcpy() or strncpy(), not using operator=(), didn't you ?
No, not at all.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
|
si_69 wrote: Which would be the best way to pass a CString to a TCHAR myVar[]
try lstrcpy function
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I'm trying to read a Dump file from a client, and I'm not sure how to do this with WinDbg.
1. If I'm not certain about the client's OS, can I download multiple Windows OS symbols to the same path, or do I need to download the symbols to seperate path for each OS version?
2. If I have the symbols for an OS with service packs installed, can I still use these symbols with a dump file from an OS that doesn't have any service packs installed?
3. Is there any clean way to examine the dump file to determine which OS it's for, and what version or service pack it has with it?
4. If I wanted to use VC++ 7.1 to examine the dump file, exactly how would I do that?
I'm currently waiting for the client to send some msinfo32 output that I believe will tell me about the OS and service pack, but I was wondering if there are other options for getting this information via the dump file.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|