|
Aparna,
Have you managed to find a solution for this? I am stuck with this also...
thanks
|
|
|
|
|
Hi there,
I created a checklist which is itself a child view. The items on the checklist have corresponding buttons that allow the user to click on to perform the functions needed to complete the list. Once the user clicks on the button, a dialog box or form view appears. After the user clicks on the OK button to close the function view, how can I reference the checklist image in the checklist view to make it visible? Or should I say how do I refresh the checklist to see that the item has been completed? This is what I have so far:
void CCCheckList::OnSelFruits()
{
//opens up the Select Fruits dialog box
}
void CFruits::OnOk()
{
//do some things
PostMessage(WM_COMMAND, ID_FILE_CLOSE)
}
Where and how do I make the IDC_CHECKMARK image from the Checklist class visible?
Thanks!
|
|
|
|
|
Are any of the following ways of allocating memory faster or more efficient than the others:
malloc, calloc, free
c++ new, delete
LocalAlloc, LocalFree
GlobalAlloc, GlobalFree
CoTaskMemAlloc, CoTaskMemFree
-thanks
|
|
|
|
|
Stick with 'new' and 'delete', unless you have any specific requirements to use the other methods.
|
|
|
|
|
malloc and free are probably the fastest, given that in most heap managers, they are obtaining memory from a pool managed by the C runtime. calloc is inherently slower than malloc, since it calls malloc and then initializes the allocated memory to all zero's.
new and delete are slower than malloc and free, since they allocate/deallocate memory and then call the constructor/destructor for the object.
The remaining functions I would think would be slower than malloc/free/new/delete, since they involve Win32 API or COM calls.
That said, I agree with the other poster. If you are using C++, you should use new and delete wherever possible. Most of the time, the first thing you do with allocated memory is initialize it. The C++ new operator couples the allocation and initialization together, making it more difficult to fail to initialize what your allocating.
Software Zen: delete this;
|
|
|
|
|
With the MS C/C++ library running on W2K etc then I think you'll find that all those end up at the API 'HeapAlloc'. So if you're really after most efficiency then consider going direct.
In general though 'new'/'delete' for C++. And create your own allocators for special cases. For instance if you're allocating large numbers of small constant sized objects then a specialised allocator based on a number of larger allocations from the system is worth looking at.
As in all optimisation the big win is to get the high level aspects of the program efficient before micro optimising. Say you make all your allocations run in 95% of the time, and I tweak my app to do half the number of allocations. Who's won? Who's kept their app maintainable and simple? Etc etc.
Paul
|
|
|
|
|
HI,
Plz tell me How can i get ITem ( item no. or its attribute) by selecting it with mouse..
i means any method for getting seletec item Number
or any thing else like attributes
thanx
|
|
|
|
|
int nIndex = myListCtrl.GetNextItem (-1, LVNI_ALL | LVNI_SELECTED);
while (nIndex != -1) {
TRACE ("Item %d is selected\n", nIndex);
nIndex = myListCtrl.GetNextItem (nIndex, LVNI_ALL | LVNI_SELECTED);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hi all,
I am want to get embedded objects from a powerpoint slide. Then I want to handle the actions of each of those objects from each buttons of my application.
If anyone can please help me ASAP.
Best regards,
Faisal
(al.faisal@vmclbd.com)
Faisal
|
|
|
|
|
can someone point me to an example of using the Tab control which changes content when the tab changes
i really dont want to go through 20 controls and hide them just to change the content
|
|
|
|
|
Put your controls in one or more modeless dialogs - then just show the appropriate dialog (and hide the others) when the tab selection changes. Alternatively, you could use a modeless property sheet (and property pages).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
ok, i found this artical -> http://www.codeproject.com/dialog/embedded_dialog.asp
its exactly what i needed, bit i dont want the dialog to have a border when its embedded in the main dialog, so how do i take away the border?
|
|
|
|
|
The border is a property of the dialog, just turn it off.
--
Joel Lucsy
|
|
|
|
|
Set the dialog's border style to "None" in the resource editor.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
HI Dear,
How r u ?
Actully I got same problem as you may faced(Multithread control) in VC++.
I want to place Items in list box. but all placing of items in List must be done in thread. so that all other work can be done side-wise.
Can you get me idea..as you may have solved this type of problem.;)
PLZ PLZ..Thanks..Sumit Kapoor
---Sumit Kapoor---
|
|
|
|
|
One solution is messages. Send a message to main thread and have it update the control.
Kuphryn
|
|
|
|
|
Hi Sumeet,
Nice to see you again....
I find the solution of my problem by calling the SendMessage(IDC_xxx_xxx) to call the ON_BN_CLICKED message directly from your thread function.I also works even in case of User-Interface Thread.
Like that you may place ur item directly from your thread program. It will work eeven if you are using User-Interface thread. This may help you.
Wish you all the best..
Bye
|
|
|
|
|
how can I change the color of status bar with vc6? I mean the bottom of the window.Thanks a lot.
hi all
|
|
|
|
|
How can I make a property in an ActiveX control (ATL) have the choices enumerated so that they appear as a drop-down list in VB?
Thanks,
Jory
|
|
|
|
|
Okay, just to maybe save someone else some time in the future, I get a RPC_X_BAD_STUB_DATA (1783) windows error code if I pass a buffer that is too LARGE into this function. When I reduced it to 4096 bytes, the call works fine.
|
|
|
|
|
Hey,
When I print on a normal Printer, all the text prints fine, but when I have it print on a Laser Printer, all the text gets squahsed together, and text is wirrten over other text, it is a whole mess. Anyone know why it is doing it?
Here is the code.
<br />
<br />
CPrintDialog dlg(FALSE); <br />
CDC dc; <br />
#if 0 //Show print dialog. <br />
if (dlg.DoModal() == IDCANCEL) <br />
return; <br />
dc.Attach(dlg.GetPrinterDC());<br />
#else //Don't show print dialog. <br />
PRINTDLG prtDlg; <br />
AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg);
dlg.m_pd.hDevMode = prtDlg.hDevMode; <br />
dlg.m_pd.hDevNames = prtDlg.hDevNames; <br />
dc.Attach(dlg.CreatePrinterDC());<br />
#endif <br />
dc.m_bPrinting = TRUE;
CRect printArea; <br />
CRect printArea1; <br />
CRect printArea2; <br />
CRect printArea3; <br />
CRect printArea4; <br />
CRect printArea5;<br />
CRect printArea6; <br />
CRect printArea7; <br />
<br />
printArea.SetRect(500, 0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea1.SetRect(700, 1500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea2.SetRect(750, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea3.SetRect(1250, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea4.SetRect(750, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea5.SetRect(1250, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea6.SetRect(325, 250, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea7.SetRect(750, 500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
DOCINFO docinfo; <br />
memset(&docinfo, 0, sizeof(docinfo)); <br />
docinfo.cbSize = sizeof(docinfo); <br />
docinfo.lpszDocName = _T("Edit Control Print"); <br />
dc.StartDoc(&docinfo); <br />
dc.StartPage(); <br />
<br />
CFont font;<br />
font.CreatePointFont(480, "Arial", &dc);<br />
<br />
CFont font1;<br />
font1.CreatePointFont(280, "Arial", &dc);<br />
<br />
CString str("Text Text Text");<br />
CString str1;<br />
CString str2("Test");<br />
CString str3("Test");<br />
CString str4;<br />
CString str5;<br />
CString str6("Test");<br />
CString str7("Test");<br />
<br />
CSize size = dc.GetTextExtent(str);<br />
CFont *pOldFont = dc.SelectObject(&font);<br />
dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK);<br />
dc.DrawText(str6, printArea6, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str7, printArea7, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.SelectObject(pOldFont);<br />
<br />
<br />
m_name.GetWindowText(str1);<br />
CSize size1 = dc.GetTextExtent(str1);<br />
CFont *pOldFont1 = dc.SelectObject(&font1);<br />
dc.DrawText(str1, printArea1, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.SelectObject(pOldFont1);<br />
dc.DrawText(str2, printArea2, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str3, printArea3, DT_NOPREFIX | DT_WORDBREAK); <br />
<br />
m_DEPdate.GetWindowText(str4);<br />
m_Shipdate.GetWindowText(str5);<br />
dc.DrawText(str4, printArea4, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str5, printArea5, DT_NOPREFIX | DT_WORDBREAK); <br />
<br />
dc.EndPage(); <br />
dc.EndDoc();<br />
}<br />
<br />
After it printed weird on a Laer Printer I thught it was the code and tried it on anomral printer again, and it worked fine, so is printing on a lser printer something different on code?
Thanks for any help
|
|
|
|
|
You must take differences in printer resolution into consideration. Your printing rects have hardcoded coordinates, which is bad, bad, bad. To get the resolution for a single inch of the printer, call dc.GetDeviceCaps( LOGPIXELSX/LOGPIXELSY); . Use values based on the return for the start coordinates in your SetRect -calls.
|
|
|
|
|
I'm getting LNK Error 2005
nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: virtual void __thiscall CObject::Serialize(class CArchive &" (?Serialize@CObject@@UAEXAAVCArchive@@@Z) already defined in mfc42ud.lib(MFC42uD.DLL)
It appears the conflict MAY be caused by a library file (I do not have source) included in Project/Settings/Link.
However, I've examined the functions in the link file and it does NOT appear that they are dups of the 100 functions listed in Output (Unicode functions) with the LNK 2005 error.
BACKGROUND
This is my first attempt at ActiveX. ActiveX appears to need Unicode. ActiveX being developed under Win98.
QUESTIONS:
Where do I go from here??????
Thanks
David
|
|
|
|
|
Are FSCTL_GET_NTFS_VOLUME_DATA and FSCTL_GET_RETRIEVAL_POINTERS0 valid as dwIoControlCode for DeviceIoControl() on NT4?
The reason I ask is that the Platform Documentation incdicates it is only available on Windows 2000 and XP. However, the include file "winioctl.h" indicates it is available on NT4 and above.
Which is true ?
Can someone verify it on NT4 please.
Thanks
|
|
|
|
|
I have this cd burning app that I have been working on.
I added a dialog to show progress along the way. Now
this dialog implements a interface and these methods
are called during the burn. (These methods are callbacks
that windows calls duriing the burn. So surely they are
called from a different thread) I added some members to
represent the controls on this dialog, 2 CStatics and
a CProgressCtrl. I added the DDX_Control stuff. Now
I know that I am not supposed to work with a control from
different threads other than the one it was created with.
If that is the case how do I set the window text and the
progress step from these methods?
Thank You
Bo Hunter
|
|
|
|
|