|
I have an SDI app (and it has to stay an SDI app). I need to be able to show different views, each with their own doc, but eachg view is required to maintain an open doc, even if the view isn't currently being displayed.
Is that possible? If so, how?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
|
Using VC&/C++/W2K. ::LoadImage() occasionally returns a system error 8 (Not enough storage is available to process this command) while trying to load a 1 mb. bitmap. Any ideas?
|
|
|
|
|
try to increase virtual memory
|
|
|
|
|
Hi hope someone can help me out here.
I have a program that recieves data from the serial port of the PC and saves it into a file using:
<br />
byte rec;<br />
<br />
:<br />
:<br />
:<br />
<br />
for(i=0;i<512;i++)<br />
{<br />
ReadFile(handlePort, &rec, 1, (LPDWORD)&bytes, NULL);<br />
<br />
fprintf(out, "%C", rec);<br />
}<br />
The problem is that it wont save the hex values 0x11 and 0x13 to the file when they are received from the serial port, I'm pretty sure it is because they are control characters, maybe? Also every so often it saves 0x0D to the file!
Any ideas how I can get around this problem?
Thanks in advance,
Paddy
|
|
|
|
|
Check out your fopen statement. I bet it looks like:
fopen("file name", "w");
try this instead:
fopen("file name", "wb");
-Sean
----
Shag a Lizard
|
|
|
|
|
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.
|
|
|
|