|
sarojsigdel wrote: If there was a problem in program the error should always occur.
That's not true at all. I'm always amazed at how long an application can run with a memory
access bug before one little change somewhere finally causes it to visibly crash.
You may need to run the program over and over again until it crashes.
You can do this in the debugger. Or, you could run the program outside the debugger,
and attach to the process with the debugger when it crashes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
To Which process I should attach
saroj
|
|
|
|
|
Generally, whatever the name of your executable (.exe) is.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
After attaching a process what should we do
|
|
|
|
|
Hopefully you'll be able to use the stack trace and threads debug windows
to navigate to the offending line of code.
I said hopefully...
Preferrably, you want to catch it while running in the debugger so it will break
on the first-chance exception.
Or you can use the 50% rule - if it runs without crashing at least 50% of the time.
then ship it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi again
In the event of a dialog being minimized, I wish to execute a function. I have been able to pick up on the SC_MINIMIZE command (if the minimize button is clicked on), but how would you do this if the dialog is minimized by another app being clicked on (either on the taskbar, or by the app being open underneath my 1st dialog)?
Thanks for your valuable help!
69 Bay
|
|
|
|
|
Have you tried the WM_SIZE event?
|
|
|
|
|
69 Bay wrote: but how would you do this if the dialog is minimized by another app being clicked on (either on the taskbar, or by the app being open underneath my 1st dialog)?
It is not clear to me...
May be WM_SHOWWINDOW or WM_WINDOWPOSCHANGED your solution.
- NS -
|
|
|
|
|
Do you want to send WM_MINIZED to other programs?
|
|
|
|
|
Hi, I'm using VS2005Pro developing in C.
I remember being able to begin a comment section and VS would put in a template depicting function name, return value and a parameter list. Of course, the developer would have to fill in the blanks (as it were).
I thought it was something akin to '///' and on the third '/', the template would appear that I could fill in.
Does someone else know what the correct key sequence is?
Is this something that only happens for C# && C++?
Thanks!
|
|
|
|
|
Hi CP,
I have a deployment project on VC2005 SP1 and it creates a Setup.exe and a .msi file, and other prerequisite files. Actually prerequisites are Windows Installer setup files, what's really necessary for application installation is only .msi but Setup.exe is needed for me since it can get a sufficient privilege for UAC in Vista to work correctly. Directly clicking on .msi starts installation but it stops by an error in a custom action in my deployment project that requires a elevated privilege.
Basically what I want to know is how to prevent a user from clicking .msi instead of Setup.exe, I have seen other applications do it, it says "don't click .msi directly, click Setup.exe" but couldn't find how to do it without InstallShield and other products. Editing .msi with Orca is probably what I should do but can't find a relevant part.
Can anybody help me to figure it out? Thanks in advance.
|
|
|
|
|
Other forums could not get the answer my this question: When my dialog activate the text-cursor activate where in the editbox. How can I do to do this? Have you got an idea? or sample code?
What is this¿
|
|
|
|
|
What are you wanting to happen?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hakan Bulut wrote: When my dialog activate the text-cursor activate where in the editbox.
I'm not certain I understand what you want to do; maybe it's just a language issue.
|
|
|
|
|
Can you more explain what do you need exactly?
|
|
|
|
|
I am creating a small image viewer interface in MFC to do some processing on our research images which are very big in size (5000x3000). In that I am using StretchBlt to display image on DC, this works fine when I am using a scale of 1:1, but when I increase the scale, the display refresh is very slow when I use the scroll bar and the image becomes very bad when I compress an image (but I dont need to compress an image though). Is there any alternative to stretchblt().
Looking at CImage class, I can create an Image object from my current HBITMAP.
Looking at Image class from GDI+, I didnt see any constructor for Image object from HBITMAP.
Any suggestions???
thanks in advance,
-PNT
PKNT
|
|
|
|
|
Have you look at the articles here on CodeProject?
Here is one example[^]
|
|
|
|
|
instead of restretching with each redraw, you might be better off stretching once to a second bitmap, then re-blting that stretched bitmap for normal OnPaint handling.
|
|
|
|
|
I tried this way, but it displays just a white page... here is how I did it
working version
CClientDC dc(this);<br />
dib->Draw(&dc,x,y);
where dib->Draw function is defined as below-
void DIBSection::Draw(CDC* pdcDest, int xs, int ys) <br />
{<br />
pdcDest->BitBlt( 0, 0, m_size.cx, m_size.cy, m_pdc, xs, ys, SRCCOPY);<br />
}
modified version
CDC* m_pdc = new CDC ;<br />
m_pdc->CreateCompatibleDC(NULL);<br />
dib->Draw(m_pdc, 0, 0, w*zoom_const, h*zoom_const, 0, 0, w, h);<br />
CClientDC dc(this);<br />
dc.SelectObject(m_pdc);<br />
dc.BitBlt(0, 0, w*zoom_const, h*zoom_const, m_pdc, 0, 0, SRCCOPY);
where w, h are width and height of my image and zoom const is the scaling factor. dib is an object of my DIBSection class. dib->Draw does nothing more except it calls the dc->BitBlt function with its own defined dc in the Blt function, which is created when the dib object is created with bitmap data.
am I doing something wrong here??
-PNT
PKNT
|
|
|
|
|
Kiran Satish wrote: dc.SelectObject(m_pdc);
you can't select a DC into another DC.
you need to create a compatibleDC, create a compatibleBitmap (of the scaled size), select that btimap into that DC, then BitBlt from your source DC onto the scaled DC/bitmap. then you can use that scaled bitmap to draw
|
|
|
|
|
Thanks for the reply, I tried as you suggested...
<br />
CClientDC dc(this);<br />
CDC tempDC;<br />
tempDC.CreateCompatibleDC(NULL);<br />
CBitmap tempBMP;<br />
tempBMP.CreateCompatibleBitmap(&tempDC, w*zoom_const,h*zoom_const);<br />
tempDC.SelectObject(tempBMP);<br />
dib->Draw(&tempDC, 0,0,w*zoom_const,h*zoom_const,0,0,w,h); <br />
dc.BitBlt( 0, 0, w*zoom_const,h*zoom_const, &tempDC, sp.x, sp.y, SRCCOPY);
it still shows me a black image.... am I still doing wrong??, sorry I am not soo familiar with CBitmaps and DCs. Just learning now
-PNT
PKNT
|
|
|
|
|
Kiran Satish wrote: dib->Draw(&tempDC
what is Draw expecting as its first parameter (CDC, HDC, CDC*) ?
as a test, you might try something simple like drawing a rectangle (CDC::FillSolidRect) on that tempBMP, just to see if maybe the problem is in the Draw function.
also tempDC.SelectObject(tempBMP); should probably be tempDC.SelectObject(&tempBMP);
|
|
|
|
|
That draw function is same before...
<br />
void DIBSection::Draw(CDC* pdcDest, int x, int y, int nw, int nh, int xs, int ys, int w, int h)<br />
{<br />
pdcDest->StretchBlt( x, y, nw, nh, m_pdc, xs, ys, w, h, SRCCOPY);<br />
}
where m_pdc is the DC of dib where the actual pixel data is stored.
will try the simple fillrect function.
-PNT
PKNT
|
|
|
|
|
I tried to fill the DC with RED color and it still shows up as 300x300 black image ...
tempDC.SelectObject(&tempBMP);<br />
tempDC.FillSolidRect(0,0,300,300,RGB(255,0,0));<br />
dc.BitBlt( 0, 0, 300,300, &tempDC, 300, 300, SRCCOPY);
-PNT
PKNT
|
|
|
|
|
when you call CreateCompatibleBitmap, try giving it the DC you're going to BitBlt it to, not the temp DC.
|
|
|
|
|