|
It's possible that Windows XP has a lower tolerance for services that are slow to start. You should call RegisterServiceCtrlHandler as soon as possible in your ServiceMain , and give an accurate idea of how long it's going to take to start up using SetServiceStatus , in the dwWaitHint parameter. If this time is about to expire and you've not finished starting up yet, increment dwCheckPoint and call SetServiceStatus again. Be sure to call SetServiceStatus with dwCurrentState set to SERVICE_RUNNING once you're actually started.
The LIB file is a red herring. If it's a static library, all referenced code and data contained within it has been included in your executable. If it's an import library, you need to ensure that the DLL containing the imported functions can be found. It's preferable to place it in the same folder as the executable.
Use depends.exe from the Platform SDK to discover which DLLs an executable uses.
|
|
|
|
|
Ugh Why does this return a CTime of December 31, 1969 when I pass a CString of "Tue, 17 Feb 2004 20:21:51 GMT"
?
It works fine with dates such as Feburary 17, 2004, how can I get it to work with that CString?
CString ConvertDateToCString(CTime m_ctDate)
{
//Variables
//Date: 2 16 04
CString m_strResult="";
CTime ctResult=CTime::GetCurrentTime();
//
//Display yesterday if m_ctDate matches up with yesterday
//Date: 2 16 04
ctResult-=CTimeSpan(1,0,0,0);
if (m_ctDate==ctResult) m_strResult="Yesterday";
//
//Display today if m_ctDate matches with the current day
//Date: 2 16 04
ctResult-=CTimeSpan(1,0,0,0);
if (m_ctDate.GetDay()==CTime::GetCurrentTime().GetDay()) m_strResult="Today";
//
//Otherwise return the date
//Date: 2 16 04
if (m_strResult=="")
m_strResult=m_ctDate.Format("%b-%d");
//
return m_strResult;
}
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
How you initialize the m_ctDate ? I think that there is any signed/unsigned long mismatch, because 17.2.2004 the time_t value (number of seconds since 1.1.1970) exceeded 0x8000000 .
Another small brother of Y2K problem
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
Eeeeehhhh...0x40000000, not 0x8000000!!
|
|
|
|
|
Its CTime m_ctDate.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Hi, I'm Trying to make a small program dialog based, I have a good few options to set and I have to put in 3 different Radio buttons group the problem is when I click on one radio button the other one goes, how can I get the radio button to work between groups?
thanks
|
|
|
|
|
On the Radio Button Properties window click the "Group" checkbox for the first (and only the first) radio button in group.
Jeremy Falcon
|
|
|
|
|
Thanks very much it worked
|
|
|
|
|
No problem.
Jeremy Falcon
|
|
|
|
|
Need help dudes:
I needed a class for a moveable button. So I derived a class from CButton and added the funcions OnRButtonDown, OnRButtonUp and OnMouseMove.
In OnRButtonDown I set a bool var (m_bIsDragging) to true, and in OnRButtonUp back to false;
In OnMouseMove, if m_bIsDragging==true, I check for cursor position with GetCursorPos() and set the new position for the button accordingly. It seems to work quite fine but...
PROBLEM:
while dragging, if I move the mouse too fast, the cursor exits the button client area (i.e. the button position doesnt change fast enough to keep pace) causing of course the funcion (which is a member of the button object) to stop working, and the button to stop moving.
Is it there a simple way to:
1) have the button really stick to the cursor so that it doesn't slip out of its client area;
2) have the member funcion OnMouseMove continue to get message input even if the cursor gets outside the button's client area?
Thanks in advance for any help...
Ciao from Italy!!!!
Junkan.
Junkan
|
|
|
|
|
Call SetCapture() in OnRButtonDown handler and ReleaseCapture() in OnRButtonUp .
|
|
|
|
|
Hi all
My MFC application is using an ActiveX control in one of its windows.
Is there any way to use this control out of my process? I meen to run it (or to host it) in another process wich will be executed from my app, but still be able to see it on my app's window, like now.
What is the best way to this?
Thanks.
|
|
|
|
|
I have limited VC++ experience. I have used C and other languages a lot. I need to communicate with a serial device from a VC++ Dialog application, which I am developing.
How do I do this?
Thank you,
Joe Massarelli
|
|
|
|
|
I posted this reply (incorrectly - the guy was asking about a parrallel port...) this morning.
Mostly like reading and writing a file: (EXAMPLE - your mileage may vary...)
void CSerialPort::initPort(int comNumber, int baudRate)
{
closePort();
m_ComNumber = comNumber;
m_BaudRate = baudRate;
CString comStr;
comStr.Format(_T("%s%d"), _T("COM"), comNumber);
m_ComHandle = CreateFile(comStr,
GENERIC_READ | GENERIC_WRITE,
0, 0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
DCB dcb;
GetCommState(m_ComHandle, &dcb);
dcb.BaudRate = m_BaudRate;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(m_ComHandle, &dcb);
COMMTIMEOUTS timeouts;
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.ReadTotalTimeoutConstant = 0;
timeouts.WriteTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = 0;
SetCommTimeouts(m_ComHandle, &timeouts);
EscapeCommFunction(m_ComHandle, SETRTS);
EscapeCommFunction(m_ComHandle, SETDTR);
}
bool CSerialPort::readByteFromChannel(char* inByte)
{
DWORD numRead;
BOOL ret = true;
ret = ReadFile(m_ComHandle, inByte, 1, &numRead, 0);
return ( (ret) && (numRead == 1) );
}
void CSerialPort::sendPacket(char* pktBuffer, int len)
{
DWORD numWritten;
WriteFile(m_ComHandle, pktBuffer, len, &numWritten, 0);
if (numWritten != (DWORD)len)
// do comm error handling here
}
|
|
|
|
|
and how 'bout usb port?
rIsHaBh
|
|
|
|
|
Don't know - haven't had to do them yet but I think they are treated the same as basic serial ports.
|
|
|
|
|
I've created the .H files and I've put the include. Now my problem is with keeping the linker from complaining about multiply-defined symbols... I'm getting some linker errors and I've read in the page that you told me but I'm lost. I don't know which symbols should I define so I don't get this linker errors.
I'm getting this errors:
<br />
imevo.obj : error LNK2001: unresolved external symbol _IID_ITTSBufNotifySink<br />
imevo.obj : error LNK2001: unresolved external symbol _CLSID_TTSEnumerator<br />
imevo.obj : error LNK2001: unresolved external symbol _IID_ITTSFindA<br />
imevo.obj : error LNK2001: unresolved external symbol _CLSID_MMAudioDest<br />
imevo.obj : error LNK2001: unresolved external symbol _IID_IAudioMultiMediaDevice<br />
In imevo.cpp these symbols are used in some functions like these:
hRes = CoCreateInstance(CLSID_MMAudioDest,NULL,CLSCTX_ALL,IID_IAudioMultiMediaDevice,
(void**)&pIAMM);
hRes=CoCreateInstance(CLSID_TTSEnumerator,NULL,CLSCTX_ALL,IID_ITTSFind,(void**)&pITTSFind);
hRes=pITTSFind->Select(TTSModeInfo.gModeID, &pITTSCentral, (LPUNKNOWN) pIAMM);
hRes=pITTSCentral->TextData(CHARSET_TEXT,0,datos,NULL,IID_ITTSBufNotifySinkW);
I think I've defined all variables that I should (in imevo.cpp)
<br />
ITTSCentral *pITTSCentral;<br />
IAudioMultiMediaDevice *pIAMM;<br />
PITTSFIND pITTSFind;<br />
But I get these errors. Any idea? How should I use yor advice (I don't know if I need it or not)
<br />
#if !defined(some_unique_symbol_here)<br />
#define some_unique_symbol_here<br />
#pragma once<br />
?
Thank you very much
|
|
|
|
|
The following may help.
Create a separate .cpp file, change it to not using precompiled headers, and add the following.
#include <objbase.h><br />
#include <initguid.h><br />
#include <speech.h>
Also make sure the paths are set correctly to the SAPI .dll and .lib files in your VS settings.
|
|
|
|
|
I want to supply "Select count (*) from Employee" as the sql to a CRecordSet call, but CRecordSet dosent support Count(*) and advices m_ptr->MoveNext() all the way to the end where GetRecordCount will have the answer!
Any tips on implementing an equivalent of Count(*)??
Ger
|
|
|
|
|
Put "SELECT COUNT(*) FROM Employee" in the CRecordset::GetDefaultSQL() method. The record set will need one member variable to hold the returned value. m_nFields should be set to 1 in the constructor. You'll need an entry in the DoDataExchange() method.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
David,
I think you have too much time on your hands.... you've answered every message and left no scraps for the rest of us...;P
onwards and upwards...
|
|
|
|
|
Which doesn't necessarily mean that I provided the best, or even correct, answer. By all means, add to, or take away from, my response if necessary.
- DC
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I am building an MFC application in which I inserted an ActiveX control. I want to subclass (or hook) the control so that I can process some mouse message. Could you please help me with that?
Thank you very much.
|
|
|
|
|
My question is how would I detect when windows are open and closed/etc in another program and then send info accordingly to that program. I know this is a newbie question but I'm lost at this point.
|
|
|
|
|
My question is how would I detect when windows are open and closed/etc in another program and then send info accordingly to that program. I know this is a newbie question but I'm lost at this point
|
|
|
|