|
use the owner-data option to make freeing memory faster
Don't try it, just do it!
|
|
|
|
|
Then try this:
Override whichever function in your application which will be called before your main window(or frame) closes, for example, "OnCancel()" or "OnOK()" for a dialog based app, etc, then add just one single line of code into the very beginning of tha function body:
<br />
void CMyDlg::OnCancel()
{<br />
m_wndList.LockWindowUpdate();
<br />
}<br />
This should shorten your waiting time by at least 1/2.
|
|
|
|
|
Alright guys I need some help here.
I have incorporated the backgroud color control in my ListCtrl similar to this example:
http://www.codeproject.com/listctrl/lvcustomdraw.asp
I can make row #3 be red, row #54 be orange, row #357 be yellow, etc.
with something like:
if ( (pLVCD->nmcd.dwItemSpec) == 0 )<br />
crBkgnd = RGB(128,128,255);<br />
else<br />
crBkgnd = RGB(0,0,255);
I want the color to not be linked to the row number, I want it linked to the data in the first column of my exercise.
Like a grade sheet: If the value in column is >89, you have an A and you need a green background. If the value in the first column is <70 you have a F and you need a red background. That is all I want it to do. Please help me.
thank you.
I wish I could type better ...
|
|
|
|
|
why don't you just set the color on every single item of the row?
Don't try it, just do it!
|
|
|
|
|
Sorry about that I may have mislead you. I will be setting the whole row to a color, but I want that color to be associated with the value in the first column.
I wish I could type better ...
|
|
|
|
|
Ok, simple little problem here. I've got an edit box that takes an integer. I want to prevent trouble if a user enters something like
98 89
into one edit box. I've got it set up like:
DDX_Text(pDX, IDC_CH0_EDIT_FS, ch0_edit_fs_tq);
DDV_MinMaxInt(pDX, ch0_edit_fs_tq, 0, 99999999);
which doesn't allow for letters, but a user can still enter a space. Is there a way to fix this before the user hits ok? Or do i have to check the contents of the edit box before i output the value?
*.*
cin >> knowledge;
|
|
|
|
|
You'll need to derived your own class from CEdit, and override OnChar()to only accept numbers.
|
|
|
|
|
One solution is to add an onchange message handler and update the edit control accordingly based on its current content.
Kuphryn
|
|
|
|
|
If you only want positive integers, then set the ES_NUMBER style, causing the control to reject everything except digits.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Is there a protocol issue when Serializing data using Serialize method of MFC C++ over a TCP Socket to a Java App. If not how can this be done?
The model is: A java client connect a server written in C++ and Serialization of a Class or an Object containg data takes place. If you can help me I'll be very happy.
Cheers
Sean V
|
|
|
|
|
Hello, I'd appreciate any help.
Over the last two days I've been experiencing my source code files going missing, while I'm working on a project in the IDE.
I'm using Visual C++ 6with SourceSafe. I don't have SourceSafe Client running, but frequently, while developing in the IDE, when I double-click on a file in the Project Explorer to open it(always an implentation file) I get 'Project file .. does not exists. Do you want to get it from Source control?'
For some strange reason it's just disappeared from my hard -drive. I can restore it from SourceSafe but I've lost of the work I've done since I last checked in.
I always save my files regulary. Can anybody tell me if VC++ keeps temporary copies of files while I'm working on them so I can try to restore something.
|
|
|
|
|
The most common reason of *.h or *.cpp mystically disappearing is the "Norton anti-virus + Windows2000/XP" combo, it deletes your source files permanently from time to time when you are using class-wizard. And no, there is no way to solve this problem even if you tell Norton to ignore *.h and *.cpp.
Either Microsoft or Symantic MUST fix this, but so far neither of them did. The best solution at this moment is completely stay away from Norton anti-virus if you are working on Windows2000/XP.
|
|
|
|
|
Thanks! That is scary. Could be it, although I've been using the win2000/Norton Antivirus/Visual C++ combo for 3 years now. But I will shutit down now.
|
|
|
|
|
Hi,
Does anyone use a garbage collector in their MFC programs? If no, why not? Anyone with positive or negative experiences? What collector did you use? Thanks.
|
|
|
|
|
Nope. I don't like garbage collector, 'cause I prefer to manage myself the memory I allocate.
We do not inherit the Earth from our ancestors, we borrow it from our children - Antoine de Saint-Exupéry (1900-1944)
|
|
|
|
|
Based on my experience on VC.Net. If I were to use GC in my code.
I will need to wait for the GC to destruct (which is somehow unpredictable unless you write code to explicitly calling the GC). The C++ destructor will just destruct it when it exit the scope.
My code is neater and I know when I exit the scope, everything should be taken care of in the destructor like it will dellocate the pointer and server connection (if i were to place it in destructor) for me so that I have free memory and reusable resources.
This is not the case for using GC. You simply can't tell when is it ready for next operation.
Hope this is useful.
|
|
|
|
|
Hi all,
I am using the default property sheet of the MMC interface.
my question is how to change the property sheet title?
i only implement this method:
STDMETHODIMP CMyNode::CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,long handle, IUnknown* pUnk, DATA_OBJECT_TYPES type)
{
if (type == CCT_SCOPE || type == CCT_RESULT)
{
HRESULT hr;
CPage1* pPage1 = new CPage1();
hr = lpProvider->AddPage(pPage1->Create());
ATLASSERT(SUCCEEDED(hr));
return S_OK;
}
}
it works ok, i see my page within the property but the title the property gets is the same title is CMyNode....how do i change this default???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
is there any way how to get around the limit of maximum 64 characters of text in tray icon hint? I know that NOTIFYICONDATA has only 64 byte array, but what about displaying some other tooltip instead of regular tray icon hint that would support longer text?
Thank you for any suggestion.
|
|
|
|
|
no 'real' chance...
try to use an own tooltip window!
Don't try it, just do it!
|
|
|
|
|
Hi..
I made a VB6 DLL FileDownload.NetDown
Now I use this VC++ code to check if the component is registered
LPCLSID cls=0;<br />
HRESULT hr=0;<br />
hr=CLSIDFromProgID((LPCOLESTR)"FileDownload.NetDown",cls);<br />
<br />
if(hr==S_OK)<br />
AfxMessageBox(cls->Data1);<br />
else if(hr==CO_E_CLASSSTRING)<br />
AfxMessageBox("Bad ProgID");<br />
else if(hr==REGDB_E_WRITEREGDB)<br />
AfxMessageBox("Error");<br />
else AfxMessageBox("NONE");
I get the Message (NONE) !!!
I don't Get the Class ID or even an error .. How comes ?
NOTE:
I checked with regedit and the ProgID , ClsID Exist !!
|
|
|
|
|
If you actually check the value of hr, you'll probably find it's E_POINTER (0x80004003), because you're passing a NULL pointer.
You're trying to get CLSIDFromProgID to write into location 0.
The following may work rather better:
CLSID cls = { 0 };
HRESULT hr =
CLSIDFromProgID( OLESTR( "FileDownload.NetDown" ), &cls );
CString sMessage;
if ( SUCCEEDED( hr ) )
{
sMessage.Format( _T( "CLSID(1): 0x%08x" ), cls.Data1 );
}
else
{
sMessage.Format( _T( "ERROR: 0x%08x" ), hr );
}
AfxMessageBox( sMessage ); Key things to learn:- A pointer must point to some allocated space.
LPOLESTR is always a pointer to a Unicode string. Use the OLESTR macro to portably produce a compatible string.HRESULT s can be either success or failure - there are multiple success codes and multiple failure codes. To generically test for success or failure, use the SUCCEEDED and FAILED macros.- The documentation only lists common error codes, it does not show all possible error codes.
Hope this helps.
|
|
|
|
|
Hi! I'm writing an AV player app. So far it works fine on playing single files. However, when I create a 'playlist' and then try to loop through playing each file in turn, files open and load, but then do not play until the last in the list!! The routine runs along the lines of:
for(x=0;x
|
|
|
|
|
It's because you're running this in a loop.. it doesn't wait for the song to play/end, it starts playing the song then goes to the top of the loop and starts all over again until it gets to the last item in the loop.. you need have the loop wait until the song ends or even better yet in your timer function wait until the song ends.. then if another song exists in the playlist start it.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
I want to read version number and company name from RC File at run time.
How can i do this ?
Thanks in advance
|
|
|
|
|
If you mean "read version information from the resources of a module at runtime",
then you can use GetFileVersionInfo (...). You can even use it on the calling
module by using GetModuleFilename to get the path to use.
There is even an article "ShowVer.exe command-line VERSIONINFO display program"[^]
with example code.
If you really mean from an .RC file, then just read it as text and parse
it.
|
|
|
|