|
Thanks to everybody for mostly constructive input. FYI, I settled on using critical sections, as there is no forseeable need for inter-process locking. I also plan to reduce the number of locks, down from a lock per object to a medium granularity, probably using one lock per class.
Again, thanks for input.
Bernd
|
|
|
|
|
Can anyone tell me if I can get the time zone info for a computer on a local network?
Please tell me if this is possible.
Thanks,
~LizardWiz()
|
|
|
|
|
Is NetRemoteTOD() of any help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hmmmmm. It is a start I guess. But the structure only seems to return the current bias of the time zone from GMT time, I don't really know if I am daylight savings time or not. I guess I can get the current date of the machine in GMT time (which is what that function seems to return), then convert it to a local time for my machine, then determine if its daylight savings time or not, then determine the appropriate time zone based on that bias amount...
I am lucky I guess that we are only looking at Time Zones in the US...
But won't Arizona get messed up in daylight savings time?
Anyhow thanks for your help. If you have a better idea please let me know.
~LizardWiz()
|
|
|
|
|
LizardWiz wrote:
It is a start I guess. But the structure only seems to return the current bias of the time zone from GMT time...
Which is what you initially asked for. Determining DST on a remote computer is a different issue.
Do you have access to the remote server? If so, could you create a little application (two dozen lines of code) that listened to a particular port, and when a request came in on that port, send back a reply indicating whether DST is in effect?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a named pipe client that is using overlapped I/O on a handle
registered with an I/O completion port. There was a bug in the server that
was causing it to never read the named pipe, which in turn caused me to
notice that the overlapped WriteFile call in the client was getting blocked.
My overlapped ReadFile calls are not being blocked.
After fixing the server bug, it appears that the WriteFile calls are always
completing before WriteFile returns. I never seem to get ERROR_IO_PENDING
back on a write. The write completion events ARE being properly posted to
the IOCP.
I did open the named pipe with FILE_FLAG_OVERLAPPED. (If I hadn't, I don't
think the overlapped reads would be working properly.)
Any suggestions?
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
I've got a string, and i want to transform it into a CString.
string s="hello";
CString cs;
I can't do the following:
cs=s:
any ideas?
thanks
|
|
|
|
|
cs = s.c_str(); should work.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hi!
I've got a listbox (MFC app), and when i doubleclick on it i'd like to open a popupmenu.
I've got the CMenu popupMenu in my view class as a private atribute
this is the function:
void CJmnView::OnDblclkListContactos() <br />
{<br />
popupMenu.CreateMenu();<br />
popupMenu.LoadMenu(IDR_MENU_POPUP_CTACTOS);<br />
popupMenu.TrackPopupMenu(0, 100, 100,this);<br />
}
when i doubleclick on an item of the list i've got a Debug Assertion Failed! error.
any ideas?
another thing, there aren't many events for the listbox... for example, there is no onrightmousebuttonclick or something like that.
thanks!
|
|
|
|
|
kfaday wrote:
when i doubleclick on an item of the list i've got a Debug Assertion Failed! error.
any ideas?
And that assertion would be?? Have you looked at the line of code in question to see why the assertion is firing?
Is there a design reason why double clicking, instead of a right-click, brings up a menu?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i could fix the assertion.
DavidCrow wrote:
Is there a design reason why double clicking, instead of a right-click, brings up a menu?
in classwizzard, when i go to the list control, there are only 6 or 7 messages, and there isn't onrightclick.
now i've got another problem, i can see the pop up menu, but when i click anywhere else and it 'closes', if i doubleclick again it gives me another assertion error. here's the funtion:
<br />
void CJmnView::OnDblclkListContactos() <br />
{<br />
popupMenu.LoadMenu(IDR_MENU_POPUP_CTACTOS);<br />
CMenu* subMenu = popupMenu.GetSubMenu(0);<br />
<br />
CPoint ptPopup;<br />
GetCursorPos(&ptPopup);<br />
<br />
subMenu->TrackPopupMenu(TPM_LEFTALIGN, ptPopup.x, ptPopup.y, this);<br />
}<br />
<br />
|
|
|
|
|
kfaday wrote:
in classwizzard, when i go to the list control, there are only 6 or 7 messages, and there isn't onrightclick.
Sure there is. It's the NM_RCLICK notification. You might need to visit the Class Info tab first and make sure the Message filter: combobox has the correct item selected. Some messages/notifications come and go depending on that value.
kfaday wrote:
...it gives me another assertion error.
So what is the assertion that is firing?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm only able to see:
LBN_DBLCLK
LBN_ERRSPACE
LBN_KILLFOCUS
LBN_SELCANCEL
LBN_SELCHANGE
LBN_SETFOCUS
it doesn't matter what i select from the combobox.. i tried all combinations. i'm using vc++6.0
|
|
|
|
|
Those are listbox, not list control, notifications. You need to handle the WM_RBUTTONUP message for that control.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
would you mind telling me where could i read how to do that?
thanks!
|
|
|
|
|
Search MSDN for WM_RBUTTONUP and OnRButtonUp() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
i use visual C++.Net.
at starting a new form is formed automaticaly that's name is Form1.
but after i form the second form that is Form2, i cannot reach any variable or function in Form1.
since i write #include "Form2.h" in Form1.h so i can use any variable or function in Form2 but i don't write #include "Form1.h" in Form2.h so i cannot reach things that is in Form1.
when i write #include "Form2.h" in Form1.h and #include "Form1.h" in Form2.h after this the compiler give an error that is "multiple defined variables and functions".
so how can i reach the Form1 from Form2.
|
|
|
|
|
Look at the top of a .h file that ClassWizard creates. Notice that it adds both #if !defined and a #pragma once preprocessor directives. Those are to keep the file from being included more than once.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I need to inverts a rectangle. My drawing code is based on Gdi+, and Gdi+ doesn't provide any function to do this. so i used Windows API function ::InvertRect.
It works fine when direct draw to screen, but when i used double-buffer, the result was wrong. here is the code:
void CTestView::OnDraw(CDC* pDC)
{
CTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rc;
GetClientRect(&rc);
Bitmap bmp(rc.Width(), rc.Height());
Graphics* pGraphics = Graphics::FromImage(&bmp);
SolidBrush brush(Color(255, 255, 255));
pGraphics->FillRectangle(&brush, rc.left, rc.top, rc.Width(), rc.Height());
HDC hdc = pGraphics->GetHDC();
CRect rc1;
rc1.left = m_pt.x;
rc1.top = m_pt.y;
rc1.right = rc1.left + 10;
rc1.bottom = rc1.top + 10;
::InvertRect(hdc, &rc1);
pGraphics->ReleaseHDC(hdc);
Graphics g(pDC->GetSafeHdc());
g.DrawImage(&bmp, Point(0, 0));
delete pGraphics;
}
What's wrong?
|
|
|
|
|
Hi,
Is there a way to programatically add an icon for a contact ( in MS Outlook )?
Ex: for a contact which has an icq email address to put the icq icon.
Thanks
|
|
|
|
|
|
my application looks like
http://www.treetops.com.sg/before.jpg
when I fill an IC in patient IC textbox and click search button, it's supposed to query database and show what found in the right hand side listview. Everything seems ok by using mouse click, however if I want to use keyboard 'Enter' instead of mouse click what happen is all controls in this 'Patient Infomation' tab dispear:
http://www.treetops.com.sg/after.jpg
I have to manually switch to other tab then switch back, controls in Patient Infomation will appear. Anybody encountered this kind of problem before?
|
|
|
|
|
Well, I think you have for each tab a dialog and only one of them at a time is visible.
Normally, dialogs have an "OK" and a "Cancel" button. If you only delete them, the functionality still is in the dialog and "Enter" or "Esc" will close your dialog.
To avoid this, you should override (implement) the "OnOK" and "OnCancel" functions, but without calling its parent functions.
void CMySubDialog1::OnOK()
{
//CDialog::OnOK();
}
void CMySubDialog1::OnCancel()
{
//CDialog::OnCancel();
}
This should solve your problem.
|
|
|
|