|
|
Nope, because even if the bitmap handle is invalid, it is still selected in the DC. It would be an overkill, if Windows had to check, if any selected handle is still valid, when it deletes a DC.
Regards
Thomas
Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
Thanks Thommi. I have actually sent the sample app. But it's only a sample protoype. I'll correct this issue in the final release
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
question: don't you need to delete the memory DC you created? I remember I read such a sentence in a VC++ book:
whenever you create something, you take the responsibility to delete it, otherwise, there would be resource leak.
so the code would be:
CDC memDc = dc.CreateCompatibleDC();
......
memDc.DeleteDC();
|
|
|
|
|
Why is CDocument::DoSave undocumented???
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
It's semi-documented. They mention DoSave in MFC Technical Note 22. There's also KB article Q141921.
Are you trying to support multiple file extensions per doc type?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Are you trying to support multiple file extensions per doc type?
Nope.
My SDI app is a msp-image to bmp converter (msp is a funny custom image format and no one ever heard of it)
So I want file-open to show *.msp and file-save to show *.bmp
Nish
p.s. issue is solved now. DoSave did the trick for me
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
hi,
I do paint some images on a window dynamically.
while painting if i maximise & minimise some other window over that.Then image won't be disaplyed properly.
anybody has any idea,why it is happening so?
Neha
|
|
|
|
|
During handling of WM_PAINT, or any message processing for that matter, you (obviously) can't recieve and handle another message. Therefore, if your message processing is lengthy it would look like your application is frozen/hung.
Perhaps it could work better if you did your painting to an off-screen bitmap and just blitted it to your window on WM_PAINT?
|
|
|
|
|
Hello
I have an SDI app. Basically it opens files of type *.MSP [a custom image format unheard of previously].
Now this is my IDR_MAINFRAME in the string table :-
Msp File Viewer/Converter\n\nMspTes\nMsp Files(*.msp)\n.msp\nMspTest.Document\nMspTes Document
Now my problem is that when I open files I want to get *.msp and only *.msp
But when I save my file I want to get *.bmp
My program can open only msp files and it can save only bmp files
It's an msp-to-bmp converter
How do I have different default documents for OnOpenDoicument and OnSaveDocument???
Regards
Nish
p.s. I also tried to override the OnSaveDocument save-dialog, but failed
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
How do I have different default documents for OnOpenDoicument and OnSaveDocument???
That I think you can't really do, but how about just overriding CDocument::OnSaveDocument or CDocument::DoSave and changing the extension?
|
|
|
|
|
Mike Nordell wrote:
CDocument::OnSaveDocument
I tried overriding this. But by the time it reaches here, the save-dialog has already been shown and dismissed!!!
Mike Nordell wrote:
CDocument::DoSave
????
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
How 'bout just adding a command handler for ID_FILE_SAVE ?
--------
Life is fraught with opportunities to keep your mouth shut. --Shog9 --
|
|
|
|
|
Hi...
I have a Com structure which gets populated at the server side and the reference is passed to VB.
The VB side (Application) populates it in a grid (20 rows in the grid).
A Navigator button has been provided which fetches data from Structure and refreshes the grid.
My Problem is after navigating for a few times,the whole application fails with the message of RunTime error saying..
Run Time error '-2147024882(8007000e)
System Error &H80004005 (-2147467259)..
I fail to understand its resolution..
Also around 6000 records get populated in the structure at a given time and it is a heirarchical type of structure with child nodes in it..
I am the best because i work with the best
|
|
|
|
|
Using "Error Lookup" tool in VC++, the message is: Not enough storage is available to complete this operation.
That may have nothing to do with the struct.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Gee...Forgot that one!!
Thanks Michel...
|
|
|
|
|
Where is the documentation on those, if it exists?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Which components and controls? MSDN is the fountain of knowledge for all Microsoft controls and components.
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
When you select Project | Add To Project | Components and Controls.... I would like to know where is the documentation for those.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
The only documentation I'm aware of, is when you click the more info button. It will launch help files for those components which have help files. Sadly the documentation is very poor.
Do you need help with any particular one, or just a general overview?
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
Following para is copied from "Inside c++ ,Version 4.0",when i runing it in my test dialog based program,I cant't see icon(I have builted it well).Please help me,Thank you!
BOOL CListImageDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, TRUE); // Set small icon
// TODO: Add extra initialization here
//Following line is added by me
//*************************************************
HICON hIcon[8];
CImageList m_imageList;
int n;
m_imageList.Create(16, 16, ILC_COLOR16|ILC_MASK, 8, 8); // 32, 32 for large icons
hIcon[0] = AfxGetApp()->LoadIcon(IDI_ICON1);
hIcon[1] = AfxGetApp()->LoadIcon(IDI_ICON2);
hIcon[2] = AfxGetApp()->LoadIcon(IDI_ICON3);
hIcon[3] = AfxGetApp()->LoadIcon(IDI_ICON4);
hIcon[4] = AfxGetApp()->LoadIcon(IDI_ICON5);
hIcon[5] = AfxGetApp()->LoadIcon(IDI_ICON6);
hIcon[6] = AfxGetApp()->LoadIcon(IDI_ICON7);
hIcon[7] = AfxGetApp()->LoadIcon(IDI_ICON8);
for (n = 0; n < 8; n++) {
m_imageList.Add(hIcon[n]); }
static char* color[] = {"white", "black", "red",
"blue", "yellow", "cyan",
"purple", "green"};
CListCtrl* pList =
(CListCtrl*) GetDlgItem(IDC_LISTSSS);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
n=m_imageList.GetImageCount();
for (n = 0; n < 8; n++) {
pList->InsertItem(n, color[n%7], n%7);
}
//pList->SetBkColor(RGB(0, 255, 255)); // UGLY!
//pList->SetTextBkColor(RGB(0, 255, 255));
//**********************************************************
//Following line is added by me
return TRUE; // return TRUE unless you set the focus to a control
}
|
|
|
|
|
m_imageList is a local variable (not a member, which is what the m_ normally indicates). It gets destroyed at the end of the function, and destroys the underlying image list too.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
Michael Dunn:
Thank you very much,You are so kind and smart.
Thank you!
|
|
|
|
|
I have a function which takes the IShellFolder object for a folder as a parameter, and loops through all the items in the folder. If it is a file, it adds it to a ListView control, and if it is a folder it calls itself. But the first time the function encounters a folder and calls itself, the pIShell->EnumObjects returns the error code -2147023673 which, according to the Error Lookup, is "The operation was canceled by the user.".
Can anyone figure out what's wrong? Here's the code:
void AddFilesFromFolder(IShellFolder *pIShell)
{
if (pIShell)
{
IShellFolder *pBrowse = NULL;
LPENUMIDLIST pFolder = NULL;
LPMALLOC pMalloc = NULL;
ITEMIDLIST *pNewId = NULL;
STRRET strDispName;
LVITEM lvItem;
DWORD pActual = 0;
DWORD dwAttrib;
IShellFolder *CurrentFolder;
HRESULT err;
err = SHGetDesktopFolder (&CurrentFolder);
if (err == NOERROR)
{
SHGetMalloc(&pMalloc);
err = pIShell->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (err == NOERROR)
{
lvItem.mask = LVIF_IMAGE | LVIF_TEXT;
while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
{
dwAttrib = SFGAO_FOLDER;
pIShell->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
if (!(dwAttrib & SFGAO_FOLDER))
{
pIShell->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
GetID3();
FillInfo();
ListAddItem();
}
if (dwAttrib & SFGAO_FOLDER)
{
CurrentFolder->BindToObject(pNewId, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
Add2(pBrowse);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
}
Thanks all!
-Rune Svendsen
|
|
|
|
|
I have a set of code in VC++ where I feel it takes time to populate the data. How to find out what code is taking lot of time. How to tune it? I don't have profile options in VC++.
|
|
|
|