|
Thanks for all the help. I knew it should not be that hard.
|
|
|
|
|
Here would be the basics to read a file in C++:
#include < fstream.h >
void main()
{
//File Stream Object
fstream DataFile;
char FileName[81];
cout << "Enter the name of the file you wish to open\n";
cin.getline(FileName, 81);
DataFile.open(FileName, ios::out);
}
Nick Parker
|
|
|
|
|
i don't understand why the insertitem function is good and the text doesn't appear!!
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
ModifyStyle(0, LVS_REPORT,0);
// this code only works for a report-mode list view
//ASSERT(GetStyle() & LVS_REPORT);
// Gain a reference to the list control itself
CListCtrl& theCtrl = GetListCtrl();
// Insert a column. This override is the most convenient.
theCtrl.InsertColumn(0, _T("Names"), LVCFMT_CENTER);
// The other InsertColumn() override requires an initialized
// LVCOLUMN structure.
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Version");
col.fmt = LVCFMT_CENTER;
theCtrl.InsertColumn(1, &col);
theCtrl.InsertColumn(2,"Description",LVCFMT_CENTER);
// Set reasonable widths for our columns
theCtrl.SetColumnWidth(0, 200);
theCtrl.SetColumnWidth(1, 100);
theCtrl.SetColumnWidth(2, 100);
GetListCtrl().InsertItem(0, "First row");
}
GetListCtrl().InsertItem(0, "First row") is good but the text doesn't appear!!
Help me, please
PS: LVS_TYPEMASK == LVS_LIST only Michael Dunn. It is not that
|
|
|
|
|
|
I use this code in my view class (according to Christian Graus articles about GDI+)
using namespace Gdiplus;
Graphics graphics(pDC->m_hDC);
Pen pen(Color(255,234,0,123));
int y = 0;
for (int x = 0; x <= 250; x += 30)
{
graphics.DrawLine(&pen, x, 0, 0, y);
graphics.DrawLine(&pen, x, 250, 250, y);
graphics.DrawLine(&pen, y, 0, 250, x);
graphics.DrawLine(&pen, y, 250, 0, x);
y += 30;
}
When I run the application nothing appear in client area,but after I minimiza and maximiza framework then I can see lines
Does anybody know the reason?
Thanks
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Where are you doing the drawing ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
View class,OnDraw()
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Mazdak wrote:
View class,OnDraw()
Well, that's correct. Put in a break point to see if it gets called on startup, because the fact that forcing WM_PAINT by minimise and maximising the window draws OK means the code is working fine.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
I put breakpoint and somrthing wrong with this line:
Graphics graphics(pDC->m_hDC);
pDC->m_hDC -------->
- m_hDC 0x01010053 HDC__ *
unused CXX0030: Error: expression cannot be evaluated int
m_hDC can not evaluated
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Sometimes the debug window says that, but the variable is OK. Or was pDC NULL ?
Anyhow, try dereferencing pDC instead of refering to m_hDC, because operator HDC is defined for CDC.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Sorry for bothering you but would you please give me sample,I don't know how to do that?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
No bother at all. pDC is a *pointer* to a CDC, which is why you use a -> instead of a . to access it's members. A class can define an operator for a type, so that if a class is passed into a function that is looking for a different type, that type is returned. For example, CPoint wraps a POINT, and also defines operator POINT, so the underlying POINT is returned to functions that require it.
This will only work if you have an object, not a pointer. The way to turn a pointer into an object is to put a * in front of it. For example, if you had a CPoint * called pPoint, you could do this:
CPoint pt = *pPoint;
In the same way, you can do this
Graphics graphics(*pDC);
instead of
Graphics graphics (pDC->m_hDC);
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
I just want to hit my haed to the wall.
Still the same porblem
AHHHHHHHHHHHHHHHHHHHHHHHHHHHH
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Did you check in the debugger if pDC is a valid object, or if it is 0 ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Yes.it's valid and it is not 0,
but as I said m_hDC,and m_hAttribDC of it cannot be evaluated
but they are not 0 too
I didn't change anything in my setting of project
except I add GDI+ support,how can pDC be 0?
oh,I only changed OnDraw(CDC */*pDC*/)to OnDraw(CDC *pDC)
Does it help?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Is this in a Document/View application?
The reason is that OnDraw() is called after the user makes a change through the view (minimizing, maximizing, drawing, resizing). Only when those things have changed *through* the view will it be updated. Simply drawing with code in OnDraw will not be seen until the next WM_PAINT message is thrown which happens on minimizing, maximizing, drawing, resizing, etc..
Then when those conditions are met, the view calls the OnPaint() handler function in response to the WM_PAINT message then a device context is created of class CPaintDC which calls your OnDraw() function. What you can do is call RedrawWindow with the RDW_INTERNALPAINT flag(Which is kind of redundant on each WM_PAINT message) or call the InvalidateRect function which throws a WM_PAINT message (I think is better to do this) or do your application painting in OnPaint() using dc.m_hDC instead of pDC->m_hDC.
If I knew you were using a document class I might be of better help. Sounds to me like your not using a document class in your application. Hope that helps you.
|
|
|
|
|
Thanks for your information Jay,but after I move those code to OnPaint() again every things draw after I minimize or.. it.
And I don't know about another way you said
It is Document/View application,but I didn't use my doc class
thanks
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Sorry Mazy, looking through your code it should work as your wrote it. It should work in the OnDraw handler - I even tried your code and it compiled and the application worked well. The OnDraw handler seems to not be getting called on creation or not recieving the WM_PAINT message on creation. For reasons I don't understand. Hopefully some one can help you.
|
|
|
|
|
thanks Jay
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Netmeisters,
I've had eVC 3.0 with the PPC SDK installed. I just
installed the PPC 2002 SDK (plus SSCE 1.1). Now when I
start up eVC, I have the choice of "Pocket PC" and "Pocket
PC 2002" platforms. Fine, but when I select the latter,
the only available targets are "Win32 (WCE ARM) Debug"
and "Win32 (WCE ARM) Release". "Win32 (WCE x86em)" does
not appear. An emulator starts up, but of course I get a
message stating that the executable doesn't match the
platform.
Thus I am unable to use the emulator for the PPC 2002 platform.
Since I don't know any other Pocket PC developers, I don't know what
the PPC 2002 SDK is *supposed* to look like. I assume this isn't what
it is supposed to do, but it is hard to see what I could have done
to screw it up, since there were no options during installation.
Your assistance much appreciated.
|
|
|
|
|
AS far as I understand, teh String ARM processor is the only processor that is supported in 2002 and on.
|
|
|
|
|
Have you selected emulator x86 in tools>Platform manager>default device
I think that is the problem.
|
|
|
|
|
Hi,
I would like to send AT command to the serialport.
The command for send to the Serialport is OK.
But when I send the data through the SerialPort, Nothing.
With Hyperterminal when I send the AT command all are OK.
If anyone can help me .
Best Regards
youssef
|
|
|
|
|
Can you tell me, what is API functions for sending AT commands to modem ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have the all command that I need for extract SMS from a GSM.
When I use the Hyperterminal, I receive an answer from the GSM.
But when I would like to send via the CreateFile, ReadFile,WriteFile
For example : I would like to send AT+CSMS? with serialport. How can I do?
youssef
|
|
|
|