|
Thanks you were right! I changed it and it has *nearly* solved the problem, it got rid of the random 0x0D in the output file but it still won't write 0x11 and 0x13 to the file.
Maybe it is that it isn't reading these values from the port?
Any ideas?
Thanks
|
|
|
|
|
Have you tried CFile::SetMode(hFile, O_BINARY) ?
|
|
|
|
|
Thanks for the help but I'm actually using win32, non MFC
Paddy
|
|
|
|
|
hi,
use the activex control mscomm!
this will solve all your problems.
markus
Dr-Kuulun
|
|
|
|
|
Thanks for the help.
For some reason I don't actually have that control in my visual studio. Think it is only with the older versions?
Paddy
|
|
|
|
|
I noticed that all the CDao??? classes have been depracated in VS2003 and will be removed completely in the next version. What is the best way (best way meaning it won't be depracatted in a year and will be transparent to the users).
slack
|
|
|
|
|
Sorry i forgot to finsih my thought... What is the best way to replace them.
slack
|
|
|
|
|
I tried to create a worker thread. However, I keep get the compile error "error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (__cdecl *)(void)'"
Please help!
many thanks!
p.
//I have a global Thread function:
UINT connection(LPVOID pParam)
{
...
return 1;
}
//Start the worker thread
AfxBeginThread(connection)
{
....
}
|
|
|
|
|
try
AfxBeginThread ( connection , NULL ) ;
the second param is a user data
if u dont need it u can pass NULL
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
What's the rest of the error? It will tell you what the compiler is expecting. You can also put the cursor on AfxBeginThread() and hit F12. This will take you to the function's prototype.
|
|
|
|
|
Weird. Do you have connection() declared in the interface (*.h) file? AfxBeginThread() takes in as parameters more than one or even two.
Kuphryn
|
|
|
|
|
How i do to change the color?
And the Dialog´s color?
|
|
|
|
|
Catch WM_PAINT and/or WM_NCPAINT and paint it yourself.
|
|
|
|
|
(thank you for your fast answer )
Do i have to do with :
<br />
BEGIN_MESSAGE_MAP(TProgressTimeToComplete, CProgressCtrl)<br />
ON_WM_PAINT()<br />
END_MESSAGE_MAP()<br />
???
and then?
|
|
|
|
|
Then you must grab the dc's of the respective wnd's - like this:
(it's the same story in *all* wnd's derived from CWnd - like your ctrl.)
void CMyProgressCtrl::OnNcPaint()
{
// Paint NC-part of window.
CProgressCtrl::OnNcPaint();
// Borrow the dc of the window.
CDC *pdc = GetWindowDC();
if(!pcd)
return;
// Do some stuff ... see below...
// And then release it.
::ReleaseDC(GetSafeHwnd(), (HDC)*pdc);
}
and of more interest to your problem:
void CMyProgressCtrl::OnPaint()
{
// Paint C-part of window.
CProgressCtrl::OnPaint();
CPaintDC dc_paint(this); // Always do this even if you don't want to use it - something interesting goes on in its destructor or something(?).
CDC *pdc = GetDC();
if(!pdc)
return;
CRect irClient;
GetClientRect(irClient);
// Do something...
pdc->Rectangle(0, 0, irClient.Width(), irClient.Height());
}
Good luck!
Regards M.M.
|
|
|
|
|
|
One solution is SendMessage().
SendMessage(hBar, PBM_SETBARCOLOR, 0, reinterpret_cast<lparam>(RGB(255,0,0)));
Kuphryn
|
|
|
|
|
Thanks, but i don´t know in which method i have to call SendMessage (i supouse than OnPaint), and how i get hBar too????????
thanks again
|
|
|
|
|
Hi!
All day I've been fighting with week numbers and their differed definitions (ISO standards). It's rather complicated just from searching the topic on the net! WOW.
I've made this and it SEEMS to work OK in the years arond 2003 - meaning giving the same # as outlook (although not 100% correct in all countries from what I can understand).
#define DAY_SUNDAY 1
#define DAY_MONDAY 2
#define DAY_TUESDAY 3
#define DAY_WEDNESDAY 4
#define DAY_THURSDAY 5
#define DAY_FRIDAY 6
#define DAY_SATURDAY 7
class CTimeEx : public CTime
{
public:
...
inline const int GetWeekNumber()
{
// I THINK this is right
CTimeEx tYearBefore(GetYear() - 1, GetMonth(), GetDay());
int iWeekNumber_OfFirstWeek = 0,
iWeekNumber_OfThisWeek = 0,
iWeeksInYearBefore = tYearBefore.GetWeeksInYear();
const CTimeEx tFirstDayInYear(GetYear(), 1, 1);
// First week containing at least four days is the first week of that year.
const int iDayOfWeekOfFirstDayInYear = tFirstDayInYear.GetDayOfWeek();
if(iDayOfWeekOfFirstDayInYear == DAY_FRIDAY ||
iDayOfWeekOfFirstDayInYear == DAY_SATURDAY ||
iDayOfWeekOfFirstDayInYear == DAY_SUNDAY)
iWeekNumber_OfFirstWeek = iWeeksInYearBefore;
else
iWeekNumber_OfFirstWeek = 1;
iWeekNumber_OfThisWeek = iWeekNumber_OfFirstWeek;
CTimeEx t(tFirstDayInYear);
const CTimeSpan tdOneDay(1, 0, 0, 0);
while(t.GetDayOfWeek() == CTimeEx::GetFirstDayOfWeek())
t += tdOneDay;
const CTimeSpan tDiff = *this - t;
if(tDiff.GetDays() > 0)
iWeekNumber_OfThisWeek = 1 + tDiff.GetDays() / 7;
return iWeekNumber_OfThisWeek;
}
inline const int GetWeeksInYear()
{
// We will always experience a week 53 when December 31st falls on a Thursday, or in the case of a leap year when December 31st falls on either a Thursday or a Friday.
int iWeeksInYear = 52;
CTimeEx tLastDayInYear(GetYear(), 12, 31);
if(IsLeapYear())
{
if(tLastDayInYear.GetDayOfWeek() == DAY_THURSDAY ||
tLastDayInYear.GetDayOfWeek() == DAY_FRIDAY)
iWeeksInYear = 53;
}
else
{
if(tLastDayInYear.GetDayOfWeek() == DAY_THURSDAY)
iWeeksInYear = 53;
}
return iWeeksInYear;
}
inline const bool IsLeapYear()
{ return((GetYear() % 100 == 0) && (GetYear() % 400 != 0)); }
...
};
Regards Michael Mogensen/dk/dev.
|
|
|
|
|
Where GetFirstDayOfWeek() is:
TCHAR szLocalInfo[2];
BOOL bResult = ::GetLocaleInfo(
LOCALE_SYSTEM_DEFAULT,
LOCALE_IFIRSTDAYOFWEEK,
szLocalInfo,
2);
int iFirstDay = _ttoi(szLocalInfo);
SetCyclic(iFirstDay, 2, 1, 7); // Same as ++2 in [1; 7].
return iFirstDay;
|
|
|
|
|
I need to display jpg file on view, pls help
|
|
|
|
|
|
|
If u are using MFC in Visual studio.NET u can use CImage class!!!
Else refer to GDI plus documentation
|
|
|
|
|
Hi ppl
I have written 6 C programs and I now want to make a GUI, I am using Windows API, writing in C, using DEV C++ as compiler running on Windows XP
I have already create da main window and 6 child windows
Actually I want to display the text output of these 6 C programs on the screens of the child windows. And I planned to simply execute the .exe of the C programs in the child windows
But now I got the problem that I cannot simply execute the C programs in the child windows as I want to display the outputs to the child windows, I have to make a communication between the C program and the child window in the GUI program
As I said I created 6 child windows, each of them are for a particular
C program that I mentioned above. So for like I have program A B C D E F, and child windows A B C D E F. Then the outputs of program A will be displayed in child window A, and then program B for child window B...etc.
These 6 programs are actually written to be run in UNIX environment, it's just I think I should make a nice looking little application window to group these 6 windows. And I don't want console windows...black and grey. And so actually these 6 C programs are very much about text input and output. And to be precise, 5 of them only have outputs and only one has input, and it's like this
printf("Please enter input\n");
getchar();
So I don't even have to monitor the input like mouse input in many of the application windows, I know when to get input.
So my question is how do I make the C programs to communicate with the GUI program so that the outputs will be displayed on the child windows and get the input from the child windows.
Very desparate for some help here. Hope u guyz can give me some hints. =)
Thank you very much!!
Franky
fRaNkLy i'm FrAnKy
|
|
|
|