|
Hi everybody,
like some times before i have a very strange behavior:
I add lines to the header : Error
I switch some lines : No Error
Now i have a same case:
class MyView
{
DECLARE_DYNCREATE(.....
public:
MyView(....
~MyView();
public:
enum { IDD = IDD_MY_VIEW };
#ifndef _DEBUG
...
#endif
public:
virtual void DoDataExchange(...
DECLARE_MESS...
CFontStatic lbInfo;
CButton btOk;
CSxGroupBox gbSelect;
CFontStatic lbOne;
CFontStatic lbTwo;
CFontStatic lbThree;
CFontStatic lbFour;
i get an error during the SubClassing of lbOne during DoDataExchange
CFontStatic lbInfo;
CButton btOk;
CFontStatic lbOne;
CFontStatic lbTwo;
CFontStatic lbThree;
CFontStatic lbFour;
CSxGroupBox gbSelect;
NO ERROR
CSxGroupBox gbSelect;
CFontStatic lbInfo;
CButton btOk;
CFontStatic lbOne;
CFontStatic lbTwo;
CFontStatic lbThree;
CFontStatic lbFour;
I get an error during AfxCallWndProc
CStatic gbSelect;
CFontStatic lbInfo;
CButton btOk;
CFontStatic lbOne;
CFontStatic lbTwo;
CFontStatic lbThree;
CFontStatic lbFour;
If i replace CSxGroupBox with CStatic i also get NO ERROR
i don't really understand how this effect occurs.
The View "MyView" does nothing, no char array which could overflow
And there are also no other views/funtions before the opening of this MyView
which manipulates arrays or other operations which could provoke an overflow
Does any one know the problem or has some times the same effect?
Big thanks !
|
|
|
|
|
Just a guess but I'd say CSxGroupBox is overwriting memory that doesn't belong to it, probably in the constructor. That's where I'd look to start with.
Just a tip: Calling your post VS.NET error makes it sound like a problem with .NET which belongs in the .NET forum or a problem with Visual Studio which belongs in the Visual Studio forum. This might explain the slight lack of response. Dialog crashes in DataExchange or C++ Subclassing problem might have been more appropriate.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Ok, i will check the code of CSxGroupBox
Thanks for your help
|
|
|
|
|
hi i am copying a file to user desktop. the user should not edit or open or delete the file. how to do this in mfc.
-- modified at 7:17 Thursday 21st June, 2007
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: how to do this in mfc.
Change the file's access permissions via the ACL. The solution has nothing to do with MFC.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a project used CFileDialog, the icon color is just 16 colors, but in another project it is 256 color icon.Does anyone know how to make CFileDialog to show 256 color icon?
Thanks!
|
|
|
|
|
What icon? CFileDialog wraps the Windows common file open/save dialog. What icons are involved
with that?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
What I mean is the toolbar button: Up One Level, Create New Folder and View Menu button.These buttons are 16 colors, but in office word, excel they are 256 colors.
|
|
|
|
|
The dialog in Office is customized. For info on customizing these dialogs, see
Open and Save As Dialog Boxes[^]
I'm not sure how much is documented about changing the explorer-style dialogs, especially the
toolbar.
On XP, if you add themes to your app with the appropriate manifest, you'll get the look identical
to the file/open dialog in IE...see
Add Windows XP Theme Style to your current projects[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Hi everyone,
Is there any API to determine whether the given IPAdress belongs to public or private network. I have used the IPAdress series to determine the type of network,now i'd like to be more specific as far as the API is concerned.
thanks in advance...
sasi...
|
|
|
|
|
What do you mean by Private or Public ??
Be Specific..
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
Private: If the IPAdress which i want to communicate is with in any LAN(i.e 192.168.1.2, 192.168.....).
public: if it is not connected to the LAN(i.e 225.240...).
These are all private IP addresses:
From 10.0.0.0 to 10.255.255.255
From 172.16.0.0 to 172.31.255.255
From 192.168.0.0 to 192.168.255.255
|
|
|
|
|
Is there any way to paint the title bar with custome image even if the theme service is not running.
thanks
|
|
|
|
|
Look for examples of handling WM_NCPAINT and WM_NCCALCSIZE. It is posible but 'discouraged' so the docs and examples are a bit sparse. I wouldn't attempt a full custom title bar at the first pass, there's a lot more there than we generally think about, but if you can reach the point where you're intercepting the drawing and then calling all the bits to make a 'normal' title bar appear as if you weren't interfereing at all, then adding your own custom image should be easy.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I have a little desktop utility running and developed by me in my system. A few of the context menus sometimes randomly show up child menus (unrelated to this application).
For example, if one context menu of my utility is
Launch IE
RSS Viewer
Save As XML
intermittently I get a child menu for Launch IE (the first menu item). Mostly the child item reads
Cut
Copy
Paste
I do have a few other my own MFC based utilities. I have tried to debug my applications using all other tools under the sun. But I am not sure from where on earth, the context menu is suffering this anomaly.
Any clues?
|
|
|
|
|
Sorry for my poor English.
Are you develop in multiple documents ? The menu will change according to the different view in multiple documents .
|
|
|
|
|
How can i use a non static member function as WindowProc ?
thanks
|
|
|
|
|
See the answers to this[^] discussion.
|
|
|
|
|
Basically, you can't.
The prototype for the window procedure is:
LRESULT CALLBACK WndProc( HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
There's no way you can make a non-static member function with the same prototype because non-
static member functions require an object of the class' type to call them. This object is
passed implicitly as the "this pointer" to all non-static methods. The Windows APIs
know nothing about our C++ objects so there's no way the system could properly call our
class methods.
In addition to Cedric's link, take a look at the MFC source code and see how MFC handles it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
There are several ways to access files when coding in visual C. We could use CFile, or FILE* or fstream. Which one is the best in term of performance and stability ?
What's your opinion ?
I used to think that CFile would be the best choice when we work with Windows (because it was written by Microsoft anyway).
But actually it's not. I have an application that do intensive disk read/write (it reads files from hard disk about 20 times per seconds) and I have checked it thoroughly to make sure there is no read/write conflict. If I use CFile, there is chance of about 5% it returns an error that it can't open file (mode: binary read) while the file is obviously available. If I replace that part with FILE* pointer (i.e. use fopen & fread) then It runs perfectly all the time.
|
|
|
|
|
FILE* and fstream are good for cross platform stuff. FILE* is at a lower level than fstream and doesnt include the formatting and type conversion functionality.
CFile is just a wrapper around the win32 native file io methods (CreateFile() etc) which is based on HANDLE's
You have the soure code for the CFile class so you could debug it and find out why its failing
|
|
|
|
|
Ultimately they are all wrappers around the same IO code. CFile is an MFC wrapper over the File APIs which are implemented using the internal copy of the C Library's FILE based system. 'fstream' is from the Standard Library implementation which is integrated with the User Mode C Library e.g. MSVCRT.dll so it ultimately uses FILE io blocks and the same low level code.
With every layer of wrapping you get more convenience features and potentially more bugs. So you pays your money, in terms of ease of use, and you takes your choice.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks,
anyway, it's also a common sense to assume that things that were written earlier are buggy and later people not only improve functionality but also fix bugs to make them better
|
|
|
|
|
Hmm, with CRT code I think its almost the other way around. It's so old and has been hammered by so many millions of users and developers that its been refined by attrition to the point where it is both borderline unreadable gibberish and almost bulletproof as well.
It's a kind of software aging where it has got both tougher and crustier with each round of modifications. MFC on the other hand has taken the work arounds approach where some of it has been broken for a decade, e.g. CSocket, with no proper fixes available because it's assumed everyone will use the documented work arounds or alternatives. Newer code isn't always better and wrappers don't always add reliability but we can hope
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|