|
I don't think a CStringArray knows how many strings you have added. It knows the size, but not how many of the pointers you actually use.
Why don't you use CStringList if you want that functionallity?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Anders
cause I'm dumb, stupid and didn't know it existed. Now you have pointed it out to me I will look it up, but not until tomorrow. I have waited until midnight Sunday to get an answer, better get to bed if I'm going to make in it to work on time.
Once again thanks for the answer.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
I am trying to package a reusable class library in a win32 dll
however I have run into a problem,
Class B and B2 derive from class A, heres the simplified code:
class __declspec( dllexport ) A
{
public:
A();
virtual ~A();
virtual void SomeFunc(void) = 0;
};
class __declspec( dllexport ) B : public A
{
public:
B();
virtual ~B();
void SomeFunc(void);
};
class __declspec( dllexport ) B2 : public A
{
public:
B2();
virtual ~B2();
void SomeFunc(void);
};
A::A()
{
cout << "A constructor." << endl;
}
A::~A()
{
cout << "A destructor." << endl;
}
B::B()
{
cout << "B constructor." << endl;
}
B::~B()
{
cout << "B destructor." << endl;
}
void B::SomeFunc(void)
{
cout << "B::SomeFunc()" << endl;
}
B2::B2()
{
cout << "B2 constructor." << endl;
}
B2::~B2()
{
cout << "B2 destructor." << endl;
}
void B2::SomeFunc(void)
{
cout << "B2::SomeFunc()" << endl;
}
This compiles into a DLL without any problems. However when
I attempt to use it (I have linked to the .lib and put the
.dll in the executable directory) using the following code:
#include "A.h"
#include "B.h"
#include "B2.h"
int main(void)
{
A* test = NULL;
test = new B();
test->SomeFunc();
delete test;
return 0;
}
I get the output as expected:
A constructor.
B constructor.
B::SomeFunc()
B destructor.
A destructor.
But then a nasty debug assertion failure:
Debug Asserion Failed.
File: dbgheap.c
Expression: _pFirstBlock == pHead
Oddly enough, if I comment out delete test; the assertion failure does not occur, but I dont want memory leaks in my programs. I know that converting it too a COM dll and using interfaces would problably be the best solution, however I want to first learn how to create normal dlls before I mess with making them COM compliant.
|
|
|
|
|
Have you tried calling delete []? Call it with the brackets and see if the same problem occurs.
|
|
|
|
|
Check if the DLL is built with the same C runtime
library version as the program you're using it from
(i.e. Multithreaded or not, static ot dynamic, debug
or release). If versions differ this kind of problems
can occur
|
|
|
|
|
Does anyone here know the commands for the CHttpServer and how to use it? I was just curious...
"The world doesn't care about your self esteem. The world expects you to get something done BEFORE you feel good about yourself." ~ Bill Gates
|
|
|
|
|
|
I was wondering whether Visual Interdev is itself an MFC app and if so, I was wondering what MFC classes is it derived from?
thanks
|
|
|
|
|
Visual C++ is a MFC application, so I guess Interdev is too...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi everyone,
I hope programmers here can help me. One of my beta-testers said that he had encountered a problem. The problem is the following: Windows XP does not work. Can anyone help me to fix it? Here is the source code of Windows XP:
/*
TOP SECRET Microsoft(c) Code
Project: Redmond(tm)
Projected release-date: September 2001
*/
#include "win31.h"
#include "win95.h"
#include "win98.h"
#include "winME.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#define INSTALL = HARD
char make_prog_look_big[1600000];
void main()
{
while(!CRASHED)
{
display_copyright_message();
display_bill_rules_message();
do_nothing_loop();
if (first_time_installation)
{
make_50_megabyte_swapfile();
do_nothing_loop();
totally_screw_up_HPFS_file_system();
search_and_destroy_the_rest_of_OS/2();
hang_system();
}
write_something(anything);
display_copyright_message();
do_nothing_loop();
do_some_stuff();
if (still_not_crashed)
{
display_copyright_message();
do_nothing_loop();
basically_run_windows_3.1();
do_nothing_loop();
do_nothing_loop();
}
}
if (detect_cache())
disable_cache();
if (fast_cpu())
{
set_wait_states(lots);
set_mouse(speed, very_slow);
set_mouse(action, jumpy);
set_mouse(reaction, sometimes);
}
/* printf("Welcome to Windows 3.11"); */
/* printf("Welcome to Windows 95"); */
/* printf("Welcome to Windows 98"); */
/* printf("Welcome to Windows ME"); */
printf("Welcome to Windows XP");
if (system_ok())
crash(to_dos_prompt);
else
system_memory = open("a:\swp0001.swp" O_CREATE);
while(something)
{
sleep(5);
get_user_input();
sleep(5);
act_on_user_input();
sleep(5);
}
create_general_protection_fault();
}
I hope programmers here can help me.
Tnanks!
Bill Gates,
Microsoft Corp.
One Microsoft Way
Redmond, WA 98052-6399
Telephone: (425) 882-8080
|
|
|
|
|
This wasn't even funny the first time I saw it, and I was an OS/2 Warp 3 zealot at the time. Original or funny stuff only thanks.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Hi folks,
I hope one of you out there can help me with a small problem.
Does anyone know how to override the MFC default icons in my MFC app wizard application that Microsoft kindly provide? It's the small icon that appears at the top left corner of the main window that I want to replace in particular.
I even removed them from the resources and replaced them with my own icons, but to no avail. I had a look at the MSDN library help for PreCreateWindow and CREATESTRUCT but there's nothing obvious there.
Any suggestions would be great.
Cheers, Stephen.
|
|
|
|
|
Here is the answer
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Thanks Michael. That's me up an running now.
|
|
|
|
|
Hi
I need to be able to store extremely long values temporarly for encryption. The problem at the moment is i can't find anyway of doing it and a ULONG is far to small. I also can't just put it into a string since i need to be able to performs some mathematical functions on it.
Basically what i need to do is have a variable capable of storing a Unsigned Long to the power if a 100 digit number. I also need to be able to store the number that is going to be the power.
So far i have wondered if there is anyway of declaring a pointer and manually designanting its size in bytes rather then defining it to store a unsigned long etc.
The other idea i had is if there is anyway to define your own data types and specify there size or if i could somehow add two existing variables together like to unsigned longs that would give me a whole new data type that stored 64bits rather then 32.
Thanks for all the Help
Peter
|
|
|
|
|
Hello,
How would it be possible to "extend" any SIP of any appplication ? I mean I would like to insert a processing that would modify/verify each user input from any kind of SIP, of any application, before the input string is sent to the application currently owning the SIP.
Do I have to write a DLL, how could it work ? I plan this of course under Windows CE. Do one need something related to hooking (I know that is very restricted under Windows CE) ?
Thank's in advance.
--Francois
|
|
|
|
|
You should get the book "Programming Microsoft Windows CE" by Douglas Boling, from MS Press. It explains a lot about SIP's, also how to make them...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
I have this book (unfortunaltely not physically accessible for the moment )
And if I remember it describes how to create a new kind of SIP, but not how to extend an already existing one, isn't it ?
--Francois
|
|
|
|
|
You might be right about that. It's a long time since I read about SIP programming. It's just that it's the best source I have been able to find about that.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hello,
How would it be possible to "extend" any SIP of any appplication ? I mean I would like to insert a processing that would modify/verify each user input from any kind of SIP, of any application, before the input string is sent to the application currently owning the SIP.
Do I have to write a DLL, how could it work ? I plan this of course under Windows CE. Do one need something related to hooking (I know that is very restricted under Windows CE) ?
Thank's in advance.
--Francois
|
|
|
|
|
Hi,,
I have a loop which draws a certain number of(user defined) lines(sets of lines). I like to draw each set line after one second.
Below is the source code of my loop.
item* ptr;
//this is the loop,
for(int i=1; i<= End_Of_Loop ; i++)
{
//This is where it should wait for 1 second, and then draw the next
//set of lines
pDoc= GetTheDocument(i);
ptr=pDoc->myList.GetStartList();
if( ptr != NULL)
{
CClientDC dc(this);
for( ptr=pDoc->myList.GetStartList(); ptr->next!=NULL; ptr=ptr->next)
{
dc.MoveTo(ptr->Coord);
if(ptr->next == NULL)
dc.LineTo(pDoc->myList.GetStartList()->Coord);
else
dc.LineTo(ptr->next->Coord);
}
dc.MoveTo(ptr->Coord);
dc.LineTo(pDoc->myList.GetStartList()->Coord);
}
//clear the View, for the next set of lines.
Invalidate(FALSE);
}
any ideas how can I do that...
Thanks
Ehsan Behboudi
|
|
|
|
|
|
You should setup a timer and a function to handle the timer event. Call your draw function from there.
|
|
|
|
|
Does anyone know how to set the color of entries that appear in a CListBox... I am adding entries on the fly from a database and want to set different types to be different colors. [I've tried using GetDC and then SetTextColor but it doesn't seem to work... OnCtlColor almost works but since my program reads the entries from a database the entries lose the color on subsequent calls of OnCtlColor (of which there are lots).]
Also - does anyone know how to get the data from a CDateTimeCtrl to Data Exchange with a RecordSet? The DDX code that ClassWizard adds ( DDX_FieldDateTimeCtrl(pDX, IDC_DOB, m_pSet->m_Date_of_birth, m_pSet); ) doesn't seem to work - it doesn't recognise the FieldDateTimeCtrl on compilation.
Any help much appreciated, i'm new to this VC++ malarky from C...
Cheers.
Simon
meru.co.uk
|
|
|
|
|
Dear friends how can i get the current path of my dll \
at run time. i have used GetModuleFileName which is returning the full path with the dll name. is there any way to find out only the path of the application.
|
|
|
|