Thread using GetSystemTime() problem

Hi. This code compiles fine but generates an "unhandled win32
exception" error at runtime:
UINT Thread1(LPVOID Param){
  LPSYSTEMTIME time;
  GetSystemTime(time);
return 0;
}
I call it in the OnInitDialog() method:
CWinThread *th=AfxBeginThread(Thread1,this);
If I just remove GetSystemTime(time) everything runs ok.
Any ideas?

0
11/1/2006 12:18:22 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
493 Views

Similar Articles

[PageSpeed] 17

azsx wrote:
> Hi. This code compiles fine but generates an "unhandled win32
> exception" error at runtime:
> UINT Thread1(LPVOID Param){
>   LPSYSTEMTIME time;
>   GetSystemTime(time);
> return 0;
> }

The API requires a pointer to a SYSTEMTIME.  But you have passed it an 
uninitialized garbage value.  You must actually create a SYSTEMTIME and 
pass its address:

SYSTEMTIME st;
GetSystemTime(&st);

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/1/2006 1:23:00 PM
> SYSTEMTIME st;
> GetSystemTime(&st);
this works, thank you!

0
11/1/2006 1:37:36 PM
Reply:

Similar Artilces:

Using MSRP for price calculations
We have setup the Item Pricing Tab within RMS so Cost is the cost we pay. Profit Margin is what we want our P.M. to be. Price is the every day price we sell our items for based on P.M. & Cost. Pretty normal stuff, except as follows: We set MSRP to be the retail price of the item as provided to us by our suppliers. But when we go to create special pricing using MSRP, the Pricing Wizard does not support the MSRP field. The the problem becomes "how do you mark down from MSRP (Retail) for special sales and accordingly populate the Price A,B or C fields. I know you can put the MSRP...

Which Database technology should i use?
Hi, I am writing a database application usinf MFC and was wondering which of the database technologies is the best to use. Should i use ODBC,OLE DB, ADO,MFC Database classes? I want to future proof my application to some extent. Which method is the most efficent? Which is the most widely used with VC++/MFC. Which is the easiest to learn/use? I'd appreciate all opinions and suggesstions, Thanks In Advance Macca "Macca" wrote: > Hi, > > I am writing a database application usinf MFC and was wondering which of the > database technologies is the best to use. ...

Problem with blocking of main thread with other thread
I have a problem with blocking of main thread: My application contains an interpreter and I need to write a debugger for it. The mainframe creates a thread that is interpreting instructions. When I need to break execution of instruction thread, I use WaitForSingleObject(m_WaitEventHandle, INFINITE); in the interpreter thread. Everything works fine until the window is opened from the interpreter. Then the mainframe freezes. When I break execution in VC the call stack for interpreter thread shows: � NTDLL! � KERNEL32! � CDebugManager::CheckBreakpoints() � CInterpreterThread::Run() � _Afx...

Repetative problem
Good morning Ladies and Gentlemen I have a list as below of components. You will note that 5 are of the same value and C4 C5 are the same value A B C1 0.1uf C2 0.1uf C3 0.1uf C6 0.1uf C9 0.1uf C4 12pF C5 12pF What I would like to do is have them displayed thus A B C1,C2,C3,C6,C9 0.1uF C4,C5 12pF There are of course other values like R1 V1 TR1 and so on, and they all are place on a new row even though their B value is the same. I would be grateful for any help. I have tried...

Odd problem with Outlook Connector
I have my Live Hotmail account set up in Outlook 2007 using Outlook connector. Suddenly, when I click on "Send and Receive" I get an error message that the operation cannot be performed on this account, yet if I choose to "send and receive" Hotmail ONLY, it all works OK. Can anyone suggest why this should be? Do u have any other account setup in outlook? You can check it under Tools > Account settings. If any remove that. If you cannot find any thing except hotmail , remove that and readd. That should fix. "Gordon" wrote: > I have my Live Hotma...

CRM Email Router problem
Dear Friends, I would like to know, Is it possible to install two CRM Email router on the Exchange for 2 different installation of CRM server? If NO then whats the solution to this limitation. Looking forward to everyone's help. Regards BurhanM No. The router may appear to allow it to be pointed to 2 different CRM server, but they need to be on the same implementation. It will only send email to one of the ones listed, not all of them. In the current version, there is no work around other than a seperate Exchange server. -- Matt Parks MVP - Microsoft CRM "Burhanm" &...

Where is my thread?
I posted a question about "Search for a value in multi-dimensionla array" an hour ago; where did that go? On 5/17/2010 17:38, Rick wrote: > I posted a question about "Search for a value in multi-dimensionla array" an > hour ago; where did that go? If you mean the one beginning with "Seach", posted almost half an hour before this one, it is there. :) On 5/17/2010 11:51 AM, Jackie wrote: > On 5/17/2010 17:38, Rick wrote: >> I posted a question about "Search for a value in multi-dimensionla >> array" an >> hour ag...

