|
I design my projects so that lower-level, possibly common, modules go into separate DLL projects.
Architecture's the name of the game...
|
|
|
|
|
I'll go for (1) i.e. refer the common header files rather than making a copy of it and use. Because, as you said, if you copy the files, you could avoid crashes or compilation errors during development. But infact you are not avoid it but simply accumulating. All the compilation errors and crash will popup once you start to integrate will the latest common and you'll be in real trouble in sorting out the bugs.
So better refer the common modules and incase of any trouble in latest common source, just get the old version from your version control and work with it until the guys fixes the latest common.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hello everyone,
For SetWaitableTimer and CreateWaitableTimer, I have the confusions (even after
Google, I can not find satisfied answers, seems the samples are very few and MSDN
description is fuzzy).
My questions are,
1. For API SetWaitableTimer, what are the meaning and function of parameters
pDueTime and lPeriod?
http://msdn.microsoft.com/en-us/library/ms686289.aspx
2. For API CreateWaitableTimer, what is the function and meaning of parameter
bManualReset (what is the different between setting it to true and setting it to false)?
http://msdn.microsoft.com/en-us/library/ms682492.aspx
thanks in advance,
George
|
|
|
|
|
- Look at this page[^]:
pDueTime is a pointer to a FILETIME that indicates how long (from now) until the timer expires.lPeriod shows the timer's period, i.e. the time between timer expirations
If *pDueTime was set to 10 milliseconds and lPeriod to 5 ms, the timer would fire 10, 15, 02, 25... milliseconds from now. - If a timer has
bManualReset set to TRUE , then you have to call SetWaitableTimer to make it start measuring time again after it expires. If a timer has bManualReset set to FALSE , then it becomes active again once a WaitForSingleObject or WaitForMultipleObjects call has been activated by the timer expiry. As with all these things, why not write a little program to experiment with it? That's the best way to work out what it does if the documentation's not entirely clear.
|
|
|
|
|
Thanks Stuart,
I would like to write simple samples until I understand the concept.
1.
Stuart Dootson wrote: If a timer has bManualReset set to TRUE, then you have to call SetWaitableTimer to make it start measuring time again after it expires.
You mean for example, I set the lPeriod to 5 ms, and then active the timer, then the timer only activate after 5ms once? Not active after 5ms, 10ms, 15ms, etc?
2.
Stuart Dootson wrote: a timer has bManualReset set to FALSE, then it becomes active again once a WaitForSingleObject or WaitForMultipleObjects call has been activated by the timer expiry.
I am confused about what do you mean, could you show some pseudo code or refer some samples? I did not find any good samples from MSDN.
regards,
George
|
|
|
|
|
George_George wrote: You mean for example, I set the lPeriod to 5 ms, and then active the timer, then the timer only activate after 5ms once? Not active after 5ms, 10ms, 15ms, etc
I don't think bManualReset has any effect when you have a non-zero period. Not sure, though. As I said, try it and see!
George_George wrote:
Stuart Dootson wrote:
a timer has bManualReset set to FALSE, then it becomes active again once a WaitForSingleObject or WaitForMultipleObjects call has been activated by the timer expiry.
I am confused about what do you mean, could you show some pseudo code or refer some samples? I did not find any good samples from MSDN.
How about this?[^]
|
|
|
|
|
Hi Stuart,
I think when non-zero period is used, bManualReset is also useful. Here is my code to show my ideas. Any comments?
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
int main()
{
HANDLE hTimer = NULL;
LARGE_INTEGER liDueTime;
liDueTime.QuadPart=-100000000LL;
hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
if (NULL == hTimer)
{
printf("CreateWaitableTimer failed (%d)\n", GetLastError());
return 1;
}
printf("Waiting for 10 seconds...\n");
while(1)
{
if (!SetWaitableTimer(hTimer, &liDueTime, 5000, NULL, NULL, 0))
{
printf("SetWaitableTimer failed (%d)\n", GetLastError());
return 2;
}
if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
printf("WaitForSingleObject failed (%d)\n", GetLastError());
else printf("Timer was signaled.\n");
}
return 0;
}
regards,
George
|
|
|
|
|
George_George wrote: 1. For API SetWaitableTimer, what are the meaning and function of parameters
pDueTime and lPeriod?
http://msdn.microsoft.com/en-us/library/ms686289.aspx
pDueTime - means exactly at which point of time, the timer should trigger first. If the value is positive, then it will be considered as absolute time else considered as relative time. Well, from your question it seems you're confused with absolute and relative time? isn't it? I'll explain a bit.
Absolute time - Assume you want to trigger the timer on New Year! In that case your timer should trigger on 1-Jan-2009 0:01 AM. So you can convert that time into a FILETIME value by using the function SystemTimeToFileTime()[^]and specify it as pDueTime and your timer will be signed exactly at that point.
Relative time - Just think about snoozing your outlook reminder for 10 minutes. That means - from NOW to 10 minutes. So you can specify the 10 minutes duration with negative sign. So the timer will be triggered exactly after 10 minutes.
As it says one is absolute - which means you exactly know the point of time and another is relative - means the value you specify is the duration of time from NOW, when the timer is to be signaled.
lPeriod - Assume after setting the timer at Midnight newyear, you want it to signal again in interval of 5 minutes - to wake up from bed . In that case set this parameter as 5 minutes in milliseconds. Literally, it means the duration for trigger the same timer in periodic fashon, After it signalled for the first time. If you specify this param, then after first signalling, it will signal periodically by the specified time duration.
Phewww!!! I admit that it was a bit long. Hope it will be helpful to you.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks Jijo!
Excellent reply!
How about your ideas for my question #2 below?
2. For API CreateWaitableTimer, what is the function and meaning of parameter
bManualReset (what is the different between setting it to true and setting it to false)?
http://msdn.microsoft.com/en-us/library/ms682492.aspx
regards,
George
|
|
|
|
|
Hey everybody!
Does anyone know how can I query a view using ADO (and SQLOLEDB) and get back XML?
In other words, how can I perform something like:
"Select * from students FOR XML AUTO" in ADO???
I cannot find any way to tell ADO to return as XML (I do not want to use text, but use ADO objects).
Thanks a lot in advance!
|
|
|
|
|
|
|
When i prepared the reply your second question, you have deleted your post. What happend? Well, anyway i'm posting the prepared reply.
If you find trouble in using CBitmap , then i'll recommend you SDK functions to do the same. Well, you can use LoadImage()[^] to load the bitmap and you'll get a handle. Then by using GetBitmapBits()[^] you could access the bitmap data. Well check this article[^] about how to load the image by using LoadImage() .
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I have tried creating DialogBar in MDI application using VC 2008 with steps mentioned in Dialog Bars[^]. But when running application only document is there but not the Dialogbar.
The code generated by MFC in CMainFrame::OnCreate() is different from the sample as follows:
<br />
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
BOOL bNameValid;<br />
<br />
CMDITabInfo mdiTabParams;<br />
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
mdiTabParams.m_bActiveTabCloseButton = TRUE;
mdiTabParams.m_bTabIcons = FALSE;
mdiTabParams.m_bAutoColor = TRUE;
mdiTabParams.m_bDocumentMenu = TRUE;
EnableMDITabbedGroups(TRUE, mdiTabParams);<br />
<br />
if (!m_wndMenuBar.Create(this))<br />
{<br />
TRACE0("Failed to create menubar\n");<br />
return -1;
}<br />
<br />
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);<br />
<br />
CMFCPopupMenu::SetForceMenuFocus(FALSE);<br />
<br />
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||<br />
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))<br />
{<br />
TRACE0("Failed to create toolbar\n");<br />
return -1;
}<br />
<br />
CString strToolBarName;<br />
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);<br />
ASSERT(bNameValid);<br />
m_wndToolBar.SetWindowText(strToolBarName);<br />
<br />
CString strCustomize;<br />
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);<br />
ASSERT(bNameValid);<br />
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);<br />
<br />
<br />
if( !m_wndToolbox.Create(this,<br />
IDD_TOOLBOX,<br />
CBRS_LEFT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY,<br />
IDD_TOOLBOX) )<br />
{<br />
TRACE0(_T("Failed to create the toolbox\n"));<br />
return -1;<br />
}<br />
m_wndToolbox.SetWindowText("Toolbox");<br />
<br />
<br />
<br />
if (!m_wndStatusBar.Create(this))<br />
{<br />
TRACE0("Failed to create status bar\n");<br />
return -1;
}<br />
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));<br />
<br />
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);<br />
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);<br />
<br />
m_wndToolbox.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);<br />
<br />
EnableDocking(CBRS_ALIGN_ANY);<br />
DockPane(&m_wndMenuBar);<br />
DockPane(&m_wndToolBar);<br />
<br />
<br />
CDockingManager::SetDockingMode(DT_SMART);<br />
EnableAutoHidePanes(CBRS_ALIGN_ANY);<br />
<br />
EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);<br />
<br />
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);<br />
<br />
CMFCToolBar::EnableQuickCustomization();<br />
<br />
return 0;<br />
|
|
|
|
|
I have 20M data to transfer through the net without one bit error,so i have to use the Hamming code to check and correct the data.
anyone can provide the implementation of Hamming code with C/C++,suppose the transfer input data is : unsigned char* buff=new char[1024*1024*20];
thanks.
|
|
|
|
|
|
Sure is a shame that there's no way to search for such stuff...
|
|
|
|
|
Does the latest Visual C++ redistributable, 2008 SP1, contain cumulative binaries of earlier C++ binaries, for instance 2003 and 2005 ones?
Or each redistributable package is a standalone installation?
Regards.
|
|
|
|
|
The Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) installs runtime components of Visual C++ Libraries required to run applications developed with Visual C++ SP1 on a computer that does not have Visual C++ 2008 SP1 installed.
So I doubt it it's got any more than the C and C++ run-time libraries supplied with Visual C++ 2008 SP1.
You could of course download it and try installing it in a clean VM?
|
|
|
|
|
Hi all,
in message box the buttons are looking as flat button i want to show button of message box like dialog box button,or xp style button.
is it possible.
please tell me .
i m waiting for your valuable suggestions.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Message boxes are xp/vista style by default.
If you're seeing flat buttons maybe that's because of the parent window. Don't use HWND_DESKTOP (or 0) and make sure you have created and initialized the parent window to use.
Hope it helps
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: Shall we change button style of messagebox?
Yes we shall. When?
lol anyway you need something like MessageBoxIndirect API?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Hi,
i want a simple code, to get some information of system.
windows type(x64 or x86 - version - service pack and ...) - cpu information
and ...
i am in a hurry for it
please help me,
Zo.Naderi-Iran
|
|
|
|
|
|