|
AOA!
last night as i was trying to do one of my Assignments i tried to open a form using my Class inherted from CFormView!
the problem is that i was able to show the form as i want but as i close this window using the CWnd::DestroyWindow() i get an Assert Failure!
the Code i am using to initialize the window is as follows:
//defined in MyClass.h;
CMyClass Form;
CMyMainView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CRect Rect;
GetClientRect(Rect);
Form.Create(NULL,"NewForm",WS_VISIBLE|WS_BORDER|WS_CHILD,Rect,this,1234,NULL);
}
And to Destroy the Window
CMyMainView::OnFileNew()
{
Form.DestroyWindow();
}
i cant understand y i get the assert failure when i click the new button on the toolbar!
the Assert Failure Message i get is as follows:
Debug Assertion Failed!
Program:E:\Chummi.exe
File:dbgheap.c
Line:1101
Expression:_CrtIsValideHeapPointer(pUserData)
//bla bla bla
plz help!
shoaib!
|
|
|
|
|
Here's my issue:
(note: this is x-posted in OS/Admin)
I'm calling an instance of IE from an NT service. If the
currently logged-on user is using a proxy server in their
profile, this setting is never seen by the instance of
the browser tht I just spawned. Starting the browser as
the correct user doesnt help either.
So, my question is: Does anyone know of a way to make
Internet Explorer read the correct user profile when I'm
spawning it? Or is everyone that uses a proxy setting
screwed if they run my software?
Thanks...
....alan
|
|
|
|
|
showing the screen....
Hello,
I'm creating an MFC application that does a heavy process consisting of file I/O and database handling. It's an SDI application.
The application has a modeless dialog box that informs the user about what is currently being done by it.
It works fine.
My problem is that if I minimize it while it's processing, or if I click on anohter window to do other stuff while my program processes, and then I try to show it again (clicking on it on the task bar), it won't appear until the processing is finished. But this is not what I want for two reasons:
1. it's a heavy and long processing, so the user need to be able to SEE what the program is doing, to feel that's working and not 'frozen'.
2. it's a long processing, so the user will most like do other stuff in his PC meanwhile.
So what I need is that when the user clicks on it the form appears.
How can do this?
-- narada
|
|
|
|
|
You need to do your task in another thread. This is a large issue, but I bet that there is a lot of CP articles on threading.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Could i simply use AfxBeginThread?
Thanks
|
|
|
|
|
search for 'worker thread ' here on cp.
Your program can show no reaction, because you never give windows a chance to process any messages.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Is there any way to solve this apart from Threads?
|
|
|
|
|
my pgm was using GetPixel() function, but i realize not all device support the function and that we can use GetDeviceCap() to check its RC_BITBLT capability. so though i'm not exactly sure how to use the function, i tried the following..
int test = dc->GetDeviceCaps(RASTERCAPS);
(1)It returns me a negative value(-4349)...what does this mean? What shld the function return me if my device has RC_BITBLT capability anyway?
(2)If my device doesnt have the capability, what can i do to have the capability? And what determines whether a device has the capability?
thks
|
|
|
|
|
I think it is merely:
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
If your display doesn't support raster operations, then I guess
there are no pixels? Render to an offscreen bitmap and test that
or directly test against the model from which the display is drawn.
(if it is yours)
|
|
|
|
|
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
gives me compilation error...should there be a bracket somewhere?
anyway my dc is defined as below,in my CView class...so shouldnt it have pixels?..
CDC *dc=this->GetDC();
Anyway how do i render to an offscreen bitmap?
thks
|
|
|
|
|
You render to an offscreen bitmap by creating a memory device context for the bmp, or MemDC. You can then blt (BitBlt) to the memDC before blitting to the screen (or other DC).
Something like:
CDC MemDC;
// Get the current DC and create a compatible memDC
MemDC.CreateCompatibleDC(pDC);
// Can now Blt to the MemDC...
// Do stuff - draw, render, etc...
// Don't forget to clean up..
MemDC.SelectObject();
|
|
|
|
|
Guess it'll have to read up on that. But do you know how do i test after i've BitBlt it to offscreen bitmap?
thks
|
|
|
|
|
But if the display device doesn't support blit operations
(RASTERCAPS was RC_NONE) then he won't be able to draw
to the offscreen image and blit as the last step. He will
have to draw to both DCs instead, using the
offscreen image merely for examination.
|
|
|
|
|
I just wanted to report this bug and check if anyone else has come across it:
In Visual C++ 6.0, when using the MFC Appwizard to create an MFC project with the following settings:
- single doc & NO doc/view support
- NO toolbar & NO statusbar
And then compiling the skeleton program code without applying any changes, the resulting exe crashes on startup. Apparently the child window for the view is not created correctly, because when the frame window tries to set the focus to it, it's window handle is invalid.
This only seems to happen with the exact settings described above.
|
|
|
|
|
Install Visual Studio Service Pack 5 - it's fixed.
#include <beer.h>
|
|
|
|
|
Can somebody provide me some links or code which will read a JPEG,GIF and display it in a window .Iam doing a MFC project
|
|
|
|
|
did you try searching this site? (maybe in the Bitmap and Palettes section?)
there are like a dozen articles that show you how to do this.
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
You can display JPEG, GIF with the help of List Control (CListCtrl). One method "SetBkImage()" of CListCtrl class allowed JPEG,GIF images to display.
C.R.Naik
|
|
|
|
|
Take a look at CxImage. It's a great image processing library with support for TONS of different image formats.
http://codeproject.com/bitmap/cximage.asp[^]
Good Luck!
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
If you are using MFC 7, you can use the new CImage class.
Art
|
|
|
|
|
1) Create a SDI application deriving you view from CHtmlView and display a HTML page with an image format of anything you want.
or
2) Embed a webbrowser control in a dialog application and do the same thing.
or
3) If you are using MFC 7 you can derive you dialog from CDHtmlDialog and display the html page.
Art
|
|
|
|
|
why does my Autocompletion don't work. I'm my Constructor it does work, but wenn i make a function it doesn't work anymore.
the program compiles without errors
|
|
|
|
|
There are probably several reasons why it doesn't work consistently. I venture to say that most experienced C++ developers have accepted that it doesn't work all the time, and we simply don't rely on it.
The most common cause for it not working is when there's a syntax error higher in the source code.
Regards,
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
I am Playing Enhanced MetaFIles around the Rectanges,Ellipses .. etc with rotation.But taking lot of time for play around the objects.How to imporve the speed?I don't show the end user to How I am playing?
((IMP: Actually I am loading files are derived from eps.
ie means I was opened eps files in corel draw the saved as Emf file.
But If run emf file derived from corel draw(directtly) no prob))
I wrote following code for ellipse
ENHMETAHEADER *pEnhHeaderData;
pEnhHeaderData = (ENHMETAHEADER *) meta_data;
hemf = ::SetEnhMetaFileBits( pEnhHeaderData->nBytes, (unsigned char*) meta_data );
GetEnhMetaFileHeader(hemf, sizeof(emh), &emh);
int x_radius=w/2;
int y_radius=h/2;
for(int i=0;i<360;i+=30)
{
//First File
hdcEMF = CreateEnhMetaFile (NULL, NULL, NULL, NULL) ;
angle=360-i;
EnumEnhMetaFile (hdcEMF, hemf,EnhMetaFileProc, NULL,(RECT *)&emh.rclBounds) ;
h1 = CloseEnhMetaFile (hdcEMF) ;
double a1=(i*3.14)/180;
int x_point1 = rect.left + center.x + cos(a1) * x_radius;
int y_point1 = rect.top + center.y + sin(a1) * y_radius;
SetRect(&rect1,x_point1-ezpn_frame_edge,y_point1-n_frame_edge,x_point1+ezpn_frame_edge,y_point1+ezpn_frame_edge);
pDC->PlayMetaFile(h1,&rect1);
}
|
|
|
|
|
Respected sir,
i am getting errors on building the ovoicechatt.ocx
file.please send me the whole voice chat project without errors and in running condition as i am in much need of it for my project work.i will be very happy if you send me the whole project.please sir,it's very urgent for me.send me today itself if possible.
thanking you,
vignesh
vignesh
|
|
|
|