Thanks a lot. Can u please suggest links where i can get sample programs on Threads replacing the Timers. Please...... Chetan. Helping others satisfies you...
chetan210183
Posts
-
Timers -
TimersThanks for the Reply. But without a messagebox, the code excecutes properly. When messageBox is inserted it is leading to infinite loop. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timermessages/wm\_timer.asp In the above link, they have mentioned a statement like below. "The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions post this message only when no other higher-priority messages are in the thread's message queue. " So instead of Timers , can i use threads and loop the function? I mean replacing the Timers with Threads. Thanks. Chetan. Helping others satisfies you...
-
TimersHi everyone, I am trying to develop a Dialog based application for a device communicating through RS 232 serial Port. The serial port receives the new samples of data every 100 milli seconds. I am trying to display the message in a textbox and write the data to a file. For this purpose, i created a thread for receiving data. I am using a Timer with 100 milli seconds for Updating the textbox and writing the received data to the file. The Problem now i am facing is, when the file gets full, i am trying to display error message and stop the timer. But Timer is not getting stopped by KillTimer().Timer continues in the running state. BOOL MyDlg::OnInitDialog() { .... ... ConfigureSerialPort(); AfxBeginThread(Serial, NULL,THREAD_PRIORITY_NORMAL,0,0,NULL); return TRUE; } void CMyDlg::OnClickStart() { fp = fopen(file_name,"a"); if (NULL == fp) { MessageBox ("Error Writing File",NULL, MB_OK|MB_ICONSTOP); KillTimer(m_nTimer); } m_nTimer = SetTimer(1, 100, NULL); fprintf(fp,"%d\n",status); } void CMyDlg::OnTimer(UINT nIDEvent) { OnClickStart(); CDialog::OnTimer(nIDEvent); } UINT Serial(LPVOID pParam) { while(1) { DWORD dwBytesTransferred; ReadFile (hPort, inbuf, 60, &dwBytesTransferred, NULL); Sleep(100); } return TRUE; } Please help me regarding this problem. I am New to MultiThreading Concepts. Thanks. Chetan. Helping others satisfies you...
-
copy file in vc++Hello, Is it possible to copy a file from one PC to another PC, which is located in different server. In other way, is it possible to place a file on to USN(for example, http://remote/one) using CopyFile()? Thanks in Advance. Helping others satisfies you...
-
GetDiskFreeSpaceEX API ProblemI think, it is due to OverFlow. Check once. Using FindFirstFile and FindNextFile methods. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/findfirstfile.asp The above link may help u. Chetan. Helping others satisfies you...
-
command line instructionsThank you. Is it possible to copy a file from one computer to other computer in a LAN using CopyFile(). Chetan. Helping others satisfies you... -- modified at 5:10 Wednesday 22nd March, 2006
-
command line instructionsHi Everyone, How can we write the commandline instructions in VC++? For example, i want to copy Excel file from one location to another location in another place(LAN). I have a copy button in my dialog. When i press the copy button, the excel file should be copied over to another location. Is it possible to do so? Thanks in Advance. Chetan. Helping others satisfies you...
-
Acessing excel (*.xls) in vc++Thanks, i will go through the link. Helping others satisfies you...
-
Acessing excel (*.xls) in vc++hi, Thanks for reply. There is a .xls file. i tried to open it using fopen but i realized that excel file is a binary format file and could not be opened using fopen. I have to use .xls file. i cannot use .csv file. I have no idea about automation. could you please refer some links, which helps me. Again thanks a lot Chetan. Helping others satisfies you...
-
Acessing excel (*.xls) in vc++Hi, I want to copy the complete data from an excel sheet to another excel sheet.And also serach for the specific data from the specific column and copy down the data to the excel sheet. Is there any possible way to do so? Thanks a lot in advance. Chetan. Helping others satisfies you...
-
To convert BYTE type data to a WORD typeHi, I am receiving 60 BYTE type data to the serial port from an external device. I want to convert the 2 consequent received bytes each to a 16 bit word and store it in excel file? Does anyone have Idea , how to do this? For example, i received 60,25 consequently to the serial port. Now i have to store 6025 in the Excel sheet. Thanks, Please help me out to solve this problem. Chetan. Helping others satisfies you...
-
conversion of Int to CharHi Chaitanya, Try out this. FILE *fp; fp = fopen("chat.txt","w"); int a[10] = {5,15,25,35,45,55,65,75,85,95}; char p[20]; for (int i = 0;i < 10; i++) { itoa(a[i],p,10); fprintf(fp,"%s ",p); } Chetan. Helping others satisfies you...
-
MFC STUDY CENTERhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/mfchm.asp Helping others satisfies you...
-
conversion of Int to Charhi, did u include stdlib.h where itoa() is described? Chetan. Helping others satisfies you...
-
How to convert Float array to charHi, I think sprintf will do the trick for your Question. I didnt try it. #include #include char *DoubletoStr(char *s, double dd); int main(void) { double values2[] = {34709.22, 3746.55, 23456}; char value[32]; int i; DoubletoStr(value,values2[i])); return 0; } char *DoubletoStr(char *s, double dd) { char *endp; sprintf(s,"%f",dd); for(endp = s+strlen(s); endp!=s;endp--) { if(*(endp-1) != '0'&& *(endp-1) != '.') { *endp = '\0'; break; } } return s; } Good Luck. Helping others satisfies you...
-
for loop incrementingHi chaitanya, I hope the below link helps u. http://www.its.strath.ac.uk/courses/c/ Chetan. Helping others satisfies you...
-
set the color to a ButtonThanks a lot. Helping others satisfies you...
-
set the color to a ButtonThanks a lot for your suggestion. Helping others satisfies you...
-
set the color to a ButtonHi, Is it possible to set the color to a button in a dialog based application? I tried using CTLCOLOR_BTN unsuccessfully. The code which i tried is given below.. HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if (CTLCOLOR_BTN == nCtlColor) // It worked when i used CTLCOLOR_DLG to change the color of the DialogBox { hbr = ::GetSysColorBrush(1); } return hbr; } Thanks in Adavance.. Chetan. Helping others satisfies you...
-
How to maintain the button in pressed stateWonderFull!!!! it is working. Thanks a lot. Helping others satisfies you...