|
|
Hi:
It's me again well now I have a new one for everyone here.
I have been working with an MFC Sample and I want to add a Dialog, Resource Files from 'original' MFC Sample have .C extension but when I add a new Dialog it has .cpp extension, until then there is no problem, i can add member variables, write code and almost a happy developer life.
The problem is when I run app the code (for example of a Push Button) isn't recognized or isn't executed!!! And, when I put a breakpoint in the code of the new resource and Run app I get next Message "One or more breakpoint cannot be set and have been disabled. Execution will stop at the beginning of the program"
I have tried to change manually .cpp files to .c but VC++ isn't such fool hehe.
Hope your help.
This is the strangest life I've ever known.
|
|
|
|
|
hi,
if you can then change all .c files to .cpp files i mean if there is no problem as such. You can change them and add again into the project.
Your breakpoint I guess is not on valid place. Put it where you write the code for pushing the button or where you are displaying the dialog. then debug. I hope this solves your problem.
cheers
Himanshu
|
|
|
|
|
Hi,
I need to change the folder access permissions for a particular folder such that only the members of the administrator group can access the folder. Is there any Win API/ Methods available which can help me perform such a task programmatically.
Thanks and Regards,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Hi abhi,
whatever i have seen and as long as i know..I don't think there is anything like that..you can just check it programmatically when anyone clicks any folder..check out it is type admin or not and do the rest..i Hope you knew it before but you want something which can do this in short.
Himanshu
|
|
|
|
|
Check the MSDN. Search for "ACL DACL directory". SIDCLEAN.C should point you in the right direction.
Learning is a never ending process of Life
... and learning how to use the MSDN (or Google for that matter) search facilities should be #1. Don't you agree?
|
|
|
|
|
Mike Nordell wrote:
... and learning how to use the MSDN (or Google for that matter) search facilities should be #1.
This forum is for asking Questions and giving answers, not to teach how to use the MSDN or Google search.
And by the way ppl turn up to forums only when they feel there is not much precise info on the net as in my case.
Anyway thanks for your information and the suggestion also.
Learning is a never ending process of Life.
|
|
|
|
|
|
Is there a function that exists anywhere that can take a string of a mathematical expression and parse it, returning the correct value? I am working on something in VB , however if I can implement something from C++ and then just call it from VB that would be fine. Just wondering if anything already existed so I didn't reinvent the wheel so to speak.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
I saw a library on the net. It takes a string and parse it. All of mathematical functions like Sin, Cos, Tan, ... and Linear Algebra supported by this library.
Search on Google to find!
A. Riazi
|
|
|
|
|
Hi all,
can somebody help me in this please?
I have to change the text of the main titlebar dynamically at runtime. But it seems its ID is changing each time.
WHat can i do ? Any code ?
thanks in advance
Hari Krishnan
|
|
|
|
|
hi,
could not understand your quetion..can you please elaborate..what is it you really want and what is your program doing!!!!!!!!!!!
cheers
Himanshu
|
|
|
|
|
Hi,
I rewrote my main window (originally derived from CWnd) as an object derived from CFrameWnd.
How come that all my menu items appear as disabled now?? I can't make any selection! Same with my pop-up menu.
I create my menu in the exact same way as before:
CMenu myMenu;
myMenu.LoadMenu(IDR_MAIN_MENU);
SetMenu(&myMenu);
myMenu.Detach();
Only sub-menus appear as enabled. Also when the command ID for an item is set to 0, it appears as enabled...
Any idea what went wrong?
Thanks
|
|
|
|
|
I finally got it to work, but I don't really understand it:
I now intercept the WM_INITMENUPOPUP-message and simply return 0.
By doing so the menus appear as enabled!
How come I have to do this? (I didn't do it in my message loop of my CWnd-window I had first and the menus didn't appear as disabled)
|
|
|
|
|
A feature of MFC is that any toolbar buttons and menu items that don't yet have a handler get disabled. You can turn this off by setting CFrameWnd::m_bAutoMenuEnable to FALSE in your CMainFrame constructor.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi all,
Is it possible to declare a function pointer outside function arguments? I mean like declaring a pointer as a separate variable which isn’t an argument and can change the function it is pointing at, assuming that whatever function it points at always has the same arguments. Like this code for example. Please note that I know this following code doesn’t compile, I just want to explain my question in code, it’s always a lot easier.
<br />
void realfunc(void){
return;<br />
}<br />
<br />
int main(){<br />
void (*funcptr)(void);
*funcptr=realfunc;
funcptr();
return 0;<br />
}<br />
So is there something similar to this code? In other words is it possible to do something like this?
Aidman » over and out
|
|
|
|
|
Short answer: Yes
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Long answer: Yes, and you can use a typedef to make it simpler.
Try this sample code:
[edit]oops, forgot the darn formatting so the stdio.h got removed.[/edit]
#include <stdio.h>
typedef void (*PFN_YOURFUNCTION)(void);
void TestFunction1()
{
printf( "TestFunction1\n" );
}
void TestFunction2()
{
printf( "TestFunction2\n" );
}
int main()
{
PFN_YOURFUNCTION a_pfnFunction = NULL;
a_pfnFunction = TestFunction1;
a_pfnFunction();
a_pfnFunction = TestFunction2;
a_pfnFunction();
return 0;
}
The output will be:
TestFunction1
TestFunction2
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Great Thanks Chris Richardson!
I am sorry, I feel a little dumb not realizing that C++ must hade such a method.
But here’s another “function pointer” related question, which may be more advanced if that’s ok? Let’s say you have a function (in your own application) whose arguments are stored customable in variable arrays and the function name you don’t know. The only thing you have as a pointer of the function is a simple memory pointer/adress (no real function pointer) that points to a memory location where the function is stored during run-time. The following code example would demonstrate what I am trying to say.
<br />
<br />
struct FUNCSTRUCT {
MEMPTR *FunctPtr;
int VarCount;
MEMPTR *VarPtr[255];
int VarSize[255];
}<br />
<br />
MEMPTR CallFunc(FUNCSTRUCT *FunctData);
<br />
int TheRealFunc(int Argument){
return Argument;<br />
}<br />
<br />
int main(){<br />
FUNCSTRUCT FuncData;
int Value = 1;
<br />
FuncData.FunctPtr = TheRealFunc;
FuncData.VarCount = 1;
FuncData.VarPtr[0] = Value;
FuncData.VarSize[0] = 2;
<br />
return CallFunc(&FuncData);
}<br />
Is it possible to create such a function as “CallFunc” that could call a function, only knowing the custom arguments and a memory pointer/address? If so then how and how would the “MEMPTR” variable type look like? I presume that this question is a lot harder and I guess it includes some low-level knowledge. But is this possible and if it is then please explain how and demonstrate it in code please or could you point me to a tutorial on this.
|
|
|
|
|
No.
main() must return an int. CallFunc return a MEMPTR object.
Kuphryn
|
|
|
|
|
Yes I know this code doesn't compile it is only to demonstrate my words in code. And fourther more the MEMPTR return is pointing to an int variable and that was part of my question, How would MEMPTR look like, meaning how would it be constructed and operate, to get the memory location.
Please help me anyone.
Aidman » over and out
|
|
|
|
|
I guess you could handcraft then stack using assembler. I'm not that up to date
on calling conventions so you have to get the dirty details from someone else.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Any ideas of where I could find some info on this type function pointer calls?
|
|
|
|
|
|
It looks you're trying to create a scripting engine. If that's the case then most scripting engines accept arguments as strings and then convert those arguments into the proper types.
int TheRealFunc(const char* argument)
{
int i = atoi(argument);
}
Or, for each "real" function there's a wrapper function for your scripting engine that parses the parameters and then does the real call
int TheRealFunc(int a1, int a2, float a3)
{
}
int TheRealFuncWrapper(const char* argument1, const char* argument2, const char* argument3)
{
int a1 = atoi(argument1);
int a2 = atoi(argument2);
float a3 = atof(argument3);
return TheRealFunc(a1, a2, a3);
}
Todd Smith
|
|
|
|