|
|
|
the windows task manager application tab shows the application name as wellas the icon associated to that application/process.
i was making a listup of the applications that were running [task manager clone]
this i did by using the enumWindows API along with checks on the style sof the window handles obtained
and it is working
however dunno how to display the icon associated with a process.
any advice!!
|
|
|
|
|
Try WM_GETICON , I don't know if it works between processes but it's worth a try. If that fails, call GetClassInfo() to fill in a WNDCLASS struct that describes the window's class. In the struct is an HICON .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
hello
I wants to reach to the CD Drive for reading a files,and for that i want to know how to obtain the drive name of the CD drive (ex:On my PC the CD Drive is F: \).
|
|
|
|
|
|
How do I delete a file in VC++. Let's say that I have a file in this path - C:\Windows\MyFile.jpg. How do I delete this file.
|
|
|
|
|
MFC...
::DeleteFile("C:\\Windows\\MyFile.jpg");
Non MFC...
DeleteFile("C:\\Windows\\MyFile.jpg");
Jeremy Falcon
|
|
|
|
|
|
hi,
My prblem is like.......
I have created a Service which uses one custom-built library file in Windows200, the service is running successfully in WIndows2000 environment.
I have used library file by specifying in Project->Settings->Link.
But, when i m trying to run the same service on WindowsXP it gives me an error. By debugging the application, i find out that the cause of error is the custom-built library file.
I have tried to copy the LIB file to the folder where EXE lies, and then to system32 folder...then also the service is giving an Error.
The Error is like "The service did not respond to start or control request in timely fashion"
If anyone knows the answer pls reply me asap.
|
|
|
|
|
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
|
|
|
|