report using a subreport based on a crosstab query
I have a data entry form where the data entry fields are for: Amounts Billed, Amounts Paid and Amounts Invoiced for each month for 20 contracts (records). The accountant enters the amounts billed and the amounts paid each month on the primary form. He does not enter the Invoiced Amounts because that data is pulled from a separate table. It is included on the primary form as a subform, based on a crosstab query. The accountant has been printing each form individually for each contract. He has requested a report that would duplicate the form, so that he would not have to pri...

Simple Thread
I have created a thread in my MFC Dialog based application, in the thread function i want to have access to a user interface control that is attached to the main dialog. How can I do it? Regards, Mystique Mystique wrote: > I have created a thread in my MFC Dialog based application, in the thread > function i want to have access to a user interface control that is attached > to the main dialog. > How can I do it? > > Regards, > Mystique > > Indirectly, by posting a message to the main thread asking it to update the control. http://www.mvps.org/vcfaq/mfc/12.ht...

How to use Marquee with DataView WebPart
Hi, Does somone know how to get a DataView webpart to scroll as like with using the Marquee HTML tag? -- Regev Avivi (Mcse)‎ Website: http://www.regevnet.com Email: msforum@regevnet.cjb.net ...

Can't uncheck "Use DDE" for .mdb files
I am using Windows XP SP3 and Access 2003 SP3. I get the "windows cannot find..." when I open via a short cut on my desktop, which can apparently be fixed by unchecking the "Use dde" in "file types" in the Open for .mdb files, however something keeps putting the check and all the details back. Can I stop this? Thanks. I an dslkdalk dkpj "Chris Emery" <reply.to.group@optusnet.com.au> д����Ϣ news:4b9c0f9b$0$11705$afc38c87@news.optusnet.com.au... >I am using Windows XP SP3 and Access 2003 SP3. I get the "windows cannot ...

Converting Access 97 to Access 2000 using /convert
I am using the following as an alternative to a hard-coded conversion routine for Access 97 to Access 2000 as the hard-coded stuff dowsn't work : "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" C:\Test.mdb /convert C:\Test2000.mdb This works, apart from a really annoying 'information' box that says : "After you have converted this file to Access 2000 File Format, the new file cannot be shared with Access 97 users." Is there any way to stop this message appearing as Access will not close itself and complete the operation until I click OK? Many ...

Searching cells using a date range?
I have a large spreadsheet (CSV) with over 3000 lines of info. Each line has a date and time assigned to it. I would like to be able to set up some macros that would search and copy specific lines based on a start date and end date! Is it possibel to create some sort of menu where i can input the start and end dates and have the info from those specified cells copied into another blank sheet? I would be greatfull if someone could help point me in the right direction.... thanks Do you have to have a macro and menu? Why not put the start and end date in a couple of cells on the rig...

Diaglog/Threading Data Exchange Question
Greetings, I have learned a lot from all of you, and I hope to over come my latest road block. I have a smal IRC Chat client I am making. I have a Dialog Box with Control and I use a worker thread for connecting to IRC - That Thread will update controls on the Dialog by sending PostMessages. Now my problem is in the ListBox Control that I have extended to do popup menu with various commands. I need to be able to read that controls methods from within the Thread. so I need to do this from within my IRC Socket thread: (code not exact - pseudo code) CListBoxEx myUsers; //Defined in my ...

Why use Subtotals 1-11 instead of the built-in functions directly?
I see the need to use 101-111 for Subtotals; e.g. I want to ignore hidden values. But, I don't see why I want to use Subtotals 1-11, instead of using the built-in functions like average, count, max etc. directly. I do understand that if I use Data>Subtotals, I can later modify the Subtotals function which may have 1-11. Please enlighten me. Why would I choose Subtotals 1-11 over a more direct method? Am I missing something obvious? Thanks. Epinn Epinn wrote: > I see the need to use 101-111 for Subtotals; e.g. I want to ignore hidden > values. > > But, I don't ...

Why when I use hide columns / rows the undo does not work.
When I put commands in the spreadsheet with the right click and view code, then following this, the undo command no longer works. However, after I remove the code it (the undo) works again. Can you explain? ===================================================== Private Sub Worksheet_Change(ByVal Target As Range) Set TestCell = Range("AZ19") TestValue = "x" If TestCell = TestValue Then Range("A18:a20").EntireRow.Hidden = True Else Range("A18:a20").EntireRow.Hidden = False End If End Sub ===============================================...

