|
Is there a list of order function called?
I am new to MFC. I want to open a file and do some calculation and then display.
What function is called in between OnOpenDocument and CView OnDraw?
|
|
|
|
|
OnInitialUpdate in the View ?
Engineering is the effort !
|
|
|
|
|
Hmm I guess I will have OnOpenDocument to call a function since I only want to call it once to do the calculation.
Right now the calculation is called within OnDraw so it slows down the redraw on the screen. :/
|
|
|
|
|
Isnt onInitialUpdate also called just once ?
|
|
|
|
|
Not necessarily. For an SDI application, it can be called more than once.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Dynamic resizing of Combo
trying to just resize /scale the components on a proeprtySheet . I find that when I move the parent window , the down arrow icon for the Combo box vanishes ! Is there some type of setting ? Why would this be happenning ?
|
|
|
|
|
See if this control helps.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This site is amazing . IS it maintained by u ?
Engineering is the effort !
|
|
|
|
|
act_x wrote:
IS it maintained by u ?
No. See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
If I posted my C++ code could someone give me some assistance with it. For instance how to assign a floating decimal point in the answer. Or how to keep from putting in invalid entries and the option of typing in input with a copy for example now on 2000 can be typed. I want to be able to input 2,000.
|
|
|
|
|
BRIMID wrote:
If I posted my C++ code could someone give me some assistance with it.
That's what this forum is for.
BRIMID wrote:
For instance how to assign a floating decimal point in the answer.
Could you translate this into English please ?
BRIMID wrote:
Or how to keep from putting in invalid entries and the option of typing in input with a copy for example now on 2000 can be typed. I want to be able to input 2,000.
You want to type a , in a number only field ? You'll need to validate that yourself, i.e. start with a standard text box and do your own masking, then strip the comma when you assign the value to an int. Is it really worth all that to see a comma on your screen ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
BRIMID wrote:
For instance how to assign a floating decimal point in the answer.
Theres a special integer you call for floating decimal points... apparantly you know this, so to assign one simply set it up like any other char or int, and then use something like
cin/*insertredirectorshere*/floating.int
or
floating.int=entered.int
well, you get the idea, it's not too hard...
If I screw this up it's not my fault, damn Microsoft!
|
|
|
|
|
You want a masked edit control?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
can someone please help me with a problem i have with dll files.
i can call functions from the dll files i make but i was wondering how i could use the returned variable from 1 function in another function inside my dll file.
if anyone can help me i would appreciate it a lot.
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
Swatgod wrote:
i can call functions from the dll files...
Are they called from some other DLL or EXE, or are they called from within the DLL itself?
Swatgod wrote:
...i was wondering how i could use the returned variable from 1 function in another function inside my dll file.
Does the function return a value? If so, treat it just like any other function that returns a value. The fact that it resides in a DLL is irrelevant.
In Prog.exe:
int x = SomeFunc(); In DLL:
int SomeFunc( void )
{
return 123;
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
well the functions are called from a dll i made and the way that i have seen done, wont let me do it like that, her ei show a small sample of how my functions are called in the exe from my dll file.
ProcAdd=(MYPROC)GetProcAddress(hinstLib,"firstlast");
if(fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd)("firstlast");
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
Are you getting compiler or runtime errors? Are any assertions firing, or exceptions thrown? Does hinstLib have a non-NULL value? Do you know the name of the exported function to be "firstlast?" What does the declaration of ProcAdd look like?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
here is the code of the main application. the first 2 functiosn that i have seen went through fine but when it loads the 3rd which is the one that needs input from other 2, it crashes.
#include <stdio.h>
#include <windows.h>
typedef void (*MYPROC)(LPTSTR);
void main()
{
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary("name");
if(hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "firstn");
if(fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd)("firstn");
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "lastn");
if(fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd)("lastn");
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "firstlast");
if(fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd)("firstlast");
fFreeResult = FreeLibrary(hinstLib);
}
if(! fRunTimeLinkSuccess)
printf("--loading of main dll failed--");
}
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
What is the signature of the first() , last() , and firstlast() functions within the DLL?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
the main source of the dll file is:
#include "stdafx.h"
#include <stdio.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" __declspec(dllexport) firstn();
extern "C" __declspec(dllexport) lastn();
extern "C" __declspec(dllexport) firstlast(char first, char last);
extern "C" __declspec(dllexport) firstn()
{
char first[10];
printf(" What is your first name: ");
scanf(" %s", first);
return (char)first;
}
extern "C" __declspec(dllexport) lastn()
{
char last[10];
printf(" What is your last name: ");
scanf(" %s", last);
return (char)last;
}
extern "C" __declspec(dllexport) firstlast(char first, char last)
{
printf(" your first and last name is %s %s.", first, last);
return 0;
}
once again thank you for your help.
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
Swatgod wrote:
extern "C" __declspec(dllexport) firstn()
{
char first[10];
printf(" What is your first name: ");
scanf(" %s", first);
return (char)first;
}
The first variable goes away once firstn() loses scope. Therefore, the return statement, in its current form, is useless. Since no return type was specified, int is assumed. This conflicts with first being cast to a char .
The same holds true for the lastn() function.
Swatgod wrote:
extern "C" __declspec(dllexport) firstlast(char first, char last)
{
printf(" your first and last name is %s %s.", first, last);
return 0;
}
The first and last variables are of type char , but you are treating them as null-terminated strings in the call to printf() . This is a sure-fire recipe for stack corruption.
Also, the prototypes near the top are not necessary.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
in the firstlast function i made it so it used a char array for both and made the other functions with return type char as before it was causing trouble with it going directly to int.
but the program is still crashing between the end of the 2nd function and start of the 3rd but now it actually prints soemthign from the 3rd function.
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
Whatever result you are seeing that happens to look correct is pure coincidence. The correct way to do this is:
extern "C" __declspec(dllexport) void firstn( LPSTR lpFirst )
{
printf("What is your first name: ");
scanf("%s", lpFirst);
}
extern "C" __declspec(dllexport) void firstlast( LPCSTR lpFirst, LPCSTR lpLast)
{
printf("Your first and last name is %s %s.", lpFirst, lpLast);
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
if someone who is very good with dll files could help me i would appreciate it alot.
i do not think it was clear what i was asking before so i guess i should restate it.
i will use an example(very small and simple example) to explain what i need help with. say i wanted the program to gather a person's first and last name using 2 functions that return the variables that the first and last name are stored in and than another function uses those variables to output the person's first and last name to the screen.
plz if someone could help me figure this out i would appreciate it alot(sorry for the example, only easy thing i could come up with).
the more you learn the less you know, no one is truely a master. cause the more you seek to be the master the less of a master you become.
|
|
|
|
|
I have written a C++ project that runs fine. Now I would like to give the person an option to print it. How to I incorporate my C++ code into the MFC environment so when it runs a printout could be made. Right now I am running the program and can only use the exe file.
|
|
|
|