|
|
I would really appreciate it if someone would give me a little help with trying to get my program to save the state of the toolbars when I exit. I am using standard MFC generated CToolbar objects and calling the GetToolBarCtrl function to access the CToolbarCtrl functions and trying to use SaveState. Following is my code. The SettingsRegKey is a Cstring with the path to my program in the registry that already exists although the value the SaveState function is supposed to add does not. Any ideas why it is not working? Thank you very much
CString SettingsRegKey = _T("Software\\Star\\Star\\Settings");
m_wndStandardToolBar.GetToolBarCtrl().SaveState(HKEY_CURRENT_USER, SettingsRegKey, _T("Standard ToolBar"));
|
|
|
|
|
Hey!
I've got a plugin system working in my app and it works
great. One thing I'd like to be able to do is to have
some of the plug-ins automatically doc themselves to
the app window (like a toolbar). I've tried several
methods, but haven't figured it out yet.
Any help?
Steve The Plant
|
|
|
|
|
I think I wrote that question too quickly.
I guess it would help to say that I'm working in MFC. And
that each plugin is stored in a DLL. So, that means I wonder
if there's a way to dock a toolbar (that's basically just
a CToolBar or Docking Dialog bar) stored inside a DLL onto my
main app frame.
I've tried passing the window handle and the actual pointer
of the main frame to the DLL and then trying to dock the
toolbar (contained inside the DLL), but it doesn't work. I
get assertions and other errors.
I do call that AFX_ function (forgot the name since I'm
not at work) inside each DLL function before doing anything
in MFC. Does anybody have any suggestions? Ideas?
Steve The Plant
|
|
|
|
|
What kind of DLL it is? Is it an 'extension DLL' (sharing a copy of MFC with the app) or 'regular DLL'?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
It's just a "regular" DLL. The Toolbar stored in the DLL would
be created and docked at runtime.
Steve The Plant
|
|
|
|
|
You should consider using 'extension' dll - they should just snap into main exe and whole system would be one app from MFC point of view. Exe and dlls would share global maps used for mapping HWNDs to CWnds, etc. This makes passing CWnd pointer around possible. You can't achieve that with 'regular' dlls - the dll doesn't know that exe uses MFC and vice versa.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
We are having a problem with the use of rich edit controls in a project.
The rich edit control seems to work fine with the debug build. However, the text gets distorted (the font changes and also its size) in the release build.
Any pointers?
Thanks!
|
|
|
|
|
I fixed it!
|
|
|
|
|
I am building application in Win98 using RichEdit it works
fine on Win98,Win95 and Win Nt 4.0 but it gives the
follwing problem in Win 2000.
My program uses a font which has a accent like charecter.
What is accent charecter?
Accent char is a char drawn on a main char like (A`)
here main char is "A" and accent char is "`" drawn on top
of "A".
Now combained main and accent char is one char.
In Win95/98/NT 4.0/ it works fine but in Win2000 I am
seeing the following display problem:
Whenever a accent char is diplayed in Win2000 I am seeing
an Extra space. (example: this should displayed like "A`a"
instead in Win2000 it displayed like "A` a")
Here is how to reproduced the problem:
To reproduce this problem I am attaching a TTF font(which
is availabale for free from www.tamilnet99.org)
0) download font from: http://www.tamilnet99.org/font.htm
1) Install TABAnna.ttf into Win98 and Win2000.
2) use Charecter Map tool and choose the main charecter
says ("a")[U+0061] then choose the dot char (.)[U+00A2]
(i.e third char from "~")
3) Now it will display "a" and "dot" on top of it.
But if you choose one more char (say "b") now you will
see the extra SPACE between charecters.
4) It should be:"a(dot on top)b"
but itdisplayes: "a(dot on top)<space>b"
5)From charecter map tool copy and past the string to
WordPad it also shows the extra space between chareters.
6)Even a simple MFC (generated) program which uses
CRichEditView shows this problem.
7)Copy/past to MS word it looks FINE
8)If I display the string in a dialog, Edit Box or combo
box it looks fine.
Again this diaplay problem appears only of Win2000 not on
Win98 or Win NT 4.0.
NOTE:
This is not a UNICODE program and enableing and disabling
_MBCS does not make any difference!
Thanks...
Kalai
|
|
|
|
|
...on declarces one class and that class need needs a pointer back to the one that declared it.
I am working on a project that has two classes(named here as Root & Child). They are defined in the same header file an Child is defined before Root is defined. Root declarces Child as shown...
class Root
{
public:/*All memebers public*/
Child myChild;
/*Other memeber class, functions, and variables I want to access in Child.*/
}
Ok, now here come Child and want a point to Root so it can access Root's memebers. I define the class like this...
class Child
{
public:/*All memebers public*/
Root* pmyRoot;
/*Other memeber class, functions, and variables for this class*/
}
Now rememebering Child is defined first in the header when I compiled the project then compiler finds, while declaring the pointer to Root, that Root is undefinded. Same thing happens if the Root is defined before Child. The Child is only is going to be used by Root and won't be in a lib. for others to use so this dependent model is Ok(except for the pointer problem). I have tried using class reference forwarding and can up w/ the same undefining problem, but I am still new to class reference forwarding.
Is there way the to access a pointer back to the declaring Object?
|
|
|
|
|
try this:
in Root.h
class Root
{
public:
Child myChild;
}
in Child.h
class Root;
class Child
{
public:
Root* pmyRoot;
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Do da' phrase "spaghetti" ring a bell?
|
|
|
|
|
Great, that part works now I got to setup the pointer and use it. I will post if problems.
|
|
|
|
|
Is there a way to tell how many socket buffers are waitint for recv's at the Kernel level?
In other words, how many recv's are pending, ready for recv calls?
Thanks...
Thanks...
|
|
|
|
|
i am looking for an application that can print an HTML file without any promp dialog box, just print and that's it.i know it can be done with cHtmlView, but i don't know how to bypass the dialog box of the print.
if anyone has an application like that i would be happy to get it
thanks a lot
grospa
|
|
|
|
|
CHtmlView::ExecWB( IDM_PRINT, ...)
|
|
|
|
|
Has anybody else had this problem and if so how do you get round it.
I have the following piece of code
#ifndef Pi
#define Pi 3.1415926535897932384626433832795
#endif
#ifndef DEGS_TO_RADS
#define DEGS_TO_RADS (Pi/180.0)
#endif
double dCosine, dRotationAngle;
dCosine = cos(dRotationAngle * DEGS_TO_RADS);
In one perticular place the rotation angle is 90 degrees, and as I am sure you are aware the cosine of 90 degrees is 0. But in the above code the resulkt from the cos function is a very small number, 6.1230317691119e-017, but but this still is not zero.
Any Ideas
Cheers
AndyC
|
|
|
|
|
|
First multiply, then divide. This could have better precision, but it's hard to tell.
You are doing: angle * (pi/180)
(pi/180) is a small number, while 90 (angle) is not. Multiplying such different numbers could lead to loss of precision.
You could enhance results by doing: (angle * pi) / 180
This way 90*3.14 is comparable to 180, so you lose less precision.
Using double data type should also help.
Paolo.
|
|
|
|
|
Hello All,
I have a quick question.
I was wondering if there is an API to check if a given file (.DLL, .exe, or .OCX) is registered on the machine where the application is running.
Well, what I'm trying to do is: once my application starts I want to check if some files are registered or not, and use this information to do some setup for the application.
The other way to do this (at least what I thought of ) is to search the registry for each file, which I'm not really enthusiastic about.
Thanks in advance for your help
Fady Elias
|
|
|
|
|
You should use COM Categories to check for interfaces of a particular category.
Check out this month's MSDN Magazine - July 2001 p149
Ollie
|
|
|
|
|
Just try to instantiate the required object and check the return value. If it has not been registered you will get a "Class not registered" error.
|
|
|
|
|
instantiate? what do you mean with that?
would that work for all 3 file types : DLLs, EXEs, OCXs?
a couple of lines of codse would be great
Thanks
Fady Elias
|
|
|
|
|
The following declaration is from two header files for two classes.
Class Abstract
{
...
...
}
Class Specific : public Abstract
{
private
static const int m_nNumberOfColumns;
static const char* m_pszColumnsTitles[];
}
In the implementation file of each 'specific' class, the variables are initialised as
const int Specific::m_nNumberOfColumns = 2;
const char* Specific::m_pszColumnsTitles[Specific::m_nNumberOfColumns] = {"Account Number", "Account Name"};
As I have started to develop several 'specific' classes, I have come across a couple of
methods that should be implemented in the Abstract class like the following
for ( int i = 0; i < m_nNumberOfColumns; i++ )
{
InsertColumn(i, m_pszColumnsTitles[i]);
}
What protected data types should I declare in the Abstract class and how should I initialise them in the
specific class ctor, so that the above for loop could be put into a method of the Abstract class.
Suggestions gratefully appreciated. Thanks.
Chris
|
|
|
|