|
I have created a project a while back.. anyway, I selected not to have active x objects in my project.. now a few weeks later I decided that I need to put an active x object into my dialog project.. but when I put the object into the project the dialog box will no longer appear when its launched.. any ideas?
If I remove the object the dialog box will appear.. its a Microsoft web browser active x object.
Thanks
Rob
|
|
|
|
|
Or The activex is not registered or you forgot to add AfxOleInit() in the InitInstance of your project....
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hi, veterans, how can I delete a character in CRichEditView?
|
|
|
|
|
First you need to use CRichEditCtrl::SetSel and select the text or character that you need to delete, then CRichEditCtrl::ReplaceSel replazing your selection for "" and ready
Best Regards!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Thanks, Carl, this is great.
|
|
|
|
|
i have a dialog that looks like this:
+-------------+
| +---------+ |
| | A | |
| +---------+ |
| |
| +---------+ |
| | B | |
| +---------+ |
+-------------+
A and B are static frames that may hold other controls.
i want to be able to dynamically resize it so that it is either just big enough to hold the "A" rectangle or big enough to hold both A and B. to keep it easy, the width never changes.
so, what's the secret to getting the height correct? i'm doing this:
CRect dispRect;
m_dispBox.GetWindowRect(dispRect);
ScreenToClient(dispRect);
dispRect.NormalizeRect();
CRect normalRect;
m_normalFrame.GetWindowRect(normalRect);
ScreenToClient(normalRect);
normalRect.NormalizeRect();
int w = normalRect.left + normalRect.Width() + GetSystemMetrics(SM_CXDLGFRAME) * 2;
int h = normalRect.top + normalRect.Height() + GetSystemMetrics(SM_CYDLGFRAME) * 2;
if (bShow)
{
h += dispRect.Height();
h += (dispRect.top - normalRect.bottom);
}
SetWindowPos(&wndTop, 0,0, w, h, SWP_NOMOVE | SWP_NOZORDER);
but the dialog is just a little bit too small to hold the bottom frame. - the bottom frame's bottom is clipped.
-c
Smaller Animals Software, Inc.
|
|
|
|
|
I prefer to use GetWindowPlacement and SetWindowPlacement when I work with resize of controls...
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
|
With GetClientRect() you get the dimension of the client rect.
I prefer to use GetWindowPlacemente because it has the rcNormalPosition member in the WINDOWPLACEMENT struct, when I change the size of each control I use SetWindowPlacement..... Try this
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
|
Hi all, I have a small crappy problem. When I load a bitmap I retrieve its width and height, and I want to make the screen view the exact same size. However, I also want to prevent the frame being resized over this size, and so I have managed to implement a system which takes care of it. However, all of the code is situated in the Child Frame class, where the maximum tracking sizes are specified. I then go on to use SetWindowRect(). The problem I get though, is that when using SetWindowRect() the whole width of the window AND frame is set the bitmap dimensions, which means part of the bitmap is obsured by the frame. I have implemented my own offset (to account for the frame), and it works on my computer (or any other with a 19inch monitor), the trouble is I have to demo my app on the computers in Uni, and their monitors are 15inches (and I run XP, they run win2k which means the border sizes are different too), which means the frame will be out of sync with the image (I have tested this). Anyway, how could I get it to set the window and view to the right size? Can I obtain a border offset value? or is there a better way of achieving what I want?
Cheers all,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Try adjust the rectangle using "AdjustWindowRectEx".
Normski. - Professional Windows Programmer
|
|
|
|
|
Took me a while to get it going, but it worked an absolute treat, thank you for the response Norm.
Much Appreciated,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Hello,
I am looking for a listCtrl with editable items and checkBoxes.
Anyone know where I can find it?
Where there is a WISH, there is a WILL.
|
|
|
|
|
Use the extended Styles for List Contorls.
|
|
|
|
|
For editable items, handle LVN_BEGINLABELEDIT. For checks, set the LVS_EX_CHECKBOXES extended list style.
--Mike--
http://home.inreach.com/mdunn/
Help! Help! I'm being repressed!!
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
When we are extracting data with serialize( ar >> some_variable >> another_one >> etc. ) is it possible to 'rewind' and begin again, for instance, if we don´t find a desired value?
|
|
|
|
|
Yes. But you should destruct the file's CArchive before rewinding the CFile, and create a new CArchive after rewinding. This will ensure the archive's data integrity.
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Thanks.
So, how could I do it in this small sample code:
void CMeteoGraficaDoc::Serialize(CArchive& ar)
{
CDocument::Serialize(ar);
if (ar.IsStoring())
{
ar<<datosF.dia<<datosF.mes;
}
else
{
ar>>datosF.dia>>datosF.mes;
// if (datosF.dia != some_value) ...... rewind and begin to serialize.
}
}
|
|
|
|
|
Hmmm, I must have been brain dead when I posted my earlier reply. You can rewind the file during serialization.
void CMeteoGraficaDoc::Serialize(CArchive& ar)
{
CDocument::Serialize(ar);
if (ar.IsStoring()) {
ar<<datosF.dia<<datosF.mes;
}
else {
ar >> datosF.dia>>datosF.mes;
if (datosF.dia != some_value) {
CFile* pFile = ar.GetFile();
ASSERT (pFile != NULL);
pFile->SeekToBegin();
ar >> datosF.dia>>datosF.mes;
}
}
} /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ok, thank you so much
I´ll try it.
|
|
|
|
|
I get it working, but I´ve had to add:
CFile* pFile = ar.GetFile();
ASSERT (pFile != NULL);
pFile->SeekToBegin(); // rewind
ar >> datosF.dia>>datosF.mes; // retry
CArchive ar(pFile, CArchive::load); //this one added
Thank you, so much.
|
|
|
|
|
Hi, Can anyone tell me how I can move an image into DIB? I hard coded my program to display images onto the screen correctly with 32bit/pixel, and now the program doesn't work when the screen is set to another color bit depth.
Chris Becke's GDI tutorial was very helpful and led me to the GetDIBits and SetDIBits functions. I am planning to use GetDIBits(HDC, HBITMAP...) for converting my image to DIB, but I don't know what I should put in for HDC. The only context I can think of is my screenDC, but I doubt it is looking for my screenDC, rather, it's looking for the DC I originate my bitmap from... Is this correct? If so, then how can I create a DC for my image? My image is a string of BYTES with xBGRxBGRxBGRxBGR... where x is an unused byte.
Thanks in advance for the help!
|
|
|
|
|
try:
HBITMAP hDib = (HBITMAP)::CopyImage(bmp, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG | LR_CREATEDIBSECTION);
'bmp' can be a DIB, DDB or CBitmap, the returned 'hDib' will be a DIB.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Great! Thanks for the CopyImage tip. I'll give it a try. One more question, how does CopyImage know the bit depth of 'bmp'? Is there a flag in there where I set?
This is how I am creating my bitmap:
<br />
CClientDC screenDC(pView);<br />
<br />
bitmapBefore.CreateCompatibleBitmap(&screenDC, sizeBefore.cx, sizeBefore.cy);<br />
bitmapBefore.SetBitmapBits(sizeBefore.cy*sizeBefore.cx*4, imageBuffer);<br />
where imageBuffer is my Byte string with xBGRxBGRxBGR...
Right now image only displays properly for 32bit/pixel displaying modes, and that's because I'm grabing DC from screen. Since the screen and my image are both 32bit/pixel, the image displays correctly. How do I make the bitmap have the information of 32bit/pixel when my screen DC is not? I have to replace CreateCompatibilityBitmap with something else don't I?
Thanks again!
|
|
|
|