|
not much on google for this one...
I'd like to remove the doc/view from our application, no real need for it.
anyway.
if I do something like :
{ ...
CreateNewChild( RUNTIME_CLASS( MyOtherFrame ), IDR_BIGTESTYPE, ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_BIGTESTYPE)), ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_BIGTESTYPE) ) );
...}
when opening a new window, and doing this for other frame class, it's working fine; I don't keep the returned value from CreateNewChild since the frame and the data gets deleted
Is there's a way to iterate the framewnd to close them ? other than iterate the child windows and closing them manually. for example if I want to do a close all window, or close document.
Thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
What I've done before now is that the CMainFrame class maintains a CArray<> of CFrameWnd pointers which are children, and the OnCreate()/OnDestroy() handlers for the child frame post messages to the main frame window to register/unregister themselves...
Steve S
|
|
|
|
|
say that again ? that you kept an array on CFrameWnd or that the CMainFrame(CMDIFrameWnd) already keeps it ?
thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
In CMainFrame I had an array of CFrameWnd*, which was updated on receipt of a user defined message. The user defined message was posted when my child frames were created or destroyed. Saves iterating through via EnumChildWindows, as it only encounters child frames, not things like toolbars and the like.
Steve S
|
|
|
|
|
thanks, I tried it on a sample project, and it's working nicely,
Will see how I can integrate it into my main application.
Thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Hi there
I have written a program that takes a single frame from a video camera and writes it to a .bmp file the problem that I am having is that the .bmp is upside down. The pixel data for my image is contained in a buffer defined as:-
DWORD* pBuffer;
I have used DWORD as the image is 768 * 576 * 32 bit.
Can anyone help with a method of rearranging the DWORDS in my buffer to correct the image. I need it to display top down, not bottom up.
Thanks
Dave
|
|
|
|
|
Might be simpler than that. At some stage, presumably, you have a header for the bitmap you're writing. You might want to check the sign of the height. ISTR that sometimes some handlers object to -ve height, and invert the image. Of course, I might be talking through my hat, but it won't hurt to check...
Steve S
|
|
|
|
|
I have tried that method, I am specifying the whole bitmap structure but if I make the height negative I get an error saying something like the height needs to be greater than 0 when you try to open the bitmap in an image editor.
Thanks
Dave
|
|
|
|
|
Are you just writing the buffer directly to the file? The BMP format internally stores the image data upside down (I recall that there was actually a reason for this, but I can't remember now).
Anyway, you since you know the number of rows and the size of each row, you can just allocate a temporary buffer the same size as your original buffer, then copy rows of data from the first buffer to the temporary buffer. Something like this:
int rows = 576;
int cols = 768;
DWORD* destbuf = (DWORD*)malloc(rows * cols * sizeof(DWORD));
for (int row = 0; row < rows; row++) {
memcpy(
destbuf + (row * cols),
pBuffer + ((rows - row - 1) * cols),
cols * sizeof(DWORD)
);
}
- Mike
|
|
|
|
|
Cheers Mike I'll give that a go today. Tried to use memcopy yesterday but kept gettin exception errors and bombing out into debug. Im learning so I dont have any expirience with the debugger I havent a clue what it all meant. I'll see how it goes.
Thanks
Dave
|
|
|
|
|
Steve S is right. Get your hands on the BITMAPINFOHEADER structure located in your buffer, then negate the biHeight value. From the MSDN:
biHeight
Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.
If biHeight is negative, indicating a top-down DIB, biCompression must be either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed.
[edit]For clarification, Michael is also right. His solution will work, it just depends on what you really want to do.[/edit]
Chris Richardson
|
|
|
|
|
Chris Richardson wrote:
Get your hands on the BITMAPINFOHEADER structure located in your buffer, then negate the biHeight value.
I have tried that method, I am specifying the whole BITMAPINFOHEADER structure myself but if I make the height negative I get an error saying something like the height needs to be greater than 0 when you try to open the bitmap in an image editor.
Thanks
Dave
|
|
|
|
|
Hello,
How can I open a browser without address bar ?? Which line argumets ??
[]'s
Cris.
|
|
|
|
|
IE supports the following command-line switches:
-new
-remote
-k
-nohome
-embedding
-channelband
-e
-v
I'm not sure which, if any, would affect the address bar.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Ok thanks, but where can I find any documentation about this ??
[]'s
Cris.
|
|
|
|
|
Try here for starters. Googling also works.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I have a CDialog class that spawns another CDialog class. This second CDialog spawns yet another CDialog class. From dlg #3 I sendmessage to dlg#2 using m_pParentWnd (in which I save the "this" passed in the create function when dlg #3 was created modelessly by #2) . But the code never steps into the handler in #2 which is supposed to respond to my message. What am I doing wrong or not doing?
Thanks
LRESULT CImageDisplay::OnUDMPlusMag(UINT nDummy1, UINT nDummy2)
{
m_zoomFactor += 10;
double zoom = m_zoom *m_zoomFactor;
m_THBImage.SetZoomFactor(zoom);
m_THBImage.Redraw();
return 0;
}
ON_COMMAND(UDM_PLUSMAG, OnUDMPlusMag)
afx_msg LRESULT OnUDMPlusMag(UINT nDummy1, UINT nDummy2);
BOOL CDlgSettings::Create(UINT nIDTemplate, CWnd* pParentWnd)
{
m_pParentWnd = pParentWnd;
return CDialog::Create(nIDTemplate, pParentWnd);
}
void CDlgSettings::OnBplus()
{
m_pParentWnd->SendMessage(UDM_PLUSMAG, 1,1);
}
|
|
|
|
|
You're sending the wrong message;
The entry in the message map expects a WM_COMMAND message, but you want to send a user-defined (or Registered) message, so it never hits where you want, because the WM_COMMAND didn't arrive.
Steve S
|
|
|
|
|
That was it! Many thanks.
|
|
|
|
|
Hi,
Iam new to the field of image processing. What iam looking for is a library preferably in C++, Java or even C# that has functions to manipulate bitmap images.
Anyone have any ideas?? i know there are lots of libraries out there but dummy me ... i havent been able to find any source code.
All you need is just a little patience ...
|
|
|
|
|
Have you looked here:
http://www.codeproject.com/bitmap/
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am having a problem with the StreamIn member function of the rich edit control. For some reason my callback function is not getting called. When I place a breakpoint inside my callback function and trace execution to the StreamIn function, I press f10 ( trace over ) and StreamIn returns with 0 bytes read and my callback never gets called! Does anyone have any ideas?
|
|
|
|
|
Post the declaration etc of your callback, and show the initialisation of the EDITSTREAM block, and that might give us a few more clues...
Steve S
|
|
|
|
|
my call back is declared like so :
DWORD CALLBACK StreamCallback( DWORD Cookie,LPBYTE lpBuff, LONG cb, LONG *pcb )
Here is the es and the call to StreamIn
EDITSTREAM es;
es.dwCookie = int(&FormatMessage);
es.dwError = 0;
es.pfnCallback = StreamCallback ;
this->StreamIn( SF_TEXT, es );
|
|
|
|
|
Do you mean (int)&FormatMessage, by any chance? Presumably FormatMessage is one of your variables, rather than the Win32 API function. The actual name will probably be munged to FormatMessageW or FormatMessageA, in any case, which is just an added obfuscation that shouldn't affect you.
Presumably your StreamCallback isn't a member function of a class?
It shouldn't be, unless it's also static.
Steve S
|
|
|
|