|
Hi,
Check out my Registry class.
You can find it on www.xfcpro.com under the "Free Stuff" section, the funtion you want is EnumerateValues().
Feel free to steal the function, use it as a basis for your own or whatever.
regards,
Jonathan
|
|
|
|
|
Not sure what the correct etiquette is here but thought I would post to say thanks, I appreciate the leg up.
|
|
|
|
|
no problem
|
|
|
|
|
|
How to call virtual method at CWnd derived class,
- with mutual inheritance?
that is:
I create commin class with virtual method,
make it parent of some CDialog derived class,
than when a Want to call I assign pointer to CDialog to
that common class, and call virtual method -
and
access violation ERROR !!
why so happens?
where I did error ?
code is
<br />
<br />
class CCustomUpdaterTrait<br />
{<br />
public:<br />
virtual void CustomUpdate()
{};<br />
};<br />
<br />
class CDialogDerived: public CDilogBitmap,public CCustomUpdaterTrait<br />
{<br />
<br />
<br />
};<br />
<br />
class CCustomUpdaterCaller: public CCustomUpdaterTrait<br />
{<br />
<br />
f(CWnd* pWnd)<br />
{<br />
<br />
CCustomUpdaterTrait pTrait = (CWnd*) pWnd;<br />
<br />
<br />
pTrait->CustomUpdate();
<br />
};<br />
};<br />
<br />
thanks
|
|
|
|
|
Dear all
Can anyone please tell me how to use the stretch command in cximage for printing??
Thankyou
|
|
|
|
|
howto do a splitter in mfc without using views?
example: Dialog App
Leftside Listctrl
Rightside Treectrl
Bottom Listbox
|
|
|
|
|
AFAIK, CSplitterWnd::CreateView() can be called with a pointer to any CWnd-derived class instead of only a CView-derived class.
And I seem to remember that somewhere on CP is an article describing how it works. Probably in the Splitter-Window section. I am just too lazy to search.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I'm experimenting with debug tool to report memory leaks. The idea is to create substitute for new and delete operators. I'm using a template function New, and a macro NEW (different for debug and release).
Example below:
<br />
#ifdef _DEBUG<br />
#define NEW(t) (t)*New<t>(__FILE__,__LINE__)<br />
#endif //#ifdef _DEBUG<br />
<br />
template<class T> T* New(char * File,int Line)<br />
{<br />
T* Pointer=NULL;<br />
Pointer=(T*)new T;<br />
... other code ...<br />
}<br />
This works perfectly for calls like:
<br />
int * a = NEW(int);<br />
int * b = NEW(int[10]);<br />
But the problem is dynamic size of arrays. In this case compiler cannot create template function for types not known at compile-time. So call like this one will not work:
<br />
int a = 10;<br />
int * b = NEW(int[a]);<br />
The error (in VC++ 6.0) is:
error C2540: non-constant expression as array bound
Any ideas of redefining the macro or the function to accept array size as a separate argument?
[ CoY0te ]
Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.
|
|
|
|
|
No HTML tags this time. The code again:
#define NEW(t) (t)*New<t>(__FILE__,__LINE__)
template<class T> T* New(char * File,int Line)
{
T* Pointer=NULL;
Pointer=(T*)new T;
.....
)
Hoping for any help...
<b>[ CoY0te ]</b>
<small>Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.</small>
|
|
|
|
|
Aside from sourceforge.net, there are two link to open source C/C++ resources, both are good stuff:
TLTOOLS
Data Analysis Framework
Enjoy programming C/C++!
|
|
|
|
|
thanks man.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi
I'm working on an MFC application, and I need to make changes to some of the menus.
I use the resource editor or edit directly in the resource file. When I for instance
change a menu name, I notice it is changed in the resource file, but it is not changed in the running exe file.
It is only menus that has this problem. When I change something in a dialog, in the same resource file, changes are immediately shown when running the build.
I find this very strange, any help will be greatly appreciated.
Best regards,
Oliver
|
|
|
|
|
Are all your resources in the same language?
We had "issues" at one point with strings in ENGUS and ENGUK blocks, and sometimes they would fail to load.
Steve S
|
|
|
|
|
Thanks,
But yes, they seem to be in ENGUS all of them.
Best regards,
Oliver
|
|
|
|
|
Where can it get the "old" strings from ?
I can't find the old menu names anywhere in the code,
and it must be using the resource file, since other changed parts of the file are being used.
How can I force it to update ?
I have tried rebuilding all and deleting the .res file...but it didn't help.
Regards,
Oliver
|
|
|
|
|
Is it cleanly compiling the RC file?
You could quit VC6, remove the .res and .aps files (the former will be in your Debug/ or Release/ folder, the latter in your source directory, then try building those.
The APS file is a hangover from the days of 'Application Studio', I think, when the IDE didn't include a resource editor in the same environment.
Steve S
|
|
|
|
|
Thanks.
I tried removing the .res and .aps files, but without success. All obj files seems to be up to date.
But now I've tried building the project on my home computer, and here there are no problems. Everything is working fine. So maybe it has something to do with the project not being set up correctly in VCC...
Best regards,
Oliver
|
|
|
|
|
hello , how can i set float precisoin in mfc ? I get like this format ex. 1.500000 what i want is to print just 3 number after the decimal point .
my code :
CString temp;
float price =20.570;
sprintf(temp,"%f",price);
i got this 20.570000 how can i make the decimal point print just 3 number like this
20.570 and thank you .
|
|
|
|
|
double d = 1.5000000;
CString str;
str.Format("%.3f");
or
printf("%.3f", d);
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
I am currently working on a small app that I hope to make partly a combination of a basic word processor with an Explorer-like tree. Thus, on the left there is a tree view and on the right there is a Rich Edit box. The tree view represents virtual "documents" in a virtual filing system. By clicking or right-clicking in the tree view, you can select or create a new virtual document. The currently selected document should be shown in the rich edit box on the right, which can be typed from scratch or edited etc.
I am using the straight Windows API SDK with _no_ MFC, and I am still a relative novice code - after a few small apps, this is my first attempt at writing a piece of software I would really like to use, so please forgive me for asking basic design questions, but here goes:
1) What is the best way of associating the text in a rich edit box with a tree view item? I was initially thinking of associating a string (Rich Edit) with an HTREEITEM, as I have used this method before, eg:
<pseudo code="">
HTREEITEM tr1, tr2, tr3;
char* str1, str2, str3;
if(tree_item_selected == tr1)
{ ShowRichEditText(str1); }
..er, etc.
Obviously, though, this is fundamentally flawed as it would mean that there would have to be a limit to how many HTREEITEMs -and therefore documents - the user could create. In other words, I would have to create a set (large) number of strings, and the same number of HTREEITEM pointers to use this method. I would probably have to create a thousand strings or HTREEITEMs or so to make sure the user didn't run out. Could someone please suggest a better way of doing this? In essence, I just need to be able to associate an arbitrary number of strings containing RTF text with an arbitrary number of HTREEITEMs. Sorry if this is a fairly stupid question.
2) If (1) is achieved, how would I then save it to file? Would I be able to save the info as a struct or some such and just use CreateFile() and WriteFile(), or would I need something more complicated to hold this sort of info?
Many thanks to anyone who can give me some tips, pointers, or directions to non-MFC examples, and even more thanks to all those who have put up with my newbie questions and given me help over the past couple of months.
Cheers,
KB
|
|
|
|
|
OK, I'll bite; it's not like I was busy or nuffink.
A tree view item can have an arbitrary piece of data associated with it. This is not predefined or limited to what it can be (outside the fact it's an LPARAM in size). This means it can be the index in an array of CStrings, or a pointer to a CString, or anything you want it to be.
When you select a tree item, you can then ask what it's data is, and use that as the basis for locating/displaying.
There's a caveat. You might need to manage the freeing of such data when items are deleted from the tree, either all at once, or one at a time. Experiment in DEBUG mode if you're using MFC and you'll find out if you've new-ed without a delete, although reading the documentation could tell you as well
Steve S
|
|
|
|
|
Hello.
I would like to set the paper size (A3,A4...) and orientation(landscape..) with code.
Any ideas?
|
|
|
|
|
DEVMODE. You could try looking on MSDN for "MFC and landscape" for a few hints
Steve S
|
|
|
|
|
And how do i set DEVMODE members?
|
|
|
|