|
Since they both operate on the value returned from time(), why not just pass that same value to localtime()? Something like:
struct tm *tm1, *tm2;<br />
time_t _time;<br />
<br />
time(&_time );<br />
tm1 = gmtime(&_time); <br />
tm2 = localtime(&_time);
|
|
|
|
|
Thanks, DavidCrow buddy!
How to get the information of time zone? I just want to know how
to calcualte locatime from gmtime.
Can you show me an example?
regards,
George
|
|
|
|
|
Use GetTimeZoneInformation().
|
|
|
|
|
Thanks, DavidCrow buddy!
I have taken some time to read the docuement about this
function. And I really get some ideas about daylight saving
time and stardard time.
But I do not find an example about how to compute localtime
from gmtime, including the consideration about time zone.
Can you show me an example about it?
regards,
George
|
|
|
|
|
Have you looked at the members of the TIME_ZONE_INFORMATION structure? It's straight forward math.
For example, I am in CST (GMT -0600) and we are currently in Daylight Saving Time. The members of that structure of interest to me are Bias (360) and DaylightBias (-60). The sum of these (300) added to my local time will produce GMT. So, if it is 0930 right now, adding 300 minutes (5 hours) to that means it is 1430 GMT. Make sense?
get local_time
if (dst)
gmt = local_time + (bias + daylight bias)
else
gmt = local_time + (bias + standard bias)
endif
|
|
|
|
|
Thanks, DavidCrow buddy!
George
|
|
|
|
|
hi all,
I am stuck and i need help..I constructed a browser helper object using ATL..and now i want to display a dialog with HTML contents in it when IE fires an event..i cannot find any suitable tutorial or anything that does that..can anyone suggest me anything i can do to accomplish this..any help and pointers are highly appreciated..thanks in advance..
tina
|
|
|
|
|
Look at msdn.microsoft.com/msdnmag I think there are some articles on HTML Controls, etc.
|
|
|
|
|
|
Hey Friends
I Want To Enumerate (Precisely Get the Handle Of CMDiChild 's )Opened at a Particular Instance.
Help!
|
|
|
|
|
What you can do is loop through all of the documents and for each document, loop through all of the open views:
CWinApp *pApp = AfxGetApp();
POSITION pPos = pApp->m_pDocManager->GetFirstDocTemplatePosition();
while (pPos)
{
CDocTemplate *pTemplate = pApp->GetNextDocTemplate(pPos);
if (pTemplate)
{
POSITION pDocPos = pTemplate->GetFirstDocPosition();
while (pDocPos)
{
CDocument *pDoc = pTemplate->GetNextDoc(pDocPos);
if (pDoc)
{
POSITION pViewPos = pDoc->GetFirstViewPosition();
while (pViewPos)
{
CView *pView = pDoc->GetNextView(pViewPos);
if (pView)
{
CFrameWnd* pFrame = pView->GetParentFrame();
... and your code goes here!
}
}
}
}
}
}
|
|
|
|
|
I have a Single Doc app and want to put a border around the inside of it.
Thanks,
graham
|
|
|
|
|
When drawing inside your client area: 1) Draw your inside boarder, 2) use ExcludeClipRect() to exclude the border area from further drawing, 3) then use the mapping functions set the upper left and lower right courners of the new rectangular area where you wish all your normal drawing to occur, 4) draw like you normaly would.
I recomend you get a copy of "Programming Windows" by Charles Petzold, in order to figure out how to use the mapping functions. Also, try looking at the CDC methods and do a search of the MSDN Library using the names of the functions in the mapping section.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hello,
I have a problem with DLLs again
I have to load two DLLs which each contain 3 functions. The first function has to be called one time, the second very often, and the third only one time.
Now I call the second function about 60000 (each DLL) and I get a stack overflow???
The DLL function is:
DLL_C_EXPORT unsigned long gdPlay(unsigned long uRound, unsigned long uEnemyLast)
{
return (unsigned long)(rand() % 2);
} The calling loop in the main project is:
for(dwRound = 0; dwRound < m_dwRounds; dwRound++)
{
dwCurrent1 = lpDllPlay1(dwRound, dwLast2);
dwCurrent2 = lpDllPlay2(dwRound, dwLast1);
if((dwCurrent1 == 1) && (dwCurrent2 == 1))
{
dwPoints += m_dwPoints11;
}
if((dwCurrent1 == 1) && (dwCurrent2 == 0))
{
dwPoints += m_dwPoints10;
}
if((dwCurrent1 == 0) && (dwCurrent2 == 1))
{
dwPoints += m_dwPoints01;
}
if((dwCurrent1 == 0) && (dwCurrent2 == 0))
{
dwPoints += m_dwPoints00;
}
dwLast1 = dwCurrent1;
dwLast2 = dwCurrent2;
} The DLL is loaded perfectly and it also returns the correct values (I checked it with MessageBoxes)... But after some calls (about 60000 each) there is the stack overflow...
Do you have any idea what could cause the stack overflow???
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
If the calling convention (stdcall etc) isn't correct in the call to the DLL function that might explain it. ie. who is responsible for popping params off of the stack.
|
|
|
|
|
I don't know why this came up as Anonymous - it was ME.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hmm, how would that look?
Shall I put __stdcall or __cdecl before all functions?
In the main program I defined the function like this:
extern "C"
{
typedef VOID(WINAPI *LPDLL_VOID)(VOID);
typedef DWORD(WINAPI *LPDLL_2UL_1)(unsigned long uRound, unsigned long uEnemyLast);
typedef DWORD(WINAPI *LPDLL_2UL_2)(unsigned long uRound, unsigned long uEnemyLast);
} How would that look now?
Thanks for your help, you seem to be the DLL expert
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Now it works!! I've replaced the WINAPI declaration (=__stdcall) with __cdecl and now everything works fine!
Thank you VERY much!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
Now it works!! I've replaced the WINAPI declaration (=__stdcall) with __cdecl and now everything works fine!
Thank you VERY much!
Glad I was able to point you in the right direction. It would be interesting to know if this was related to your earlier problem of the DLL unloading and if putting the code optimization back how it was worked!
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I enabled the code optimization again and tried it... the program doesn't crash any more with optimization turned on... so it seems these problems were related somehow.
You were right from the beginning, that code optimization cannot be the source of the problem...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
You were right from the beginning, that code optimization cannot be the source of the problem...
This really didn't sound right, which is why I nagged you a bit. Put it down to experience. Good to hear all the problems have been resolved.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I am doing an application using TAPI32.lib.I have to capture the incoming call number.I have PCTel modem.AT#CID=1 command also working fine.I ahve down loaded caller ID applications and run,but they will not showing caller ID.My phone line has caller ID service.what is the caller ID system in India.
Anybody please kindly let me get rid of this problem.
yakkalas
|
|
|
|
|
I am also searching for the same, if you get any solution please let me know also..
Thanks in advance
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Hi what i want to accomplish is this:
To transfer a file from one folder to another folder without having to do that manually. ie. open both folders and drag and drop, or copy and paste.
What i want is to have a very basic console program or win based but preferably console based, that exists in the folder with the file and i just want to be able to drop the file on top of the console icon and for it to be sent to the destination folder.
I need almost no user input just to drop the file on top of the icon to run the program to send the file to its destination folder.
Anyone have anyi deas how i would go about doing this.
im using VC++.NET environ.
kind regards
Dave Long
|
|
|
|
|
Have a look at WM_DROPFILES. I haven't done much with console apps, but this is what you use in a Windows app. Also CWnd::OnDropFiles(). This is what I use in ED (see sig) if the user drops a file on it, whether it is running or not. Hope that helps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|