|
what is private & static function in MFC.
how it can be used in Visual C++.
what i need to do if i want to used the same filename in every block of programming like:
CMyPsmDlg::OnButtonBrowse()
{
//i get a filename using GetFileName()
}
CMyPsmDlg::OnButtonEncrypt()
{
//i want to use the same filename in above blok of function
}
HelpMe
|
|
|
|
|
private and static are C++ concepts, and nothing to do with MFC per se. You need to get a good C++ book and figure out some of this basic stuff before working with MFC. The following URL is a good place to begin : http://www.parashift.com/c++-faq-lite/[^]
Regards,
Nish
|
|
|
|
|
whenever Nish is right saying you should learn C++ first, i'll give it a go, so that every one can share.
as you certainly know, private members can be used from within the class only. private data members can be used only by member functions of the class, and private member functions can be called only by other member functions of the same class.
static only means that the function don't get the implicit this pointer parameter which is caracteristic of the non-static member functions. a static member function can only access static data members so, because they are not proper to an object but shared commonly by all the instances of the class. this have nothing to do with the scope, and nothing forbids a private member function to be static.
it will be able to be called only by member functions (as it is private), and will access only static data members (because of its static state).
don't make the confusion anyway, MFC is not a specific language. everything done inside MFC is pure C++. MFC simply provides some classes and functionnalities to ease Windows programming.
hope this helps...
|
|
|
|
|
In the header file for your dialog class, declare a member variable of type CString to save the filename:
class CMyPsmDlg : public CDialog {
CString FileName;
};
void CMyPsmDlg::OnButtonBrowse()
{
FileName = GetFileName();
}
void CMyPsmDlg::OnButtonEncrypt()
{
}
Software Zen: delete this;
|
|
|
|
|
what made you compare private and static functions?
private , protected and public are access specifiers. and on the other hand when a function is said static , it is STATIC, in the sense, its not intialized a new when New objects are created. but no matter it is private, public or protected , a new instance of those functions are created for the Object. static functions remain same no matter who calls it. it's acessed by :: instead of a . or ->
VuNic
|
|
|
|
|
Hi,....
How do we add HOTKEY to an application runing in the system tray..the application is written in SDK....The application is "Magnifying Glass " by
"Alex Fr "....I want to use this application...and i want to add HOTKEY to this application so that i can activate the Application by HOTKEY instead of MouseClick.Please help me thank q.............
James Rocky.
-- modified at 11:08 Tuesday 7th March, 2006
|
|
|
|
|
|
Yeah i know the functions to use but....i don`t to use them the "Magnifying Glass" application the URL is :
"http://www.codeproject.com/dialog/magnifyglass.asp"
can any one help me ....
-- modified at 11:52 Tuesday 7th March, 2006
|
|
|
|
|
I'm writing and reading formatted io to a file using fopen, fscanf, fseek and fprintf. Even though I'm fprintf'ing the same formatted floats and int's each time to line #1, the varying size of the numbers makes it difficult to position the file pointer at the beginning of the next line, line #2. I'm using only the first 2 lines in the file, the line #1 for status that I write and line #2 for requests that I read and overwrite depending on the data.
My general question is:
How can I reliably position the file pointer at the beginning of the second line for reading (and writing) regardless of the varying length of the first status line.
|
|
|
|
|
ronwurster wrote: Even though I'm fprintf'ing the same formatted floats and int's each time to line #1, the varying size of the numbers...
What does the fprintf() statement look like?
ronwurster wrote: How can I reliably position the file pointer at the beginning of the second line for reading (and writing) regardless of the varying length of the first status line.
Read the first line, and then the file pointer will be positioned at the beginning of the second line.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I would like to explain that I haven't used formatted file io much with C. Hence my ignorance about the different methods for doing this sort of thing.
I've changed the printf to use explicit formatting characters which allow me to maintain a fixed length line. So, I can now predictably "fseek" the position of the 2nd line. My fprintf line now looks like:
fprintf (stream,"%8.3f %8.3f %c %c %8.3f 4d", floatvar1, floatvar2,
charvar1, charvar2, intvar1);
However, I tried reading the first line (using fscanf) and the pointer was NOT positioned at the beginning of the second line. In fact it was not on the 2nd line at all. Did you mean I should use "fread"? Can you explain please.
Thanks for your help
|
|
|
|
|
ronwurster wrote: However, I tried reading the first line (using fscanf) and the pointer was NOT positioned at the beginning of the second line. In fact it was not on the 2nd line at all. Did you mean I should use "fread"? Can you explain please.
char szLine[128];
fscanf(pFile, "%[^\n]\n", szLine); You can also use fgets() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Dumb ideea..but here goes:
for getting the second line start position
1. do a fseek to SEEK_SET
2.do a read the entire first line (fgets )
you are now at the end of first line->beginning of the first.
I don't know if this will work for you (it gets you to the seccond line but i don't know it it is suitable for your code).
Another ideea is to use predefined spaces for your numbers: fprintf(file,"%7d",24)uses 7 spaces(don't know if spaces is the appropiate word) to print the number 24 and alings it to the right. So, if you know how many numbers you have on the first line and you use enough spaces so they don't overflow...you will know the length of the first line which enables you to reposition to the begining of the second line.
Don't know if this helps (sorry for my english...it is not what i hoped it to be )
|
|
|
|
|
pad is a file for submiting software.
I have tested for several, but all are ugly.
which pad file creator do u use now? which one is better?
thx
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Even though this is not C++ related, I always created them by hand...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hands are the best.
by the way, what sites (forums) do u use to submit ur software for free? (not paid sites, such as www.downlod.com etc)
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I no longer use shareware sites - my key algorithms were never even touched until I put the software up on shareware sites. Check Favorites had a keygen within 3 days after I put it up on ~5 sites, and static keys started appearing for Delete FXP Files within 5 days or so (no keygen, though).
So, never again...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
How can we rotate a 2d line in 3d to get a cone or can anyone point me to any useful resource on this (Open GL).
Thanx in Advance ,
Regards,
FarPointer
|
|
|
|
|
OpenGL is very special, I think u should post ur Q on a OpenGL forum.
good luck.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Hi,
I couldnt Find OpenGL Forum in CodeProject you got a better idea were i can .
Regards,
FarPointer
|
|
|
|
|
This really isn't OpenGL specific but is just trigonometry. Decide on how many points you want to use in your rotation. For each point on the line you want to rotate it 360 degress around the z-axis. Decide what your delta theta is. For each point you will loop from 0 to the number of points and create a vertex as follows:
glBegin( GL_QUADS );
for each point on line
for each delta theta
x1 = x * cos(theta);
y1 = y * sin(theta);
z1 = z1;
glVertex3f( x1, y1, z1 );
glEnd();
I hope this helps you get started.
Deus caritas est
|
|
|
|
|
FarPointer wrote: How can we rotate a 2d line in 3d to get a cone or can anyone point me to any useful resource on this (Open GL).
actually, you are making it too difficult. OpenGL relative to order of operations. So assuming you want to rotate a line 30 degrees you go from this:
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(50.0f, 50.0f, 50.0f);
glEnd();
to this:
glPushMatrix();
glRotatef(30.0,0.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(50.0f, 50.0f, 50.0f);
glEnd();
glPopMatrix();
although the glPushMatrix() and glPopMatrix() are not required operations if you draw another primitive it is relative to the last rotate, push and pop operations restores the rotation matrix to prior to the rotate so that another primitive is relative to the original scene-view not the last rotation.
see this tutorial over at Nehe: Nehe OpenGL tutorial on Rotations[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Might be a little late for this reply, but...
If you want to display a cone in wire or solid form, include glaux.h, and call either auxWireCone(radius, height) or auxSolidCone(radius, height).
If you want to construct a cone on your own, you'll need the mathematical formula for a cone and some code to draw the triangles that form the cone (GL_TRIANGLE_STRIP), and the base of the cone (if desired, also GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN).
In either case, you can call glRotate before drawing the cone, to get the desired orientation of the cone.
delete this;
* poof! *
|
|
|
|
|
Does anyone know an easy way to overcome the problem with the SRT_MAX limit of scrollbars?
-- modified at 12:08 Tuesday 7th March, 2006
|
|
|
|
|