using between 2 numbers in a case select
Hello, I was wondering if someone could help, I'm writing a case select wher the first case is <50000, and the next one is between 50000 and 250000 I can't seem to figure out how to do between 2 numbers with a cas select. any help with this would be greatly appreciated Cheers in advance Ri -- rikkin ----------------------------------------------------------------------- rikking's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=970 View this thread: http://www.excelforum.com/showthread.php?threadid=27147 Hi Rik you don't need to do the between ...

Need Help with Busy Dialog Thread
my application would perform a task. I want to stop the user from using the application's GUI untill the the BG task is finished. At first using Modal Dlg did not do the trick as every one now (apart from me) the the CDialog::DoModal() function has to return some how. So, I made a bit of research on the net and found a trick to display the Dialog using CWinThread derived class without stoping the main app window for executing the background task as follows: (1) In your header file define a CWinThread-derived class... class CDialogThread : public CWinThread { DECLARE_DYNCREATE(CDial...

How to call web method of DynamicsGP Web Services using apache axis
Hi Everyone, I am battling an issue and I figured one of you guys on this forum may be able to help. I have a developed an application in java to access Microsoft Dynamics 10.0 through Web Services. I post a SOAP request to DynamicsGPWebService.asmx web services and get a SOAP response that is handled in my java program using simple XML parsing. I want to achieve the same using objects in Apache AXIS. The first issue is that how can I list out all the webmethods available in the web services. The next issue is once I get a webmethod, how can I list out all the available fields of that webm...

cant send email using outlook 2007
outlook was working fine sending and receiving today out of no where it stopped sending I double check the out going SMTP, change it to use a different one, ping it and it was OK, I even tried to use goggles gmail smtp and nothing I have emails in the send folder that are not going any where and when I try to delete them it tells me that they cant be deleted because outlook already started transmission.. So I have no clue what could be going wrong.. On Tue, 11 May 2010 14:14:01 -0700, ereyes <ereyes@discussions.microsoft.com> wrote: >outlook was working fine sending ...

Callout use: Applying callouts to 3,000 cells similar to iPhone sms.
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hey, <br><br>I've got an excel sheet with my sms messages between my girlfriend and I. Theres about 3,000 rows of texts in two columns (each column has one person's side of the conversation). <br><br>I'm would like to format each cell with a &quot;callout&quot; (the cartoonish speech bubble) similar to messaging format used on an iPhone so that I could get a small booklet of our conversations printed out. <br><br>Is there any quick way to format all of thes...

Using the Median function with Auto-filter
How do I get median (=median(A1:A50000) to show a result for only filtered cells? When I autofilter on a different column and the number of visible cells is reduced by the filter, the median stays the same as the unfiltered list. Thanks! Mark, You could use a column of helper cells. In B1 enter =IF(SUBTOTAL(3,A1)=0,"",A1) and copy down to match column A. Then array enter the formula (enter using Ctrl-Shift-Enter) =MEDIAN(IF(B1:B50000<>"",B1:B50000)) Filtering column A will change the result of the SUBTOTAL functions, and thus the res...

Scrollbar paint problem with XP theme
When I use the app wizard in VS 2005 to create a simple SDI application (change view to be a CFormView), the scrollbars on the form view don't seem to paint properly. As you resize the main window, the scrollbars will flash and initially paint with the XP theme and then repaint with the classic view. Any ideas? Thanks. Timothy Dean I've never seen this happen. Did you do something to resize the view in an OnSize routine or are you running under Vista? Tom "Timothy Dean" <my_email@this.com> wrote in message news:OM8CmNrtIHA.1316@TK2MSFTNGP06.phx.gbl... &...

problem sending mails from my outlook express
To whom it may concern I just wonder anyone can help me with my outlook express..i hv problem sending mails out from that site.....asking for username and password.....I forgot my password but already been set........i tried changing it always come back with error...another thing is I hv window ME.....pls help n hope to hear from u soon... thank u. Sorry, but this newsgroup is for questions about Access, the database product that's part of Office Professional. You'd be better off reposting to a newgsroup related to Outlook Express, although your problem sounds as th...

Pivot Table using multiple workbooks
How can I use multiple workBOOKS (not worksheets) as data source for a Pivot table? Is there a way? Example: Count1.xls, Count2.xls and Count3.xls all have the same column headings....how can I grab these workbooks to create 1 master pivot table? Help please. Thanks. You probably know that it is possible to use a "Multiple Consolidatio Range" as source for a PT. I have not tried this across multipl workbooks (AFAIK it is possible) but, for my purposes, I did not fin that it worked very well. Your best method is to add your data into a single table. It is quit easy to set ...