|
I am not sure how easy that would be to do in code, but I would just suggest running ChkDsk, and letting it map around the bad sector.
Peace!
-=- James.
|
|
|
|
|
Hi There,
I'm developing a dialog based application. As Application starts it shows some data in editbox. I wanted to create one more dialogbox from here which display selected substring in the EditBox from my main dialogbox. An example of this is when you press Ctrl+F in wordpad and you have some selected string in opened document then Find-box display that string as it shown up
Thanks for taking time to write in.
-- Sumit
Please make a CC to me sumit@elitecore.com.
|
|
|
|
|
If it is retrieving the selected text what you're having difficulties with, take a look at CEdit:GetSel .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I´m testing my application in several platforms, I report mode I use Word in a view and with automation I create my reports...
The problem that I have is that I´m trying to use that with XP ( and office 2002), and when I close the word window, then the whole application is closed, do you now if something has been change and makes it not work right with the good old MFC...
Thanks, Bye !
Braulio
|
|
|
|
|
Hello everybody!
I have the object CRectTracker m_tracker in my Modal Dialog and I need set the cursor for him.
But this code not work (cursor is invisible). Why?
BOOL CMyDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (pWnd == this && m_tracker.SetCursor(this, nHitTest))
return TRUE;
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
Best regrads,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hi Eugene, maybe your CRectTracker is not being able to load the cursors, as it seems to be the case under some circumstances when you statically link to MFC: try selecting the shared DLL version of MFC --if I'm right then the cursors should now show.
If this is indeed the problem, take a look at MSDN article BUG: BLOCKS32 Sample Fails to Show Cursors when Linked to MFC (Q208856) which describes a program having the same problem and a way to solve it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Many thanks for the help!
All and was, as you have written.
Has already corrected also all has earned!!!
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hello all,
I was just wondering about the typical difference in usage between type BOOL and bool. Within the Windows environment, the BOOL is an unsigned integer. When using data-structures you find the bool used iso BOOL, which is put inside a kind of bit-array by the compiler. This is of course logical due memory usage, since the BOOL takes in Win32 4 bytes.
Is there any reason to use the BOOL over the bool type definition?
Thanks in advance,
EiSl
|
|
|
|
|
bool is a C++ keyword (which BOOL is not) and refers to a built-in C++ type (does not exist in C) for boolean values. In the particular MS implementation, bool is 1 byte wide, which could matter if memory efficiency is highly valued. Nevertheless, the main reason to prefer bool over BOOL is type efficiency: you cannot do any funky integer arithmetic with bool s, like adding or multiplying them, which is good. To sum it up, I'd use bool if:- I'm programming in C++ (does not work in C)
- I'm not dealing with a previous piece of code that uses
BOOL s (like the API definitions in <windows.h> ), and use BOOL in the remaining cases.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
another question:
why should i use
if (pointer == NULL)
and not
if (pointer == 0)
is there any difference between those two ?
is this historically?
does NULL has got any advantages?
thanks in advance
bernhard
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|
|
Well, I'd tend to use the second form (if (pointer == 0) ) because "0" is the standard name for the null pointer since C was invented. NULL is a macro of dubious reputation included in stddef.h and stdio.h , altough MS folks also provide it in windows.h for your convenience.
Why do I prefer unadorned 0 instead of NULL ? Most of the time it doesn't really matter which syntax you use, and NULL is admittedly a bit clearer, but the problem with this macro is that its definition can vary from compiler vendor to compiler vendor (some define it as a bare 0, others as ((void *)0) ). Worse yet, as this macro tends to be defined independently by different library writters (as it is the case in windows.h ) ocassionally you can end up with different NULL definitions across compilation units. In extreme pathological situations this can make a difference.
Another, more practical, reason to prefer 0 over NULL is that you don't have to rely on any previously included header.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thank you for your quick answer..
the only reason why i'm asking this is that most of the programmers with c - background i know use the NULL for pointers.. i just use 0 and wanted to ask, before i make a real flaw all over my code (i am a little bit a pointer-o-holic)
thanks
bernhard
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|
|
Using NULL or 0 is basically a style issue of religious proportions. After reading your message, I did a little research on NULL and 0. Here are some interesting facts.
1. NULL is usually defined as 0 or ((void *) 0). The later being an valid alternative to help prevent people from doing stupid stuff like assigning NULL to a non-pointer variable. This is in fact not at all portable.
2. When NULL and 0 are used in the context of pointers, they don't actually mean that the pointer is zero. The C and C++ standards state that the actual value stored in a pointer to represent NULL or 0 is machine depended and need not be zero. It is the compiler's job to make sure that comparisons against NULL or 0 perform the proper tests.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I agree with you in that this is a very tiny issue that receives a disproportionate amount of interest. With respect to your fact #1, there's an interesting associated problem: the following line of code
char *p=(void*)0; is legal C, but illegal in C++, as this latter language forbids implicit casting from void* to any other pointer type, due to type safety reasons. So even this seemingly innocent definition for NULL has unexpected side effects.
This surprising fact and a lot more info about the null pointer you can find it on Stroustrup's The Design and Evolution of C++, §11.2.3.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ah, good point that I forgot about.
I found this in WINDEF.H.
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
I need to check that reference out. Thanks.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
As has been said, BOOL exists for C API programming, where no bool exists. It is a BAD idea to use it if you can avoid it. To get rid of warnings when converting BOOL to bool do this:
bool bResult = (::SomeDodgyAPIFunction()>0);
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Really ? I've not noticed that.
In any case, one should not program poorly because Microsoft tools are broken.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
That's what I thought it would do, I find that perfectly readable ( and it's the same as BOOL, except BOOL can use any non-zero value for true in theory ).
The easiest way I can think of to trace bool is to write a bool handler for IOStreams that prints the word true or false, and then use ostringstream to format a string before tracing it. ( This is also safe, which sprintf ISN'T ).
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
how to enum all loaded modules ?
thanx
|
|
|
|
|
For NT/2K/XP systems only, there exists an SDK library called PSAPI including the function EnumProcessModules that seems to do what you want (check it out here).
For 9x/ME (and optionally all of the other systems except NT), the way to go is using the ToolHelp32 functions (in KERNEL32) CreateToolhelp32Snapshot , Module32First and Module32Next .
All of this is bundled into a single sample executable (for both families of OSs) MODLIST.EXE offered by Microsoft which you can have a look at here. It's written in VB, but I guess you can easily port it to VC++ (you might even post an article with the results here in CodeProject )
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanx , but i know that , i needed a way to enum all modules that are currently loaded and not by a individual process
thanx again
|
|
|
|
|
If you already knew that, then you're almost there! Iterate thru all active processes with EnumProcesses (if using EnumProcessModules ) or Process32First and Process32Next (if you're leaning toward the second approach).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
once again , thanx
i will try that..
|
|
|
|
|
|
Hello All,
Working on image lists, my attention was drawn to *.icl file extensions. I was told it is simply a resource DLL with only icons, which means I could also create it by creating a DLL and renaming.
Is there any more I need to know about the *.icl file extension?
Why is it used intead of the *.dll extensions?
Someone called it the Icon library file, is this correct?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|