|
This [^] might help. Also just search in Codeproject you can find many!
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Hi,
thanks for answer
bosfan
|
|
|
|
|
Hi,
I am using CStringArray to store images in sequence. I need one help. I will load an image on the canvas area, then I'll apply an effect on that image. Then I'll store that image into CStringArray. I'll store the images in sequence as I'll apply an effect one after one. Now to undo the last applied effect I'll get the last image and load the same into canvas Area.
Isuue is that I am using check boxes to apply effects on images. If user has applied effect 'A', then 'B', then 'C', and so on. Now if user has unchecked the box with effect 'B', then It should load the image which was before applying effect 'B'. I want to store and know the state of the image before applying the effect and load that image only.
Anybody have any idea how to do this. I would appreciate if anyone can suggest me a better solution than what I am using.
Regards,
Mbatra
|
|
|
|
|
HINT:
map<int,CString>, use this to create association between index and CString object.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
mbatra31 wrote: I am using CStringArray to store images You may find that CByteArray [^] would be a better choice.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi, this is my first post.
Work flow is like this:
i open child dialog from a dialog( which is launched from a toolbar of a window) after editing i close the child dialog, after closing child dialog shadow is retained on window but not on the parent dialog. Later when i close the parent dialog the child dialog shadow disappears.
(issue exist only when i edit in child dialog)
Thanks a lot,
Shivaraj
|
|
|
|
|
Can you post somecode, it will be helpful to get help..
|
|
|
|
|
Thanks for reply, I have seen same design patterns(using child dialog)in the same application but there is no issue there. I compared the code, am not finding any difference in RePainting aspects.
here i have sample code..
Below used OnModifyview dialog is child dialog of a dialog.
void CSelectColumnViewDlg::OnModifyview()
{
int iIndex = m_ctrlColumnViewList.GetCurSel();
if (iIndex < 0)
return;
double dViewId = m_ctrlColumnViewList.GetItemDataDouble(iIndex);
if (dViewId == 0.0)
return;
CWaitCursor wait;
CComPtr pDispColumnView;
CComPtr pManager;
pManager.CoCreateInstance(CLSID_TrackingDataManager);
if (pManager)
pManager->GetColumnView(dViewId, &pDispColumnView);
CComQIPtr pColumnView(pDispColumnView);
if (pColumnView == NULL)
return;
CModifyColumnViewDlg dlg;
dlg.SetColumnView(pColumnView);
dlg.SetType(m_lSolution, m_lListType);
dlg.SetTrackGroupCd(m_dTrackGroupCd);
std::set* pExistingNames = GetExistingNames(iIndex);
dlg.SetExistingNames(pExistingNames);
if (dlg.DoModal() == IDOK)
{
HWND hWndAncestor = ::GetAncestor(GetSafeHwnd(), GA_ROOT);
m_ctrlColumnViewList.DeleteString(iIndex);
CComBSTR bstrName;
pColumnView->get_Name(&bstrName);
int iIndex = m_ctrlColumnViewList.AddString(CString(bstrName));
m_ctrlColumnViewList.SetItemDataDouble(iIndex, dViewId);
m_ctrlColumnViewList.SetCurSel(iIndex);
}
if (pExistingNames)
delete pExistingNames;
Invalidate();
//OnPaint(); //not working
//RedrawWindow();// not working
}
|
|
|
|
|
Are you using any drawing in the parent dialog that launched the CModifyColumnViewDlg?
If you don't have any OnPaint handler for the parent dialog, Invalidate is not required.
Otherwise use UpdateWindow()
|
|
|
|
|
shivareaj wrote: Hi, this is my first post. Not true, http://www.codeproject.com/Messages/4389343/Child-dialog-shadow-remains.aspx[^] is your first post.
I don't know why you have raised this question again, I have explained three times why this happens. You cannot repaint your main window until the first dialog returns from the call to DoModal() . And, as I also said earlier this is not a good design; modal dialogs should not need to call other dialogs to complete their operations, but should be completely self-contained.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
i posted that in wrong category so i re-posted same in right category.
|
|
|
|
|
It doesn't matter, the answer is the same.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
While I have library function from C, C++ and MFC, which one I should use.
Say for Example, fOpen like APIs from C, IoStream like supplied function from C++ or MFC's CFile supplied one. Which one is best choice when want to to a heavy text processing [Searching for some tags in a 2-3 MB file, preparing a report].
|
|
|
|
|
With file sizes of a few MB you can load the complete file into memory for parsing. Then you will not have significant differences in load time using different methods.
I general the high level file interfaces will call the low level functions internally. So using the low level functions may be faster. But the overhead of the high level functions does not care much because the disk access usually consumes much more time than the execution of some more code.
|
|
|
|
|
The right tool for the right job, of course.
For instance: if you are developing a MFC application the it make sense using MFC supplied objects (with several caveats, e.g. C++ STL containers are much better than MFC ones). On the other hand, if portability is a concern then you better use C functions or C++ objects.
Even personal taste, matters. I often choose C -like (stdio ) functions instead of C++ (iostream) objects.
Veni, vidi, vici.
|
|
|
|
|
I am working with an MFC Dialog Application built with VS 2010
My application uses CPropertySheet with multiple CPropertyPage's and on one of them I am using a CMFCPropertyGridCtrl. The Dialog associated with that page handles PreTranslateMessage's.
When running this code on a Windows 7 Touch Screen computer, I get the following exception in the PreTranslateMessage handling a WM_MOUSEDOWN for the CMFCPropertyGridCtrl which eventually calls IsDialogMessaag():
mfc100ud.dll!ATL::IAccessibleProxyImpl<ATL::CAccessibleProxy>::get_accParent(IDispatch * * ppdispParent) Line 69 C++
// Delegate to standard helper?
HRESULT CWnd::get_accParent(IDispatch **ppdispParent)
{
ASSERT(m_pStdObject != NULL);
return m_pStdObject->get_accParent(ppdispParent);
}
The problem is that ppdispParent points to a NULL.
I have no idea what should be done to fix this???
Can anyone help explain this?
|
|
|
|
|
Start by posting a stack trace. Always post a stack trace when reporting a crash.
Steve
|
|
|
|
|
I've found the solution to this problem.
It appears to be related to the HTML control issue discussed in:
http://support.microsoft.com/kb/954251/de
I added the following WM_DESTROY handler to my CMFCPropertyGridCtrl.
void CPropGridCtrl::OnDestroy()
{
if ( NULL != m_pStdObject ) {
m_pStdObject->Release();
m_pStdObject = NULL;
}
CMFCPropertyGridCtrl::OnDestroy();
}
When I run with this, I don't see any crashes, but without it I get them so looks like this is the magic bullet.
|
|
|
|
|
The Internet comes through with the goods again.
Steve
|
|
|
|
|
I had the same problem using a CMFCPropertyGridCtrl in a CPropertyPage with VS2012 (without Touch Screen).
Using the resouce in a CDialog is no problem, but when used in a CpropertyPage,the page calls OnDestroy as soon as it should be initialized.
The Solution was, dont include the CMFCPropertyGridCtrl aus a resource control and dynamically create it after the InitDialog of the CProperyPage is called.
CMFCPropertyGridCtrl * pctrlPropertyGrid = new CMFCPropertyGridCtrl();
if (pctrlPropertyGrid)
{
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
rect.DeflateRect(5, 10, 5, 10);
pctrlPropertyGrid->Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, rect, this, IDC_MFCPROPERTYGRID1);
...
}
|
|
|
|
|
I am student, taking C programming now.
I have assignment to write function to check if inputed data is numbers. if not - it should write that, and ask to enter number again.
I wrote code, to write error message, but dont know how to make program to work on next input.. should I call the Main function again ?
int main()
{
double hours; //hours worked in a week
double payrate; // hourly salary
double grosspay; //total weekly payment
int k; //number of values read
printf ("Enter number of hours, and hourly pay (or press 0 to exit) \n");
while ((k = scanf ("%lf%lf", &hours, &payrate))==2)
{
if (isdigit(hours) !=0)
return hours;
else
printf ("You entered invalid data, please enter number of hours \n");
if (isdigit(payrate) !=0)
return payrate;
else
printf ("You entered invalid data, please enter payrate \n");
if (hours==0 || payrate==0)
{
printf ("Good Bye. \n\n");
system("PAUSE");
return 0;
}
double grosspay;
grosspay = calculateGrossPay(hours, payrate);
printf ("Hours worked: %.2f\n", hours);
printf ("Hourly Rate: %.2f\n\n", payrate);
printf ("Your weekly payment is: $ %.2f \n\n\n", grosspay);
|
|
|
|
|
You cannot use a double parameter as input to the isdigit() [^] function. You should read your numbers in as strings and then apply isdigit() to each character, using a loop. Rather than having all your code in the main() function, you may want to think about writing a helper function that will input the string, validate it and return the converted value.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
i dont really know how to do that yet... Ok, i will try..
is there a general format of that function somewhere?
|
|
|
|
|
Mikerush7 wrote: is there a general format of that function somewhere? Assuming you mean isdigit() , I put the link in my previous message.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Mikerush7 wrote: while ((k = scanf ("%lf%lf", &hours, &payrate))==2)
If scanf succeeds then you need no other check.
Mikerush7 wrote: should I call the Main function again
No. You may call scanf (if you are allowed to use it) many times inside your main function.
Veni, vidi, vici.
|
|
|
|