|
|
My application must add and remove some pages from a CPropertySheet in the middle of the "modal loop" (for instance, when the user clicks a button...)
The problem is the CPropertySheet does not resize to fit the newly added pages except when these are added before the call to DoModal()...
Can anybody figure a way to resize the CPropertySheet suitably?
tks
Bruno Norberto
|
|
|
|
|
I create object from remote machine, as dll in a surrogate,
within it I
register IUnknown in a ROT with Register active object,
than, I call from else process on same remote machine GetActiveObject with same guid -
(guid - is created by me!)
but receive exception of unknown type catch(...)
what is the prolem can it be?
thanks you.
|
|
|
|
|
I have designed a tool using MDI application...
In each MDI child window i have drawn objects like square,circle and other figures.
I would like to know if these can be saved and reloaded on starting the application afresh.
I havent used serialization but will it reproduce the graphical objects drawn in the client area of the window.
laiju
|
|
|
|
|
Serialization would be the keyword, thats your way to store the info to recreate all the figures.
I'm sure there are articles about that on CP.
Don't try it, just do it!
|
|
|
|
|
how do i have some text displayed next to the button when the mouse is over the button? just like the alt function of html code.
this is for displaying the function of the button. anyone pls help? thanks a lot!
|
|
|
|
|
|
|
Hello, I posted this problem yesterday and it didn't get any responses so I figured I would try it on more time... I have a MDI type app where one of my views was derived from CView and then converted into CRichEditView...
Anyway everything works fine except I want to turn horizontal scrolling on and I would like to disable word wrapping. I have tried to change the window styles in PreCreateWindow but this doesn't seem to have any effect on horizontal scrolling. Any ideas? Has anyone had similar experiences?
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I just figured it out.. Incase anyone else runs into this....
Inside OnInitialUpdate()
m_nWordWrap = WrapNone;
WrapChanged();
Inside PreCreateWindow
cs.style += ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_LEFT | ES_AUTOHSCROLL | WS_HSCROLL;
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
hiho@ll
i know this site is for windows programming, but i just wanted to know if my C-Code could have a problem, and this website is very well visited i think
for those who also use linux:
i'm coding on a suse linux box with kernel 2.4.21-226-default running gcc v 3.3.1
the problem is a function named strtok
which tokenizes my string using a delimiter
char test[]="hallo hallo2";
z.B. first call strtok(test," "); // returns hallo
seconde call strtok(NULL," "); // returns hallo2
this code works!:
char str[] ="This is a sample string,just testing.";
char * pch;
printf ("Splitting string \"%s\" in tokens:\n",str);
pch = strtok (str," ");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ,.");
}
this code doesn't work! (i get a segmentation fault):
char *str ="This is a sample string,just testing."; // just changed char[]
char * pch;
printf ("Splitting string \"%s\" in tokens:\n",str);
pch = strtok (str," ");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ,.");
}
could there a problem with the code itself?
what's the difference between pointers and arrays?
i thought there is no difference!
thx@ll
|
|
|
|
|
strtok() actually modifies the source string. That's why str[] works and str* does not.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
??
1. is there a difference?
char *str="hello";
str[0]='z';
--> str = "zello";
char str[]="hello";
str[0]='z';
--> str = "zello";
so what's the difference
and function header looks like this:
char *strtok(char *s, const char *delim);
2. str* doesn't work and str[] works! and not the other way, like u said
thx
|
|
|
|
|
ThinkingPrometheus wrote:
1. is there a difference?
Yes.
http://www.eskimo.com/~scs/C-faq/s6.html
ThinkingPrometheus wrote:
and function header looks like this:
char *strtok(char *s, const char *delim);
Since the first parameter is not const , that indicates it can/will be modified.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
you wrote: strtok() actually modifies the source string. That's why str[] works and str* does not
look at my example prog!!!!
it works the other way!
str* doesn't work and str[] works! why?
thx
|
|
|
|
|
ThinkingPrometheus wrote:
you wrote: strtok() actually modifies the source string. That's why str[] works and str* does not
look at my example prog!!!!
it works the other way!
I think you need to re-read this thread. Your code indicates that char[] works but char* does not. Now you state that it works the other way.
The strtok() function works as it is intended to. Read its documentation. I provided you a link that explains the difference between a pointer and an array. Please read it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i read the doc of strtok and your link
but it confuses me more than before
much more i'm asking why it doesn't work
cause strtok wants a pointer
i give it a pointer it makes segmentation fault
i give it an array it works!!!???
shouldn't it work if i give it a pointer and it wants a pointer!?
*confused*
|
|
|
|
|
Because when you write:
char* s = "hello"; the compiler/linker may allocate read-only memory for that string, and set s to the address of that memory. Thus when you try and modify that string, it segfaults.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
ThinkingPrometheus wrote:
much more i'm asking why it doesn't work
Because it is not supposed to work. The statement char *p = "Hello" says that p is a pointer that points to a spot in memory that holds the string constant. Trying to change the contents of p[1] is illegal because is refers to a constant spot in memory. That spot in memory has no name.
The statement char p[] = "Hello" says that 6 bytes of memory is allocated for the string constant and that spot in memory is referred to as p .
In that link that I provided, read sections 6.2 and 6.4 very carefully. The difference is explained very well, and why they can't always be interchanged.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
WOW
got it
that was the problem
thx to both of you
|
|
|
|
|
I would like to know if I can override any function such as OnApply() or OnOk() for a class derived from CPropertySheet.
The idea is i want to save some default settings property sheet whenever the user clicks apply /ok in a property sheet.
laiju
|
|
|
|
|
laiju wrote:
I would like to know if I can override any function such as OnApply() or OnOk() for a class derived from CPropertySheet.
No, since neither method belongs to the CPropertySheet class. You can, however, override the virtual OnApply() and OnOK() methods that belong to the CPropertyPage class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes you can. Well, not technically "override" but you can catch the button clicks. CPropertySheet is a CWnd derived class so it has all the normal functionality of CWnd. It does receive BN_CLICKED commands from the buttons on the sheet, so you can add message handlers for the Ok and Apply buttons in you CPropertySheet derived class. Just be sure to implement the default behaviour by calling Default() in your handler.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I am using MDI architecture enable with Doc-View architecture.
Can anyone let me know if i can hide the first MDI child which comes by default.
I want to show that window later and not as soon as the application is started
laiju
|
|
|
|
|
in the OnNewDocument in your Doc class, return FALSE and that is it
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|