|
Have you called AfxInitRichEdit() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How does it not compile? Some compiler error messages would be useful.
|
|
|
|
|
I'm pretty sure you should be able to do this, cause I've some projects that do just what you describe. However one of the gotcha's is that numerous compiler settings need to be exactly the same for each of the projects. Eg. 'Use MFC in a Shared DLL', the same run-time library, struct member alignment, possibly even some of the C++ runtime type information.
I've got one DLL project with a class that inherits from CDocument. In another DLL project, there exists a class that inherits from the class implemented in the other DLL and each of the classes have message maps.
As the other poster suggested, if you post what compile errors you get, it might help some.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
Using Visual C++ 6.0
I'm working on a project that contains 26 extension DLLs. In one of the extension DLL's, we have a class that inherits from CWnd called CWndA, and another class that inherits from CWndA called CWndB. (The real names aren't importnant, I just figured it would make it easier to talk about if I gave these names in the example.)
Both CWndA and CWndB have message map macros in them. HOWEVER, if I try to inherit from either CWndA or CWndB in another DLL or EXE file, I can't have a message map because the program simply won't compile.
This is true with any class that has the AfxMessageMap macro in it.
Can someone tell me why as well as if there's a way to fix it?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Dear Friends,
I know i am asking very simple question, so please reply to ASAP and help me to get the solution.
Please write to me how to get the image of a dialog box as a .bmp or any kind of image file. I just want to get the image of dialog box so can display the complete contents of dialog box items i.e. buttons etc for documentation.
Please respond ASAP. For this I shall ever be greaful to you.
Although it is possible by creating such an option inside the dialog box or by adding menu to provide copying option but I think it is possible in other way too and that method I wish to know....Thus please write to me to get the solution......................
Thanking you in advance...................
Billar
|
|
|
|
|
press [Print Screen]
open mspaint->Ctrl + V
There is no spoon.
mail
|
|
|
|
|
There is very Gud Article for this in code project. you have to search in System column
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hit <Ctrl + Alt>+<Print Screen> to copy an image of the dialog that currently has focus to the clipboard. You can then paste it into your Paint and save it.
Mike
|
|
|
|
|
Alt+Print Screen is sufficient (the Ctrl key is not required).
Software Zen: delete this;
|
|
|
|
|
Alt+PrntScrn will copy the active window to the clipboard. You can then paste to your documentation software.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a dialog based app that uses multiple modeless dialogs to overlay portions of the main dialog. I have an array of structs defined in the public portion of the main dialog like this:
public:
MYSTRUCT MainList[MAX_LIST];
The struct looks like this:
typedef struct MyStruct
{
char Index[6];
CString Title;
CString Artist;
CString Album;
CString FileName;
CString Time;
CString Genre;
int TimesPlayed;
} MYSTRUCT, *LPMYSTRUCT;
When I access this list from one of the overlay dialog classes using a dialog pointer, it sometimes works ok, and sometimes doesn't see the data in the list, although the data is there.
If the overlay is created as a child, it works ok, but I lose my menu in the overlay, and parts of the main dialog show through the overlay. If it's created as a popup or overlapped, it gets flaky.
I tried creating the list as a static global, but that only made it not work consistantly in the overlays.
Any ideas as to why it works sometimes, and not others?
TIA,
Rick
|
|
|
|
|
Well I did something like that sometime back, and the way I made it work was as follows :
keep this structure in the public portion of the main dialog as well as the child dialogs.Then you have to detect when the modeless dialogs are changing , ie say dialog 1 is hiding and dialog 2 is showing.At that point of time you will have the fill the structure in the dialog1 class, and from the maindialog copy the values of the structure in dialog1 to the maindialog structure.
Hope this helps.
_KANE_
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
That I can do, but I can't figure out why it's not accessible through the other dialogs in it's global form.
I also tried creating a CList globally, and I populate it in one dialog class, yet it shows empty in another dialog class???
I put the CList in my main app header file, and all the dialog classes include that, seems to me they should all be accessing the same data?
|
|
|
|
|
How can I display a Gif image against an item in a CTreeCtrl?
|
|
|
|
|
Render the gif to a memory DC with a bitmap selected into it, then use that bitmap to add to an image list.
You can use GDI+ or the IPicture interface to do this.
Steve S
Developer for hire
|
|
|
|
|
Hi everyone,
I've some problems including header files.
I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h.
Both classes must use some functions declared in a Myheader.h file.
Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement.
The error is LNK1169: one or more multiply defined symbol founds.
Any suggestion?
|
|
|
|
|
Did you put these statements in all of your *.h files :
#if !defined YOURFILENAME<br />
#define YOURFILENAME<br />
<br />
...<br />
...<br />
...<br />
<br />
#endif
Replace YOURFILENAME by something unique to every file.
|
|
|
|
|
Those statements are set by default by Visual Studio in every class file. I tried also to create a dll file from Myheader, but even if i add that library to my project, the app doesn't recognize the functions of the library. Should I addd a .DEF file?
|
|
|
|
|
Hello
You should not include Myheader.h in both the files. You can include the Myheader.h in CTwo.h and include CTwo.h in COne.h
I hope it would work...
Bye,
Sreekanth Muralidharan
|
|
|
|
|
I've already tried this way, but the result was the same.
I solved the problem in another way.
Thanks to everyone
|
|
|
|
|
Hello buddies,
I am designing a queue by a linked list for an application. I wrote the following code while it brought up an exception in the line marked here. Could you please help me out ?
#include <stdio.h><br />
#include <conio.h><br />
struct queuelist<br />
{<br />
int intData;<br />
int valid;<br />
struct queuelist* next;<br />
<br />
};<br />
struct queuelist *head, *tail;<br />
<br />
int AddToQueue(struct queuelist*,int);<br />
int RemoveFromQueue(struct queuelist*);<br />
int DeleteQueue(struct queuelist*);<br />
void DisplayQueue(struct queuelist*);<br />
void menu();<br />
void menu()<br />
{<br />
<br />
int option=0;<br />
struct queuelist* queue;<br />
int data;<br />
printf("Queue Manipulation Menu\n");<br />
printf("........................\n\n");<br />
printf("1. Add member to queue.\n");<br />
printf("2. Extract next member.\n");<br />
printf("3. Delete whole queue.\n");<br />
printf("4. Help\n");<br />
printf("5. Display queue contents.\n");<br />
printf("6. Quit.\n");<br />
scanf("%d",&option);<br />
switch(option)<br />
{<br />
case 1:<br />
printf("Adding to queue.\n");<br />
printf("Member: ");<br />
scanf("%d",&data);<br />
if(AddToQueue(queue,data)==-1)<br />
printf("Could not add..\n");<br />
else<br />
printf("Added..\n");<br />
menu();<br />
<br />
case 2:<br />
system("cls");<br />
printf("Extract next member.\n");<br />
RemoveFromQueue(queue);<br />
menu();<br />
<br />
<br />
case 3:<br />
DeleteQueue(queue);<br />
menu();<br />
<br />
case 4:<br />
printf("Under Construction.\n");<br />
menu();<br />
case 5:<br />
printf("Queue Contents.\n");<br />
DisplayQueue(queue);<br />
menu();<br />
case 6:<br />
exit(0);<br />
<br />
default:<br />
printf("Invalid Option..\n");<br />
<br />
}<br />
}<br />
<br />
void main()<br />
{<br />
system("cls");<br />
menu();<br />
getch();<br />
<br />
}<br />
<br />
int AddToQueue(struct queuelist** q, int data)<br />
{<br />
struct queuelist** temp;<br />
q = head;<br />
if(q == NULL)<br />
{<br />
printf("First member in queue.\n");<br />
temp = (struct queuelist**)malloc(sizeof(struct queuelist));<br />
if(*temp == NULL)<br />
{<br />
printf("Not enough memory. Stopping...\n");<br />
return -1;<br />
}<br />
else<br />
{<br />
(*temp)->intData = data;<br />
(*temp)->next=NULL;<br />
(*temp)->valid=1;<br />
<br />
(*q)->next = temp;<br />
head = *q;<br />
tail = *q;<br />
<br />
}<br />
<br />
<br />
}<br />
else<br />
{<br />
while((*q)->next!=NULL) (*q) = &(*q)->next;<br />
<br />
temp = (struct queuelist**)malloc(sizeof(struct queuelist));<br />
if((*temp) == NULL)<br />
{<br />
printf("Not enough memory. Quitting...\n");<br />
return -1;<br />
}<br />
else<br />
{<br />
(*temp)->intData = data;<br />
(*temp)->next=NULL;<br />
(*q)->next = *temp;<br />
(*q) = (*q)->next;<br />
(*q)->valid = 1;<br />
tail = *q;<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
<br />
void DisplayQueue(struct queuelist* queue)<br />
{<br />
system("cls");<br />
queue = head;<br />
if(queue == NULL || queue->valid != 1)<br />
{<br />
printf("Empty Queue");<br />
}<br />
else<br />
{<br />
while(queue != NULL)<br />
{<br />
printf("||%d|%x||->",queue->intData,queue->next);<br />
queue = queue->next;<br />
}<br />
<br />
}<br />
printf("\n");<br />
<br />
}<br />
<br />
int RemoveFromQueue(struct queuelist* queue)<br />
{<br />
<br />
struct queuelist* prev;<br />
struct queuelist* second;<br />
queue = head;<br />
if(queue->valid !=1)<br />
{<br />
printf("Queue Exhausted. No members.\n");<br />
return -1;<br />
}<br />
else<br />
{<br />
queue = head;<br />
prev = queue;<br />
queue = queue->next;<br />
second = queue;<br />
head = queue;<br />
printf("Popped off : %d at %x\n",prev->intData, prev->next);<br />
prev->next = NULL;<br />
free(prev);<br />
}<br />
<br />
<br />
<br />
}<br />
int DeleteQueue(struct queuelist* queue)<br />
{<br />
struct queuelist* prev;<br />
queue = head;<br />
while(queue!=NULL)<br />
{<br />
prev = queue;<br />
queue = queue->next;<br />
queue->valid=0;<br />
free(prev);<br />
}<br />
<br />
<br />
}
Bye....
Sreekanth Muralidharan
|
|
|
|
|
Beside writing code for learning new things, I would never ever implement my own linked list or so when there are powerful, well-tested and broadly used collection classes like the STL [^].
--
Affordable Windows-based CMS: www.zeta-producer.de/enu
|
|
|
|
|
Hello friend,
I would not prefer using STL for my small application. If you would refer to the code and find out the bug, it would be of great help to me.
Regards,
Sreekanth Muralidharan
|
|
|
|
|
Firstly, I would offer the same advice, don't write your own linked lists or collections etc, use STL or the MFC CList etc.
The problem in your code appears to be a confusion in the pointers, and the code is littered with such problems, eg in AddToQueue(), you have set temp to be of type struct questlist ** , but your call to malloc (btw why are you not using new???), will create a pointer to a single queuelist (i.e. (struct queuelist *)). So you should change the code to something like
struct queuelist *temp = NULL;
.............
temp = (struct queuelist *)malloc( sizeof(struct queuelist) );
if ( temp == NULL )
{
// Not enough memory etc
}
else
{
temp->intData = data;
temp->next=NULL;
temp->valid=1;
*q = temp;
}
The function call to AddToQueue() in your main part should read AddToQueue( &queue ) else the wrong type is being passed to the function.
I must admit that I am surprised that your compiler did not generate warning messages with your code? I think that you would be best of revisiting all of your code, and checking all your pointers and paraeters. Remember that malloc will only return a pointer to a section of memory that you have allocated.
Better still, use STL or perhaps the MFC CList template.
|
|
|
|
|
Hello
Thanks to all who took their time to go through my bugful code.
Regards,
Sreekanth Muralidharan
|
|
|
|