|
Hi all,
I'd like have some MDI child windows (Form View) like model dialogs, so that after closing the dialog only, I should even be able to access the main window (toolbar/menu/close button).
How to make it possible?
Thanks in advance,
Sarvan AL
|
|
|
|
|
So - what you want is a modal dialogue with a FormView(-derivation) inside?
There should be a few examples lying around here on CP.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi, is there any VC++ add-in to automate variable/class renaming ?
|
|
|
|
|
on't know any for C++, but you could search for refactoring to get more answers...
|
|
|
|
|
Its called RefPP[^]and works quite well as my limited testing showed.
Also, the guys at refpp.com are quick with help and service.
All in all a fine tool!
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Some time ago I happened upon an article (or maybe just a program )- with source code in C++, almost certainly MFC - implementing graphically a New York City/Manhattan path algorithm: that is a orthogonal polyline each of whose points' moves were constrained to the X and Y directions.
I think I saw it here on The Code Project.
Can somebody please point me to it?
TIA
alex
'Architecture is music frozen in space.'
|
|
|
|
|
|
Thank you for answering, but no.
It was either MFC or WIN32 (before C#, .net etc)
What I do remember, the demo drew a polyline (orthogonal segments only) and allowed the user to move those points while keeping the orthogonality.
alex
'Architecture is music frozen in space.'
|
|
|
|
|
Hi - I don't usually like to post questions which are "here's some code - why doesn't it work?" but I am well and truly stumped on this one...it's been more than a whole day's effort so far and it is 1025 on friday night and i'm still working on it....so i'd really appreciate some help...
I have two functions, one takes a buffer, turns it into PGM format (P6) and saves it to file....the other takes the buffer, turns it into PGM format in place and the calling function then returns the buffer and it is displayed
the saving to file one works a treat
<code>
/*
* writes a colour PGM file from a buffer
*/</code>
<code>
int write_P6(char *name, int W, int H, unsigned char *buf)
{
FILE *f;
int i, j;
if( (f = fopen(name, "w")) == NULL)
{
printf("Could not open >%s<\n", name);
return FALSE;
}
fprintf(f,"P6\n %d %d\n 255\n",W, H);
fflush(f);
for(i=0;i<H;i++)
{
for(j=0;j<W;j++)
{
fwrite(buf + (i * W + j)*3+2, 1, 1, f);
fwrite(buf + (i * W + j)*3+1, 1, 1, f);
fwrite(buf + (i * W + j)*3 , 1, 1, f);
}
}
fclose(f);
return TRUE;
}
</code>
and I am able to display the images just fine, but obviously this is sub-optimal and the disk accesses makes it real slow
so i want to use this function instead
<code>
/*********************************************************************/
/*
* changes a rgb buffer in place into PGM format without saving to disk
*/
int make_P6(int W, int H, unsigned char *buf)
{
int i, j;
unsigned char* temp;
temp = (unsigned char*)malloc(x * y *3+15);
sprintf(temp, "P6\n %d %d\n 255\n",W, H);
for(i=0;i<H;i++)
{
for(j=0;j<W;j++)
{
sprintf(temp, buf + (i * W + j)*3+2);
sprintf(temp, buf + (i * W + j)*3+1);
sprintf(temp, buf + (i * W + j)*3);
}
}
buf = (unsigned char*)realloc(buf, x * y *3+15);
buf = temp;
free(temp);
return TRUE;
}
</code>
the calling getframe function looks kinda like this:
<code>
unsigned char * getframe(int save_file)
{
int ret ;
ret = read(fd1, s, x * y);
if( ret != (x * y ) )
{
printf("We will have fragmented picture\n" );
}
nb_frame ++ ;
bayer2rgb24(d, s, x, y);
// at this point we should have a raw, RGB image
if( save_file )
{
write_P6("P6.pgm", x, y, d);
}
else
{
d = make_P6(x,y,d);
}
return d;
}
</code>
and the function which calls getframe knows whether to disregard the return value and open the file, or look at the return value for the pic....
now the problem comes in make_P6 --> the code just hangs at
<code> sprintf(temp, buf + (i * W + j)*3+2);
sprintf(temp, buf + (i * W + j)*3+1);
sprintf(temp, buf + (i * W + j)*3);</code>
- if i comment out these lines, there is no freeze (but clearly, nothing sensible happens to the image)....but if i leave them there, it just kinda waits....doing nothing....not crashing.....not taking up heaps of resources
it doesn't make any sense to me because the line
<code>sprintf(temp, "P6\n %d %d\n 255\n",W, H);</code>
works just fine....
i'll be eternally grateful if somebody can give me a hand
XX georgia
-- modified at 8:40 Friday 7th April, 2006
|
|
|
|
|
georgie.moss wrote: sprintf(temp, buf + (i * W + j)*3+2);
sprintf(temp, buf + (i * W + j)*3+1);
sprintf(temp, buf + (i * W + j)*3);
Of these three statements, only the last one is of any use since they are all writing to the same address. Is this your intent?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
sprintf expects to be working with NUL -terminated strings. If the buffer pointed to by buf + (i * W + j)*3+2 is garbage or does not have a NUL , it will keep looking for one. If that buffer contains a % it will try to format a value based on the contents of the stack, which would be bad considering to additional parameters are passed.
Are you sure you are not trying to do something like:
temp = (unsigned char*)malloc(x * y *3+15);
DWORD dwIndex = 0;
sprintf(temp, "P6\n %d %d\n 255\n",W, H);
for(i=0;i<H;i++)
{
for(j=0;j<W;j++)
{
DWORD dwBufIndex = ( i * W + j ) * 3 + 2;
temp[ dwIndex++ ] = buf[ dwBufIndex ]; <code>
temp[ dwIndex++ ] = buf[ --dwBufIndex ]; <code>
temp[ dwIndex++ ] = buf[ --dwBufIndex ]; <code>
}
} My math/indices may be off but I am sure you get what I am talking about...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
thanks - changing from sprintf to direct buffer manipulation did the trick
really appreciate the help
|
|
|
|
|
Hi
I am trying to add a couple of items to the status bar in my SDI app, i can add one item on no problem, but when i add a second one on,
i get a message box appear saying "failed to create empty document"
in MainFrm i have
static UINT indicators[] =
{
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
ID_INDICATOR_COUNT,
};
in the OnCreate
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetPaneInfo(3,ID_INDICATOR_COUNT, SBPS_STRETCH, NULL );
in my resource.h
#define ID_INDICATOR_COUNT 59142
but if i try to add another option on i get the error
any ideas ??
Si
|
|
|
|
|
IIRC, status bar indicators need to be string table entries, so try adding a string table entry for ID_INDICATOR_COUNT . Note that string table entries cannot be blank, and you will want to use enough characters for the width that the indicator will need.
For example, if you need to show a value range of 0-999999, I would create the string table entry with a string of "000000" . You can set the value of the indicator using an ON_COMMAND_UPDATE_UI for the ID_INDICATOR_COUNT "control".
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
How much of characters could I store in a CString? I am having a function in which a CString has to be accepted. The input may be extremely large (Say about 700 pages, with 300 characters each page). Will CString be able to manage this? I know that I can chop the input to pieces and go ahead with the work. But I want to know how effective will be CString able to do this job. Thanks for your time..
Aljechin Alexander
|
|
|
|
|
Aljechin How much of characters could I store in a CString? I
A CString can hold up to MAX_INT (2 billion) characters.
hope that helps
Si
|
|
|
|
|
si_69 wrote: A CString can hold up to MAX_INT (2 billion) characters.
I think it's suports only 64KB, taking the amount of a new memory allocation. Am I wrong?
|
|
|
|
|
Mihai Moga wrote: Am I wrong?
sure you are... it accepts up to 2 GB !!!
where di you get such an information ?
|
|
|
|
|
v2.0 wrote: where di you get such an information
MSDN for Windows 3.1
No offence meant, Mihai!
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
lol
ok, i understand better
|
|
|
|
|
Even if CString is able to store so much data, I don't think it is a good idea. Why do you want to store all this data in one CString ? What do you need to do with this data ? A better solution would probably to look at the data as smaller block and deal only with a single block at one time.
Just a suggestion.
|
|
|
|
|
Yes yes. That is what I am exactly doing. But its crucial to complete the task soon as possible. The input comes from a microprocessor and the data is about the turbulence, velocity, temperature, etc of water flowing out of a dam. The input comes extremely fast. The faster we could complete the task and log it, the better it is. Thats why I asked this question. Thanks all.
|
|
|
|
|
If you are already getting that data as a LPCTSTR (or const char * ) stream, there is no reason to go through the overhead of putting that data into a dynamically-allocated buffer (the CString ). If speed/performance is important, I would check to see if you can pass the data directly to the processing functions.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I did not put anything into a CString. Everything is unsigned char * here. That question just came into my mind.. So asked here. Thanks all.
|
|
|
|
|
And how do you communicate with the microprocessor ? You receive data for example on the serial port ?
I don't think this is a great idea to store everything in a CString. They are used for string manipulatino and not as data buffer (I suppose that the data you are receiving is not only characters but also 'binary' data). And why not open a file at the begining of the communication and store everything there. Or even write your own data class that will take care of the format of the data. This could be quite fast if you design it well.
|
|
|
|
|