|
David,
Thanks for the response. Please see my response to him in this thread.
Bob
|
|
|
|
|
David's right - you didn;t read my suggestion fully.
I could spell things out a bit more though.
I assume you need a frame to get the floating-ness, or dockaability. Or look at (eg) CControlBar , or CDialogBar .
Rather than just a Frame window, create a child window inside that frame. That child window should be an EDIT window, or a CEdit . ES_READONLY would be applicable then.
I hope that is clearer.
You can;t just use things blindly. If you don't know about ES_READONLY, then you should have looked it up on MSDN. There, it will tell you that it is an edit style. It's at best meaningless when used with another window. At worst, it could do something bad.
I hope that helps?
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Iain,
Thanks for the response. However, it does not help. I tried some of the things you suggested but it did not work. I would be happy to send you the code. I am still badly confused.
Bob
|
|
|
|
|
BobInNJ wrote: Did I make the wrong decision when I derived from CframeWnd?
Not exactly; but it is usually best to put a CView derived window in the client area of the Frame. I think that either CEditView or CRichEditView may provide what you are looking for.
|
|
|
|
|
Richard,
Thanks for the response. I tried using the class CEditView in a small test program and the small test program broke. As I understand it, the class CEditView is part of the Document / View model. The test examples that I have tried with the Document / View model did not seem to work or had issues. I am thinking that to change my code to use CEditView is going to be a major change. Do I have that right?
Bob
|
|
|
|
|
Think in more general terms.
CWnd wnd;
wnd.Create("Edit", "My Window", WS_VISIBLE, ...); You could also create a popup window by using CreateEx() instead. If that does not work, then use a dialog with an edit control on it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
David,
Thanks for the response. However, it is not making sense to me. When I try these things, they do not seem to work. I am badly confused. I tried what you suggested but it did not work.
Bob
|
|
|
|
|
Hello,
I have made a window which is readonly but a cursor appears on the wondow . do i have to remove the cursor.
pritha
|
|
|
|
|
prithaa wrote: do i have to remove the cursor.
How are we to know that?
Do you ever turn the read-only style off? If so, have you considered using a static control instead? What if you disabled the control instead of making it read-only? Have you tried setting the focus to the next control?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Hi ,
Can we append the _RecordsetPtr with another _RecordSetPtr . Suppose my recordset is having data for 2 rows . There are such 3 recordset. Can we create a new recordsetPtr which will be used to traverse through all these recordsets...is it possible..??
Thanks in advance..
|
|
|
|
|
No, but you could: 1) iterate through each and add to a common structure, or 2) change the query to include the other record sets.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Hello,
I'm working on an MFC application. For reasons I cannot fathom, there seems to be a problem with inconsistent display of the icons of an icon style CListCtrl between versions of Windows (XP and Vista). On Vista, one of the icons (Debtor statement) is omitted. This only occurs sometimes. When it actually occurs varies from build to build of the application, where changes between builds ought to have no bearing on this at all.
Why might this be? How can the problem be fixed? Here is the relevant code:
CMyReportView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
ReportsCtrl.ModifyStyle(0, LVS_AUTOARRANGE);
// Send an ID_RELOAD rather than calling UpdateStateData() directly - this is
// a hack to work around the problem of no icons being displayed initially
// in release build
SendMessage(ID_RELOAD );
}
CMyReportView::UpdateData()
{
CBitmap sales_bitmap,
daily_reconciliation_bitmap,
debtor_statement_bitmap,
debtor_invoice_bitmap,
voided_items_bitmap,
suspended_sales_bitmap,
stock_count_rep_bitmap,
live_stock_figures_bitmap,
sales_by_item,
pos_download_bitmap;
sales_bitmap.LoadBitmap(IDB_SALES);
daily_reconciliation_bitmap.LoadBitmap(IDB_DAILY_RECONCILIATION);
debtor_statement_bitmap.LoadBitmap(IDB_DEBTOR_STATEMENT);
debtor_invoice_bitmap.LoadBitmap(IDB_DEBTOR_INVOICE);
voided_items_bitmap.LoadBitmap(IDB_ICON_VOID);
suspended_sales_bitmap.LoadBitmap(IDB_SUSPENDED_SALES_ICON);
stock_count_rep_bitmap.LoadBitmap(IDB_STOCK_COUNT_REPORT_ICON);
live_stock_figures_bitmap.LoadBitmap(IDB_ICON_LIVE_STOCK_FIGURES);
sales_by_item.LoadBitmap(IDB_SALES_BY_ITEM_ICON);
pos_download_bitmap.LoadBitmap(IDB_POS_DOWNLOAD_REPORT_ICON);
COLORREF rgbTransparentColour = RGB(255, 255, 255);
imgl.Create(64, 64, ILC_MASK | ILC_COLOR32, 0, 0);
int sales_bit_id = imgl.Add(&sales_bitmap, rgbTransparentColour);
int daily_rec_bit_id = imgl.Add(&daily_reconciliation_bitmap, rgbTransparentColour);
int debtor_stat_bit_id = imgl.Add(&debtor_statement_bitmap, rgbTransparentColour);
int debt_invo_bit_id = imgl.Add(&debtor_invoice_bitmap, rgbTransparentColour);
int voided_itms_bit_id = imgl.Add(&voided_items_bitmap, rgbTransparentColour);
int suspend_sls_bit_id = imgl.Add(&suspended_sales_bitmap, rgbTransparentColour);
int stock_count_bit_id = imgl.Add(&stock_count_rep_bitmap, rgbTransparentColour);
int live_stock_figures_bit_id = imgl.Add(&live_stock_figures_bitmap, rgbTransparentColour);
int sales_by_item_bit_id = imgl.Add(&sales_by_item, rgbTransparentColour);
int pos_day_end_download_bit_id = imgl.Add(&pos_download_bitmap, rgbTransparentColour);
ReportsCtrl.SetImageList(&imgl, 0);
LVITEM lvi0;
lvi0.mask = LVIF_IMAGE | LVIF_TEXT;
lvi0.iSubItem = 0;
lvi0.pszText = "Sales report";
lvi0.iImage = sales_bit_id;
LVITEM lvi1;
lvi1.mask = LVIF_IMAGE | LVIF_TEXT;
lvi1.iSubItem = 0;
lvi1.pszText = "Daily reconciliation report";
lvi1.iImage = daily_rec_bit_id;
LVITEM lvi2;
lvi2.mask = LVIF_IMAGE | LVIF_TEXT;
lvi2.iSubItem = 0;
lvi2.pszText = "Debtor statement";
lvi2.iImage = debtor_stat_bit_id;
LVITEM lvi3;
lvi3.mask = LVIF_IMAGE | LVIF_TEXT;
lvi3.iSubItem = 0;
lvi3.pszText = "Debtor invoice";
lvi3.iImage = debt_invo_bit_id;
LVITEM lvi4;
lvi4.mask = LVIF_IMAGE | LVIF_TEXT;
lvi4.iSubItem = 0;
lvi4.pszText = "Voided items report";
lvi4.iImage = voided_itms_bit_id;
LVITEM lvi5;
lvi5.mask = LVIF_IMAGE | LVIF_TEXT;
lvi5.iSubItem = 0;
lvi5.pszText = "Suspended sales report";
lvi5.iImage = suspend_sls_bit_id;
LVITEM lvi6;
lvi6.mask = LVIF_IMAGE | LVIF_TEXT;
lvi6.iSubItem = 0;
lvi6.pszText = "Stock count report";
lvi6.iImage = stock_count_bit_id;
LVITEM lvi7;
lvi7.mask = LVIF_IMAGE | LVIF_TEXT;
lvi7.iSubItem = 0;
lvi7.pszText = "Live stock figures report";
lvi7.iImage = live_stock_figures_bit_id;
LVITEM lvi8;
lvi8.mask = LVIF_IMAGE | LVIF_TEXT;
lvi8.iSubItem = 0;
lvi8.pszText = "Sales by item report";
lvi8.iImage = sales_by_item_bit_id;
LVITEM lvi9;
lvi9.mask = LVIF_IMAGE | LVIF_TEXT;
lvi9.iSubItem = 0;
lvi9.pszText = "POS day-ends report";
lvi9.iImage = pos_day_end_download_bit_id;
int sales = ReportsCtrl.InsertItem(&lvi0);
ReportsCtrl.SetItemData(sales, 1);
int daily_reconcil = ReportsCtrl.InsertItem(&lvi1);
ReportsCtrl.SetItemData(daily_reconcil, 2);
int debtor_statement = ReportsCtrl.InsertItem(&lvi2);
ReportsCtrl.SetItemData(debtor_statement, 3);
int debtor_invoice = ReportsCtrl.InsertItem(&lvi3);
ReportsCtrl.SetItemData(debtor_invoice, 4);
int voided_items = ReportsCtrl.InsertItem(&lvi4);
ReportsCtrl.SetItemData(voided_items, 5);
int suspended_sales = ReportsCtrl.InsertItem(&lvi5);
ReportsCtrl.SetItemData(suspended_sales, 6);
int stock_count = ReportsCtrl.InsertItem(&lvi6);
ReportsCtrl.SetItemData(stock_count, 7);
int live_stock_figures = ReportsCtrl.InsertItem(&lvi7);
ReportsCtrl.SetItemData(live_stock_figures, 8);
int sales_item = ReportsCtrl.InsertItem(&lvi8);
ReportsCtrl.SetItemData(sales_item, 9);
int pos_download = ReportsCtrl.InsertItem(&lvi9);
ReportsCtrl.SetItemData(pos_download, 10);
ReportsCtrl.SetItemState(ReportsCtrl.GetItemCount() - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
Any assistance is greatly appreciated.
Regards,
Sternocera
|
|
|
|
|
I seem to have isolated the problem somewhat (It still erratically tends to swing between omitting and not omitting the icon between builds, I guess).
By commenting out:
ReportsCtrl.ModifyStyle(0, LVS_AUTOARRANGE);
I can make the problem disappear (although I have a new problem, which is that the icons are displayed as one big column). Commenting out anything else of note doesn't have the effect of suppressing the problem, so I guess that's progress.
Regards,
Sternocera
|
|
|
|
|
Hi Sternocera,
Where are you setting the column width?
|
|
|
|
|
Hi Randor,
I'm not - it isn't a report style CListCtrl, it's an icon style CListCtrl. I understand that column width isn't set with an icon style CListCtrl.
Regards,
Sternocera
|
|
|
|
|
Have you entertained the possibility of a bad/corrupt/outdated icon cache? I've had it happen once with an older version of Windows, so it's probably not a common problem.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
That seems like a reasonable explanation. I've found that moving the initialisation of the icons into OnIntialUpdate seems to fix the problem, but I'm not overly confident that it hasn't just temporarily concealed the problem.
I'll delete the cache to be sure.
Regards,
Sternocera
|
|
|
|
|
Where is imgl declared? Is its lifetime longer than the lifetime of the list control?
It's a good idea to always zero-init structs, like LVITEM , so that you aren't accidentally sending garbage data in the members that you don't explicitly set.
--Mike--
Dunder-Mifflin, this is Pam
|
|
|
|
|
Hi Mike,
Yes, imgl is declared in the same class definition as the CListCtrl. I have now zero initialised the LVITEM structs. Thanks for your help.
Regards,
Sternocera
|
|
|
|
|
There is a method that allows adjustment of the icon width: SetIconSpacing() You might try playing around with that.
|
|
|
|
|
I haven't had a re-occurrence since I simply initialised my structs, but thanks for pointing that out.
|
|
|
|
|
Hi,
I am working on an application, which calls a WPF page in MFC exe and loads it too, but the backgound for the WPF is coming black.
here is code snippet
Declaration
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Controls;
using namespace System::Windows::Media;
ref class Globals
{
public:
static System::Windows::Interop::HwndSource^ gHwndSource;
static WpfApplication1::Window1^ gwcContainer;
};
i have added in oninitdialog,
System::Windows::Interop::HwndSourceParameters^ sourceParams = gcnew System::Windows::Interop::HwndSourceParameters("MyWindowName");
sourceParams->PositionX = 20;
sourceParams->PositionY = 30;
sourceParams->ParentWindow = System::IntPtr(this->GetSafeHwnd());
sourceParams->WindowStyle = WS_VISIBLE | WS_CHILD;
System::Windows::Interop::HwndSource^ source = gcnew System::Windows::Interop::HwndSource(*sourceParams);
source->SizeToContent = System::Windows::SizeToContent::WidthAndHeight;
Globals::gwcContainer = gcnew WpfApplication1::Window1();
FrameworkElement^ myPage = Globals::gwcContainer;
source->RootVisual = myPage;
I dont want the black color around.
Any help is highly appriciated.
Thanks&Regards,
KDevloper
|
|
|
|
|
I got 1231 error value when using the code below.
1231: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
my lan and internet is working fine.
then where is actually the problem residing.
HANDLE hIcmpFile;
unsigned long ipaddr = INADDR_NONE;
DWORD dwRetVal = 0;
char SendData[] = "Data Buffer";
LPVOID ReplyBuffer = NULL;
DWORD ReplySize = 0;
ipaddr = inet_addr((const char*)m_sAddress);
ReplySize = sizeof(ICMP_ECHO_REPLY) + sizeof(SendData) +1;
ReplyBuffer = (VOID*)malloc(ReplySize);
hIcmpFile = IcmpCreateFile();
if (hIcmpFile == INVALID_HANDLE_VALUE)
{
return -1;
}
dwRetVal = IcmpSendEcho(hIcmpFile, ipaddr, SendData, sizeof(SendData) + sizeof(ICMP_ECHO_REPLY), NULL, ReplyBuffer, ReplySize, 500);
if(dwRetVal != 0)
{
PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
struct in_addr ReplyAddr;
ReplyAddr.S_un.S_addr = pEchoReply->Address;
m_sMessage.Format(_T("Received from %s Status = %ld RoundTripTime = %ld"), inet_ntoa(ReplyAddr), pEchoReply->Status, pEchoReply->RoundTripTime);
return 0;
}
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|