|
show code snippet or give more info..
|
|
|
|
|
using BitMlt:
CRect rect;
this->GetWindowRect( &rect );
this->GetParent()->ScreenToClient( rect );
CBitmap img;
CDC dc;
BITMAP bmp;
img.LoadBitmap(m_nImageID);
img.GetBitmap(&bmp);
CDC* pDC = this->GetDC();
dc.CreateCompatibleDC(pDC);
CBitmap* pOld = dc.SelectObject(&img);
pDC->BitBlt(rect.left, rect.top, bmp.bmWidth, bmp.bmHeight, &dc, 0, 0, SRCCOPY);
using Image::DrawImage
CRect rect;
this->GetWindowRect( &rect );
this->GetParent()->ScreenToClient( rect );
m_img = Gdiplus::Bitmap::FromResource(GetModuleHandle(0),MAKEINTRESOURCE(nImage));
grpx.DrawImage(m_img, 0, 0, m_img->GetWidth(),m_img->GetHeight());
|
|
|
|
|
What are the values of rect.left and rect.top in case 1?
The best things in life are not things.
|
|
|
|
|
left = 50 and top = 50 in both cases
|
|
|
|
|
Fine, but in the second case you are drawing at Point(0, 0) !
The best things in life are not things.
|
|
|
|
|
grpx.DrawImage(m_img, 0, 0, m_img->GetWidth(),m_img->GetHeight());
why don't you try using same rect.left and rect.top instead of 0,0 in drawimage??
Regards,
Gopinath.
|
|
|
|
|
Hello
How can i create one button for two events?
For example: I want to have one button for start/stop.
At the beginning of the application button name is start (start the event ), when I click the button second time it change the name to Stop (stop the event)????
I am very new to C# programming, i know to do this in VB6... Sorry for my bad english!
ThankYou
|
|
|
|
|
This is in the wrong forum, try the C# forum next door...
|
|
|
|
|
About the best redirect I've seen here. +5
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
glad you liked it...
|
|
|
|
|
|
Hi
Any sample or help?
Thanks
www.logicsims.ir
|
|
|
|
|
Hi,
Take a look at thisexample, it does detail the AT codes etc that may help you...
|
|
|
|
|
Hi all,
How can i browse image and display on dialog.Any good links for this.
Thanks
Manju
|
|
|
|
|
Check this link ->[^]
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
|
|
|
|
|
the problem of mine is: I defined four document templates "A B C D" in my program and I set the document template "A" as master document template others as slaves.that means I use the master document template to open data and transfer data to other document templates. so I only implement the OnOpenDocument() function of the master document template. after I have finished all the framework. my leader tell me that the view from the "B" document template should be display firstly or on top after the data is opened. so I have to hide the view of master document template and show the view of slave "B" document template. but I found the "B" is not activate, that means all the menu or toolbar command message loop are still clue to master document template. please tell me how to active the B document template and let it to response all the menu commands.
swandream
|
|
|
|
|
i am trying to Encrypting files SetEncryptionMethod(CZipCryptograph::encWinZipAes256)
its not encrypting full here is my code ...
CZipArchive zip;
LPCTSTR sar = _T("C:\\saad.zip");
LPCTSTR password = _T("1234");
zip.Open(sar,CZipArchive::zipCreate);
zip.SetPassword(password);
zip.SetEncryptionMethod(CZipCryptograph::encWinZipAes256);
zip.AddNewFile(filepath);
zip.Close();
// TODO: Add your control notification handler code here
MessageBox(_T("file is locked successfully"),NULL,MB_OK);
when i see in winhex its shows the which type of file and data ...
by using winrar i encrypted the file then drag into the winhex it does not show file type or etc
i looking to do it like that using the zip archive lib ........
is there any other way to do it in aip archive lib only ??????
thanking you
sarfarz
|
|
|
|
|
have you tried asking the author(s) of CZipArchive ?
|
|
|
|
|
|
hello everybody :
i created a dialog base program and it has a CListCtrl on the dialog. now ,i wanna print the datas of CListCtrl.but the reuslt was wrong.
may be the wrong in TextOut function
following 's my code , help me please.
BOOL CBingLiGuanLi::PrintList(CListCtrl *pListCtrl)<br />
{<br />
PRINTDLG pd; <br />
pd.lStructSize = sizeof(PRINTDLG); <br />
pd.Flags = PD_RETURNDC; <br />
pd.hDC = NULL; <br />
pd.hwndOwner = NULL; <br />
pd.hInstance = NULL; <br />
pd.nMaxPage = 1; <br />
pd.nMinPage = 1; <br />
pd.nFromPage = 1; <br />
pd.nToPage = 1; <br />
pd.nCopies = 1; <br />
pd.hDevMode = NULL; <br />
pd.hDevNames = NULL; <br />
if(!PrintDlg(&pd)) return FALSE; <br />
ASSERT(pd.hDC!=NULL); <br />
int nHorRes = GetDeviceCaps(pd.hDC, HORZRES); <br />
int nVerRes = GetDeviceCaps(pd.hDC, VERTRES); <br />
int nXMargin = 2; <br />
int nYMargin = 2; <br />
TEXTMETRIC tm; <br />
GetTextMetrics(pd.hDC, &tm); <br />
int nCharHeight = tm.tmHeight; <br />
int nCharWidth = tm.tmAveCharWidth; <br />
CHeaderCtrl* pHeader = pListCtrl->GetHeaderCtrl(); <br />
int nColCount = pHeader->GetItemCount(); <br />
int nLineCount = pListCtrl->GetItemCount(); <br />
int ColOrderArray[100]; <br />
COLATT ca[100]; <br />
pListCtrl->GetColumnOrderArray(ColOrderArray, nColCount); <br />
int nColX =nXMargin*nCharWidth; <br />
for(int iXinXi =0 ; iXinXi< nColCount; iXinXi++) <br />
{ <br />
ca[iXinXi].nColIndex = ColOrderArray[iXinXi]; <br />
LVCOLUMN lvc; <br />
char text[100]; <br />
lvc.mask = LVCF_TEXT|LVCF_SUBITEM; <br />
lvc.pszText = text; <br />
lvc.cchTextMax = 100; <br />
pListCtrl->GetColumn(ca[iXinXi].nColIndex, &lvc); <br />
ca[iXinXi].strColText = lvc.pszText; <br />
ca[iXinXi].nSubItemIndex = lvc.iSubItem; <br />
ca[iXinXi].nPrintX = nColX; <br />
nColX += nCharWidth * strlen(ca[iXinXi].strColText); <br />
if(nColX > nHorRes) <br />
{ <br />
DeleteDC(pd.hDC); <br />
AfxMessageBox("字段太多,无法在一行内打印,请试用较大的纸,或横向打印。"); <br />
return FALSE; <br />
} <br />
} <br />
DOCINFO di; <br />
di.cbSize = sizeof(DOCINFO); <br />
di.lpszDocName = "ListCtrl Data Printing"; <br />
di.lpszOutput = (LPTSTR) NULL; <br />
di.lpszDatatype = (LPTSTR) NULL; <br />
di.fwType = 0; <br />
StartDoc(pd.hDC, &di); <br />
StartPage(pd.hDC); <br />
int space = (nHorRes-nXMargin*nCharWidth-nColX) / (nColCount -1); <br />
for(int iKuanDu =1; iKuanDu<nColCount; iKuanDu++) <br />
{ <br />
ca[iKuanDu].nPrintX += iKuanDu*space; <br />
} <br />
for(int iLieBiaoTi =0; iLieBiaoTi<nColCount; iLieBiaoTi++) <br />
{<br />
TextOut(pd.hDC, ca[iLieBiaoTi].nPrintX, nYMargin, <br />
ca[iLieBiaoTi].strColText, strlen(ca[iLieBiaoTi].strColText)); <br />
}<br />
int nMaxLinePerPage = nVerRes/nCharHeight -3; <br />
int nCurPage =1; <br />
for(int i=0; i<nLineCount; i++) <br />
{ <br />
for(int j =0; j<nColCount; j++) <br />
{ <br />
if(i+1-(nCurPage-1)*nMaxLinePerPage > nMaxLinePerPage) <br />
{ <br />
EndPage(pd.hDC); <br />
StartPage(pd.hDC); <br />
nCurPage ++; <br />
} <br />
CString subitem = pListCtrl->GetItemText(j, ca[j].nSubItemIndex); <br />
TextOut(pd.hDC, ca[j].nPrintX,nYMargin+(j+1-(nCurPage-1)*nMaxLinePerPage)*nCharHeight,subitem, strlen(subitem)); <br />
<br />
<br />
} <br />
} <br />
EndPage(pd.hDC); <br />
EndDoc(pd.hDC); <br />
DeleteDC(pd.hDC); <br />
return TRUE; <br />
}
|
|
|
|
|
Please use the <pre> tags (use the 'code block' button)to post code snippets.
What do you mean with 'wrong result'? Please elaborate.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
For merging together some recording data stored in CSV files I have used the class CtextFile (by Johan Rosengren via the Codeproject site) to read in and write out the processed files. I also used class CNewStringArray (which is a modified version of CStringArray by Anders M Eriksson, again via the Codeproject)
I use the MFC function AfxExtractSubString() to extract the various fields of the CSV record and CnewStringArray variables to hold and process the data.
Now I have a problem where the size of some of the files to be processed may be in the order of 250 to 700Gb.
I have never used files larger that about 10Mb, but will I have problems with files these sizes and do I need to consider new methods of processing these very large files.
Any comments and advice please.
|
|
|
|
|
I'm not an expert on that topic, but I think you have to look at Memory Map Files .
That will let you navigate the file without having to load the whole file in memory.
Watched code never compiles.
|
|
|
|
|
Yes, you definitely are better off using memory mapped files,
namely, you should use "CreateFileMapping", "MapViewOfFile", "UnmapViewOfFile" and the likes.
It is a bit outdated, but the book from Jeffrey Richter
"Programming Applications for Microsoft Windows" has a good introduction to such an API.
Maybe, looking into MSDN with these pointers will lead you to the correct API to use
for your Operating System version.
Cheers
Federico
yeap, it is still the same API in latest versions of Windows, just checked on MSDN:
http://msdn.microsoft.com/en-us/library/aa366537(v=VS.85).aspx
modified on Thursday, May 19, 2011 7:51 AM
|
|
|
|
|
Thanks Federico for your post.
I have used these API's, but for large auto generated data structures ~ 50k bytes.
I did look at he link you gave and the following concerns me:-
If the file mapping object is backed by the operating system paging file (the hfile parameter is INVALID_HANDLE_VALUE), specifies that when a view of the file is mapped into a process address space, the entire range of pages is committed rather than reserved. The system must have enough committable pages to hold the entire mapping. Otherwise, CreateFileMapping fails.
With files sizes of ~ 500GB will these APIs work?
Andy.
|
|
|
|