|
Is it posible to put buttons or other controls in the view in a View-Document app? and how can I do it?
tks in advance..
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Definitely. One solution is to add the button as a member variable and call Create().
Kuphryn
|
|
|
|
|
When you use AppWizard to create your application, you could try setting the view base class to CFormView (on the last but one page of the wizard IIRC). This allows you to define your view using a dialog template.
If you have a CView derived view, then you'll have to create them dynamically.
|
|
|
|
|
Is there a native way (not through redefinition with UNION) to pass a pointer of an array by address to a function, so that the function can change the pointer and pass back the changed value?
|
|
|
|
|
Yeah. Like this:
void DoSomething( int ** p_ppiArray )
{
*p_ppiArray = new int[10];
}
void SomeOtherFunction()
{
int * a_piArray = NULL;
DoSomething( &a_piArray );
delete [] a_piArray;
}
Chris Richardson Terrain Software
|
|
|
|
|
Thanks Chris; it's working already.
I tried it with "double-ptr" in the form **array[], but that did not work.
|
|
|
|
|
Hi,
I use the commande : pDoc->OpenDocumentFile(NULL); (where pDoc is a pointeur of CMUltiDocumentTemplate) to open a new document of type CFrameView.
I'm using a tabctrl class for swicthing between multiple document in a mdi (CMDITabs from Christian Rodemeyer) and i'd like to have a top CFrameView on top even if a new document is open.
Is there a way to do this ?? Thank you very much
|
|
|
|
|
in VC 6.0, i use CHtmlView, but it can not load java swing (jdk 1.2 and above) controls.
how to solve the problem?
thx
includeh10
|
|
|
|
|
I am trying to track reams of data and am getting exhausted of opening
multiple files. Anyone have a quick method for opening somewhere on the order
of 100 files?
I suppose I could generate filenames, but how do I open them all without coding 100 separate instances of:
ofstream DataFile1;
DataFile1.open("Data1.txt", ios::out | ios::trunc);
if ( DataFile.fail() )
throw "This disk is full.\n";
|
|
|
|
|
Could you try
ofstream* df[100];
for (int i=0;i<100;i++)
{
string filename("data");
filename.append(itoa(i));
filename.append(".txt")
df[i]->open(filename,ios...
...
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"Microsoft hasn't ever enforced its patents. Apparently they keep them for defensive reasons only. Or, they could be waiting 'til they have a critical mass of patents, enforce them all at once and win the game of Risk that they're playing with the world." Chris Sells Feb 18, 2003.
|
|
|
|
|
Is there a way to use MFC support in Win32 application? (especially Property Sheet class).
|
|
|
|
|
You are asking without adding MFC support to the application? Any win32 or ATL application you can add MFC by selecting the compiler option, adding afx.h to stdafx.h and then properly initializing MFC. Create a console application with MFC support to see what is needed.
John
|
|
|
|
|
How I can color my MessageBox in red, and Button in blue.
Thus I want to create my own MessageBox with my parameters.
Thanks.
Kostya
|
|
|
|
|
|
Is there any alternative to using GetDIBits for filling the lpvBits parameter of the function. It works fine for me on Windows XP and 2000 but the function always returns 0 on Windows 98. Are there a group of function I can use in a for loop (or something like that) to get everything pixel by pixel and store it into into a buffer?
|
|
|
|
|
CDC::GetPixel will get a pixel out of a DC (create a memory DC, select the HBITMAP, get the pixels, etc)
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
I figured I would get this answer, unfortunately this would be too slow for me. Do you have any experience with GetDIBits and possible reasons the same code works fine on Windows XP/2000 and not on 98?
|
|
|
|
|
how big is the bitmap? 95/95 have GDI size limitations that NT/2000/XP don't have.
To vote with no response is to follow the way of the coward.
|
|
|
|
|
The bitmap is 544 Kb. I noticed somewhere on MDSN something about 64 KB but it mentioned that this applied to Windows 3.0...you think this is the problem?
|
|
|
|
|
georgiek50 wrote:
you think this is the problem?
it could be.
check out the GetDeviceCaps function. it can tell you if a device (the DC, in this case) supports GetDIBits, if it supports big bitmaps, etc..
-c
To vote with no response is to follow the way of the coward.
|
|
|
|
|
Apparently it supports bitmaps greater than 64K and the GetDIBits function. Any other ideas?
|
|
|
|
|
It probably doesn't like the format or color depth you're requesting the bits in. What's the code snippet?
Joel Lucsy
|
|
|
|
|
Here is the code snippet (not mine) but I also figured out a solution to the problem. As long the the bitmap width and height are evenly divisible by 4 then all is OK. I can't explain this fully:
YTE* Get24BitPixels(HBITMAP pBitmap, WORD *pwWidth, WORD *pwHeight)
{
BITMAP bmpBmp;
LPBITMAPINFO pbmiInfo;
BITMAPINFO bmiInfo;
WORD wBmpWidth, wBmpHeight;
GetObject(pBitmap, sizeof(bmpBmp), &bmpBmp);
pbmiInfo = (LPBITMAPINFO) &bmpBmp;
wBmpWidth = (WORD)pbmiInfo->bmiHeader.biWidth;
wBmpWidth -= (wBmpWidth%4);
wBmpHeight = (WORD)pbmiInfo->bmiHeader.biHeight;
*pwWidth = wBmpWidth;
*pwHeight = wBmpHeight;
BYTE *pPixels = new BYTE[wBmpWidth*wBmpHeight*3];
if (!pPixels)
return NULL;
HDC hDC = GetWindowDC(NULL);
bmiInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmiInfo.bmiHeader.biWidth = wBmpWidth;
bmiInfo.bmiHeader.biHeight = -wBmpHeight;
bmiInfo.bmiHeader.biPlanes = 1;
bmiInfo.bmiHeader.biBitCount = 24;
bmiInfo.bmiHeader.biCompression = BI_RGB;
bmiInfo.bmiHeader.biSizeImage = wBmpWidth * wBmpHeight * 3;
bmiInfo.bmiHeader.biXPelsPerMeter = 0;
bmiInfo.bmiHeader.biYPelsPerMeter = 0;
bmiInfo.bmiHeader.biClrUsed = 0;
bmiInfo.bmiHeader.biClrImportant = 0;
int iRes = GetDIBits(hDC, pBitmap, 0, wBmpHeight, (LPVOID)pPixels, &bmiInfo, DIB_RGB_COLORS);
ReleaseDC(NULL, hDC);
if (!iRes)
{
delete pPixels;
return NULL;
}
return pPixels;
}
</code>
It must have something to do with the alignment of the bytes which is done in the beginning of the function. Also trying to put in the original values retrieved from GetObject for width and height gives shady results.
What do you make of it?
|
|
|
|
|
dib scanlines have always been buffered to 4 byte DWORD boundaries.
this is so that blit functions etc do not force the processor to do expensive address fixups caused by starting on an non 32bit aligned memory address. Somewhere in the win16 / win32 sdk documentation all this was documented at sometime in the past like the early 90's. this does not mean that the actual image width has to be a multiple of 4 and should not relate to image height at all.
|
|
|
|
|
Should, could, would...it's all the same to me. After four days of debugging sessions I found the answer to the problem, if the width and height of the bitmap are evenly divisible by four it will receive the bits in Windows 98, and although this does not apply to all bitmaps tested, I will make it a personal rule of thumb to keep this rule because neither I, or anyone else I have asked can find an answer, so I will go with what works. Thanks...
|
|
|
|