Thank you LeeDavies for your answer! Yes, i tried checking the variable state during the loop, i even tried a MsgBox inside the Timer1 function, just to know if it was working! The Timer interval is 2000, instead it never displays the MsgBox, can't understand why... Could it be because, i keep reading from the modem..??? Rui
Ruca
Posts
-
Timer problem... -
Timer problem...Hi, I'm iusing a Do..until loop to receive data from a modem, one of the conditions for the loop to finish is a boolean variable (bTimeOut), assined to TRUE when then Timer finish is count, i did like: Settings.bTimeOut = False Settings.Timer1.Enabled = True Do If Main.MSComm1.InBufferCount Then Buffer = Buffer & Main.MSComm1.Input Loop Until (InStr(1, Buffer, Res & vbCrLf) Or (Settings.bTimeOut = True)) Settings.Timer1.Enabled = False Settings.bTimeOut = False The problem is that if, the modem answer is not like Res, the loop never ends, i cannot understand why does the Timer do not change my variable state, its function is like: Public Sub Timer1_Timer() bTimeOut = True Timer1.Enabled = False End Sub Can anyone help me with this? Thank you for your time Rui
-
Alternative to Timer objectThank you very much Richard, its working! Rui
-
Alternative to Timer objectHi! I'm quite new at VB, but i've been using VC++ for a while! I would like to know if there is some function (like sleep in c), that can be used to stop application for a determined time. I'm aware of timers and little functions (Ex. for loops..., but we don't actually have much control on the time they take...). Thank you for your time Rui
-
CFont problem...Thank you Michael Dunn, it's working! Rui
-
CFont problem...Hi! I'm trying to use two diferent CFont objects to use in diferente CStatics, but one of them is never used, why does this happends, i did like : void CUnits_Sold::OnInitialUpdate() { CFormView::OnInitialUpdate(); //trata das fontes para os títulos CFont hFont; CFont hFontForm; hFont.CreateFont(40, 15, 0, 0, FW_BOLD ,FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "MSTrebuchet"); m_stCStatic.SetFont(&hFont); m_stCLabel.SetFont(&hFont); m_stCMachineName.SetFont(&hFont); m_stCTempo.SetFont(&hFont); m_stCTempo2.SetFont(&hFont); //cria a fonte para as letras de identificação do form hFontForm.CreateFont(200, 14, 0, 0, 0 ,FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "MSTrebuchet"); m_stCFormName.SetFont(&hFontForm); } This hfontform is not used and the m_stCFormName uses the hFont, what am I doing wrong? Thank you for your time Rui
-
Delete Button problemThank you very much Rage, i tried it, but even with .Deatch() (i also tryed botao.m_hwnd==NULL) , i get an error when executing, and now i'sure the m_hWnd is 0x000000, is there any other variable i should worry about?. Thank you Rui
-
Delete Button problemHi! I'm working on a CFormView derived class, and i had the need of creating a ownerdraw button. In the .h file i wrote : CMyButton botao; ...and then, in the .cpp i created like this: ~ botao.Create("Back", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_FLAT|BS_OWNERDRAW, CRect(10, m_iLastY+70, 150, m_iLastY+100), this, BTN); The first time i call that form, no problem it works, but the next time i call it i get an debug assertation error! In Debug i can see that the hwnd of botao is 0x00000000 and the next time i stop in the line in which i'm creating it i have a value there. How can i make botao's hwnd equal to 0x00000000 again? Thank you Rui
-
ThreadsThanks, I forgot to add that I do have queries to a dB in my threads and yes I do have CoInitialize( NULL ); at the beginning of the function called by the thread. Unless the CoInit is at the wrong place. I would also like to add that I am running my code in debug and the error does not always occur. It appears randomly and this is what is puzzling me. Thanks regards Rui
-
ThreadsHi, I have a SDI application in which I create 2 extra threads. Using the debugger I get the following error intermittently: Unhandled Exception at 0x77e6d756 in Application.exe: Microsoft C++ exception: _com_error @ 0x02a3f44 Then the file comip.h is opened and the following bit of code generates the afore-mentioned error: HRESULT hr = CreateInstance( str, pOuter, dwClsContext ); The value of hr is 0x800401f0 CoInitialize has not been callled. If anyone has any clue what is going on here, feel free to let me know. I thank you for any suggestions. Regards Rui
-
,Thread and MutexThanks Scott I am sorry for the anonymous that was an error. Rui
-
Regional SettingsHi, I am sending data to a dB which represents monetary values. And am using the Period (.) as the decimal symbol. But notice that the values entered into the dB vary depending on the Regional settings and the decimal symbol selected. How do I obtain what the current settings are? Or how does one solve the problem? Thanks in advance Rui
-
Printing made easy with MFCThanks for the article, it does explain quite a bit on printing. But I was wondering more about where to set the JRECT defined in the classes GPrintUnit and GPrintJob? Although I am going to try to override the GPrintInfo function and set the JRECT there. I am not sure if this is correct. Thanks Rui
-
Printing made easy with MFChi everyone, I read the article "Printing Made Easy with MFC" and am using the GPrintUnit and GPrintJob classes. I would like to know how to redefine the Rect for printing, or more specifically how to introduce a margin so that my printing does not start on the edge of the page. Thanks in advance Regards Rui
-
MSChartHi everybody, A question with regards the above. How does one show the X-axis label and the Y-axis label? Not the axis values. In other words the x-axis label could be something like: Time (hours) Thanks Regards Rui
-
Serial CommsHi, I am using MSComm32 ActiveX in my application. I have a little problem with the following: If I open the Com port using my app. and then try using the HyperTerminal to open the same com port, the HyperTerminal informs us that the port is already being used by some other program. If I close my app. the HyperTerminal can then open the port. When I first open the com port with HyperTerminal and then try opening the com port with my app. the ActiveX also informs us that the port is already open. But if I close the HyperTerminal and try with my app. again, the ActiveX indicates that the port is closed and then when I try to open it I get an error. The only way I can then get access is by resetting the modem attached to the com port and opening the com port. Does anyone know how to fix this? Have you had the same problem? Thanks Regards Rui
-
Crystal ReportsHi, A quick question with regards the above: Can one use Crystal Reports in Visual C++? And if so how does one go about doing that? Thanks Regards Rui
-
Button BitmapOK, I understand that, what is bothering me is, after reading the MSDN documentation, I don't understand how to get the "Handle to an instance of the module whose executable file contains the icon to be loaded"? Thanks for your time and excuse my ignorance. Cheers Rui
-
Button BitmapThanks for the explanation. How do I get the hinst? Cheers Rui
-
Flashing ButtonHi, I would like to know if it is possible to load a .gif image into a button? The idea is to make the button image flash. Let say the button must change from green to grey and back again continuously. Thanks Regards Rui