|
Pass a reference to the list to be updated:
void DataImportDlg2::SetMapType(CListBox<font color="#ff0000">&</font> list,
LPCTSTR fieldName,
int fieldNum)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That works, except I have to change my argument name from list, since it thinks I'm referencing the STL list.
Thanks,
Bob
|
|
|
|
|
i very enjoy a database lib:
header file : dbdao.h
lib file : ddao35.lib
dll file : ddao35.dll
in VC5.0 professional version, all of them are there.
but in Visual Studio 6.0 enterprice company version, i can't find last one ddao35.dll, only first two are there.
so every time if i use database, i have to copy ddao35.dll from VC5.0.
i don't know if it is problem of our Visual studio 6.0 or something else.
and, even enjoyable, the lib can't be used by release version, so i often send debug version to customer.
i think i lost something, do u have suggestions?
thx
includeh10
|
|
|
|
|
According to MSDN the file should be included with VC6 in the DAO SDK. Have you tried installing the latest MDAC or getting the latest Platform SDK?
Knowledge base article Q192777 refers to a bug in the files. I don't think that is your problem though.
Michael
Look, try and use your intelligence, man, even if you are a politician. - The Doctor
|
|
|
|
|
i do install everything in Visual studio 6.0.
after installation, i use 'find' to search ddao35.dll in my computer and source CD, no the file.
but ddao35.dll is simply in VC5.0 CD
thx
includeh10
|
|
|
|
|
If I realloc a block of memory and the address has changed to another location I want to free the previous address but it dosent work. way??
has anyone can suggest me another idea.
---Code Example---
double *ptr, *ptr_1;
long N, M;
...
ptr= new double [N];
...
ptr_1=ptr;
if((ptr=(double*)realloc(ptr, M*sizeof(double)))==NULL)
{
printf("Error\n");
exit(1);
}
if(ptr_1!=ptr)
free(ptr_1); ????? -> ERROR Why this is Error?????
|
|
|
|
|
realloc takes care of freeing the old block.
By the way, you shouldn't be mixing new and delete with malloc , realloc and free . Though it may seem to work for your current compiler, this is not guaranteed to be so for other compilers/releases.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
if u call realloc, system will do something for previous allocaled memory (delete or else), so u can't do it again.
but, i think first call should be alloc instead of new.
new and alloc assigns different page, sometimes it will cause trouble.
includeh10
|
|
|
|
|
System does not delete or free old memory block, becuse if I work in a cycle('For') I get System Memory Leak.
|
|
|
|
|
System does not delete or free old memory block...
Yes it does. Probably you're experiencing problems due to your mixing of new and realloc . Try using malloc instead of new .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I do not mix between New & Delete and malloc realloc & free
and still I got System Memory Leak.
I have tried diffrent of variations.
|
|
|
|
|
I strongly doubt you've discovered in realloc . Try to downsize your program to a postable sample and, if the error persists, publish the sample here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am allocating a vector of double's, and inside a loop this vector is growing each cycle. So I need to realloc for the new size, but after a few cycles the memory is full.
The sample i post the fisrt time is the sample you need. Just put it in a 'FOR' loop, and increase the a amount of memory allocation. Let me know if you got a memory leak.
|
|
|
|
|
do a simple test u will know trouble.
call malloc, and new then check the addresses assigned by the two calls.
u will find the number from new is much larger.
new is realy on global.
malloc, even GlobalAllocPtr is not.
includeh10
|
|
|
|
|
OK, I think I know ehere your problem lies. When realloc fails, then it is your responsibility to free the old block. I guess this is the memory leask you're having. This sample reallocates till memory exhaustion taking care of the freeing when the exhaustion occurs:
double *ptr, *ptr_1;
long N=100;
ptr=(double *)malloc(N*sizeof(double));
for(;;){
N*=2;
ptr_1=ptr;
if((ptr=(double*)realloc(ptr, N*sizeof(double)))==NULL){
free(ptr_1);
break;
}
}
Please let me know if this solves your problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
this cod u wont to see plias tray
#include <stdlib.h>
#include <stdio.h>
void main(){
double *ptr,*ptr_1;
long N,M,counter,i;
static long x=0;
N=200;
M=20;
counter=20000;// chage counter to 70000 and tray to run programm agein.
ptr=(double*)malloc(N*sizeof(double));
for(i=1;i<=counter;i++){
ptr_1=ptr;
if((ptr=(double*)realloc(ptr,N+i*M*sizeof(double)))==NULL){
printf("memory full %d\n",x);
exit(1);
}
if(ptr_1!=ptr){
x++;
printf(" quontity of nwe memory allocetions %d \n",x);
//free(ptr_1); //?????????
//with out this line the memory qwiqly fill.
//with this line i get Error masege from Windous.
//the length of vector shod be 1200200
}
}
}
|
|
|
|
|
***repost for those of you that don't read the lounge***
Heya everyone, I'm trying to make a few bucks by selling off bits of my library. And since Amazon won't let a lowly Canadian sell their used books through them, I'm doing it on my own.
Have a look here to see if there's anything that grabs your attention.
Books For Sale [new window]
J
|
|
|
|
|
Sorry for the formatting, I can't seem to find the instructions on how to correctly format source code in these messages.
All I'm trying to do is have the title bar text of a SDI application have the usual title plus some right justified text (szReg). I was not able to do it using the CMainFrame OnPaint, so I tried to fudge it by adding spaces between the two strings until the extent of the text was about enough to fill the window width. I think I will need to take into consideration the border size later, but this code doesn't really get it very close. The text ends up quite a bit short of where I wanted it to be. (This is all done in my own UpdateFrameTitleForDocument()).
Thanks.
//The code --
CString szTitle = szText;
TRY{
CWindowDC dc(this);
CRect r;
GetWindowRect(&r);
int nWindWidth = r.Width();
int nSpace = nWindWidth;
szTitle += szReg;
//Acutal width of the title string
int nActualWidth = dc.GetTextExtent(szTitle).cx;
BOOL bStop = FALSE;
CString szSep;
int nCount = 0;
//keep looping until the width of the window
//is taken up by the string. Add spaces between
//the normal title, and the new (right justified)
//text I'm adding:
while (!bStop){
if (nActualWidth < nSpace){
//Not filled up yet, keep adding spaces
//between the strings:
szSep += " ";
szTitle = szText + szSep + szReg;
nActualWidth = dc.GetTextExtent(szTitle).cx;
}
else
bStop = TRUE;
nCount++;
if (nCount > 1000){
//this should not happen
bStop = TRUE;
SetWindowText(szText + " " + szReg);
}
}
SetWindowText(szTitle);
}
CATCH(CResourceException,e){
SetWindowText(szText + " " + szReg);
}
END_CATCH
|
|
|
|
|
You should probably select the correct font in your DC.
Philippe Mori
|
|
|
|
|
Is there an easy way to get the current title bar font?
Thanks for the reply.
|
|
|
|
|
You have to use the SystemParametersInfo function
with the SPI_GETNONCLIENTMETRICS option.
|
|
|
|
|
Use <pre> tags.
CString szTitle = szText;
TRY{
CWindowDC dc(this);
CRect r;
GetWindowRect(&r);
int nWindWidth = r.Width();
int nSpace = nWindWidth;
szTitle += szReg;
int nActualWidth = dc.GetTextExtent(szTitle).cx;
BOOL bStop = FALSE;
CString szSep;
int nCount = 0;
while (!bStop){
if (nActualWidth < nSpace){
szSep += " ";
szTitle = szText + szSep + szReg;
nActualWidth = dc.GetTextExtent(szTitle).cx;
}
else
bStop = TRUE;
nCount++;
if (nCount > 1000){
bStop = TRUE;
SetWindowText(szText + " " + szReg);
}
}
SetWindowText(szTitle);
}
CATCH(CResourceException,e){
SetWindowText(szText + " " + szReg);
}
END_CATCH
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
I have a window that contains an ActiveMovie4 control. I set the control window to be 500 x 500 originally, then the video resizes itself to suit the file opened. How can I get this new rect?
I tried GetWindowRect(), but this only gave me the rect that I initially set as 500 x 500. I also tried GetClientRect(), but this did the same thing and moved the dialog box outside of the main window. Please Help!!!
|
|
|
|
|
I return a variant of this type from an ATL server's interface to an ASP script's object obj . len(obj) returns 0, although in a VB test application i can see a correct returned value.
Is this combination a good one? What else could i return, except BSTR?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
len(obj) returns 0,
You are supposed to use LenB instaed of Len for binary data.
|
|
|
|