|
Yes I checked on WinXp and its working there. But it has its own problem.Window gets its Original Text(Start) after Some time.
|
|
|
|
|
When I open a msg file at ms office outlook and view it via outlook spy there is this property PR_HTML but when I save it it disappears.
How did that happen?
Where can I find the html content?
thanks
|
|
|
|
|
Also I am using outlook 2003 therefore the mapi_utils I got doesnt work.
Is there an existing updated version for outlook2003?
Thanks
|
|
|
|
|
Hi,
I have one service, if it stopped normally by either stopping it thro SCM applet or user manually shutting down the system i am doing all the processing before it shuts down in Service Control handler function when it receives SERVICE_CONTROL_STOP or SERVICE_CONTROL_SHUTDOWN messages.
But I need to handle when this service is killed/stopped abruptly thro task manager or thro some other means. what message does it send to Control handler function so that i can do something here ,
or please tell me how to handle this ?
Thanks...
|
|
|
|
|
hey folks,
I've got a little snippet I wanna use to do a splash screen from a mask-image (2-bit image). well... it doesn't work
CBitmap bg_Image;
bg_Image.LoadBitmap(IDB_BITMAP1);
BITMAP bBitmap;
bg_Image.GetBitmap(&bBitmap);
BYTE *pBuffer = new BYTE[bBitmap.bmWidth * bBitmap.bmHeight];
bg_Image.GetBitmapBits(bBitmap.bmHeight*bBitmap.bmWidth, pBuffer);
CRgn newRegion;
newRegion.CreateRectRgn(0,0,0,0);
CRgn tmpRgn;
for (int y=1; y< bBitmap.bmHeight; ++y)
{
for (int x=1; x < bBitmap.bmWidth; ++x)
{
BYTE c = pBuffer[(y)*bBitmap.bmWidth + x];
if (c == 255)
{
tmpRgn.DeleteObject();
tmpRgn.CreateRectRgn(x,y,x+1,y+1);
newRegion.CombineRgn(&newRegion, &tmpRgn, RGN_OR);
}
}
}
this->SetWindowRgn(newRegion, true);
delete [] pBuffer;
The result is nothing near what I expected... some ragged & jagged dialog.
when I set a breakpoint on "tmpRgn.CreateRectRgn(x,y,x+1,y+1);"
I find that the x and y of the for-loop is not what it should be in the image!!!
any hints on how to do my splash-screen?
thx in advance
zqueezy
-- modified at 20:58 Thursday 6th September, 2007
|
|
|
|
|
All the code looks like it's for 8-bit images only (and assumes a WORD aligned width).
If the source bitmap is not 8-bitsperpixel, then you need to use bBitmap.bmWidthBytes
instead of bBitmap.bmWidth when calculating array size and offset of pixel in buffer.
Plus, if it's < 8 bpp, you need to mask out the appropriate bits to match the color.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
so for anybody who's intrested and for the sake of completeness:
BOOL CMeineFormDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
CBitmap bg_Image;
bg_Image.LoadBitmap(IDB_BITMAP1);
BITMAP bBitmap;
bg_Image.GetBitmap(&bBitmap);
int iByteSize = bBitmap.bmWidthBytes * bBitmap.bmHeight * (bBitmap.bmBitsPixel/8);
BYTE *pBuffer = new BYTE[iByteSize];
bg_Image.GetBitmapBits(iByteSize, pBuffer);
CRgn newRgn;
newRgn.CreateRectRgn(0,0,0,0);
CRgn tmpRgn;
int iOffset = bBitmap.bmBitsPixel/8;
int r,g,b,c;
for (int y=0; y< bBitmap.bmHeight; ++y)
{
for (int x=0; x < bBitmap.bmWidth; ++x)
{
c = y*bBitmap.bmWidthBytes + x*iOffset;
r = pBuffer[c+2];
g = pBuffer[c+1];
b = pBuffer[c];
if (r == 255 && g == 255 && b == 255)
{
tmpRgn.DeleteObject();
tmpRgn.CreateRectRgn(x,y,x+1,y+1);
newRgn.CombineRgn(&newRgn, &tmpRgn, RGN_OR);
}
}
}
this->SetWindowRgn(newRgn, true);
delete [] pBuffer;
return TRUE;
}
|
|
|
|
|
zqueezy wrote: int iByteSize = bBitmap.bmWidthBytes * bBitmap.bmHeight * (bBitmap.bmBitsPixel/8);
...as long as you only use bitmaps witha format >= 8 bitsperpixel
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm having a little trouble writing integer values to a file with ofstream objects. If I do ofstream::write(), then I have to pass it a char or a char*. So far, in my code, I've tried doing the following:
ofstream geomFile("C:\\file.dat", ios::binary);
geomFile.write((char*)ordX, sizeof(int) * numOrds);
geomFile.write((char*)ordY, sizeof(int) * numOrds);
where ordX and ordY are defined here:
const int numOrds = 10;
int ordX[numOrds];
int ordY[numOrds];
Basically, since I know the array is a contiguous memory location of 10 integers, I do a write starting from the pointer value of ordX and ordY through sizeof(int) (4) * numOrds (10) = 40 bytes. What I expect is to have 20 4-byte integers lined up in my file one after another. Unfortunately, when I read back from the file, I'm not getting the right result. Any ideas?
I guess I should also specify how I'm reading back the file using an ifstream object.
ifstream geomFile("C:\\geom.dat", ios::binary);
char readBuf[sizeof(int)];
int ordX[numOrds];
for (int i = 0; i < 10; i++)
{
geomFile.get(readBuf, 4);
ordX[i] = *(int*)readBuf;
}
I know the above looks a bit like a hack, but I'm sort of confused as to how I'd manipulate things in 4-byte blocks other than casting to int* and dereferencing.
-- modified at 20:45 Thursday 6th September, 2007
|
|
|
|
|
Does something like this work better?
ofstream geomFile("C:\\file.dat", ios::binary);
for (int i = 0; i < numOrds; ++i)
geomFile << ordX[i];
for (int i = 0; i < numOrds; ++i)
geomFile << ordY[i];
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm pretty sure this will write the characters to file in ASCII, won't it? I was trying to write it as binary. The thing is, I'm trying to do a minimalist database design, so writing out the x and y ordinates of 13945 and 19053 as ASCII would take 10 bytes, whereas as a 32-bit int, would only take 8 bytes.
|
|
|
|
|
Cyrilix wrote: I'm pretty sure this will write the characters to file in ASCII, won't it?
Yes. Sorry about that!
I tested your code and it writes binary fine. Reloading worked too, tested as follows:
...
for (int i = 0; i < numOrds; ++i)
{
ordX[i] = 0;
ordY[i] = 0;
}
ifstream instream("C:\\file.dat", ios::in);
instream.read((char*)ordX, sizeof(int) * numOrds);
instream.read((char*)ordY, sizeof(int) * numOrds);
instream.close();
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thanks a lot for giving this a try -- I guess it was just a matter of me using get() instead of read().
|
|
|
|
|
The software I am coding uses AfxThrowArchiveException(CArchive::none) to undo changes made by partially loading a document into the program. However, another afx message stating "Failed to open document." pops up and the operator has to again click OK on the dialog. Is there anyway to override this second message box from popping up?
|
|
|
|
|
You could override CDocument::ReportSaveLoadException() in your document class
and do something more appropriate (like not calling AfxMessageBox(), logging the
error, etc).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I know there are numerous articles on this topic, but I haven't found a solution to my problem.
From my GUI app I launch a stub process which is supposed to give me real time feedback on the output of a third console. Basically I set up the pipes and handles from the GUI, launch the stub which inturn modifies it's screen buffer and launches the real console. All the handles are inherited correctly, until I modify the memory of the real console.
I coded the stub to start the new process with the CREATE_SUSPENDED flag set, it also returns the ID's back to the GUI. From there I modify the memory and call ResumeThread(). But, for some reason, the STD_OUTPUT_HANDLE which it should have inherited from the stub has been lost. I have verified that the real console is indeed running, though it has no 'visible' screen buffer to output it's contents to.
Through inheritance, I do get the screen contents, but not in real time and without any of the modifications that the stub was supposed to perform.
Any ideas as to how or why this might have happened? Is there any way I can reset the std_output handle after a call to CreateProcess() ?
|
|
|
|
|
I don't know how why where or what, but after 6 hours of debuging, editing, rearranging and shouting at the PC, I finaly got it to work. ( I think the shouting did it ).
I can now launch a console from the resources, without writing it to disk first, and redirect it's input/output in real time.
|
|
|
|
|
I love using SuspendLayout and ResumeLayout in .Net to avoid flicker, however, these don't seem to exist for an MFC Dialog.
Is there an equivalent to use on my MFC Dialog ?
|
|
|
|
|
Are you looking for SetRedraw() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks David, that sounds like the ideal method to use
|
|
|
|
|
The controls still flicker
my overall process is:
<br />
this->SetRedraw(FALSE);<br />
<br />
pDC = this->GetDC();<br />
targetDC.CreateCompatibleDC(pDC);<br />
pOldTargetBmp = targetDC.SelectObject(&m_BmpTarget);<br />
targetDC.PatBlt(X,Y,iWidth,iHeight,DSTINVERT);<br />
targetDC.SelectObject(pOldTargetBmp);<br />
targetDC.DeleteDC();<br />
ReleaseDC(pDC);<br />
m_DialogStaticImage.SetBitmap(HBITMAP(m_BmpTarget));<br />
<br />
m_staticText.RedrawWindow(NULL,NULL,RDW_UPDATENOW);<br />
m_editBox.RedrawWindow(NULL,NULL,RDW_FRAME+RDW_INVALIDATE+RDW_UPDATENOW);<br />
.<br />
. about 15 controls<br />
.<br />
<br />
this->SetRedraw(TRUE);<br />
<br />
this->Invalidate(FALSE);<br />
<br />
this->UpdateWindow();<br />
I was surprised that it would still flicker; I was hoping that all the graphics operations were done in memory, then simply shown when UpdateWindow was called - thus avoiding flicker.
|
|
|
|
|
I don't believe WM_SETREDRAW is supported by dialogs. You can try it on the individual controls though
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
abiemann wrote: I was surprised that it would still flicker; I was hoping that all the graphics operations were done in memory, then simply shown when UpdateWindow was called - thus avoiding flicker.
Nope. Looking more closely at your code, the only way you'll be able to prevent flicker
is to do the drawing offscreen yourself, then blt the whole thing to the dialog.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Indeed, I was hoping that SetRedraw would implement double-buffering easily... but I found a good CP link that I'm studying now:
http://www.codeproject.com/gdi/flicker_free_intro.asp
EDIT:
I've compiled the "flicker free" project under VS8 and I see that the "Draw Area" flickers.
|
|
|
|
|
abiemann wrote: //no need to erase background since SetBitmap covered everything up
this->Invalidate(FALSE);
You have a static control that is used to display a bitmap. Yes? Is it overlapping the other controls such that they are requiring this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|