|
These are my codes about printing bitmap:
<br />
CDC dc;<br />
CPrintDialog printDlg(FALSE);<br />
if (printDlg.DoModal() ==IDOK)<br />
{<br />
dc.Attach (printDlg.GetPrinterDC());<br />
DOCINFO di;<br />
memset(&di,0,sizeof(DOCINFO));<br />
di.cbSize =sizeof(DOCINFO);<br />
di.lpszDocName ="ͼÏó´òÓ¡";<br />
CString filename="MONEY.bmp";<br />
HBITMAP bmp=NULL;<br />
bmp=(HBITMAP)LoadImage(NULL,filename,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);<br />
<br />
CBitmap bitmap;<br />
bitmap.Attach (bmp);<br />
BOOL bPrintingOK = dc.StartDoc(&di);<br />
CPrintInfo Info;<br />
Info.m_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));<br />
StartPage(dc);<br />
<br />
<br />
CDC dcMemory;<br />
dcMemory.CreateCompatibleDC(&dc);<br />
<br />
dcMemory.SelectObject(bmp);<br />
BITMAP bm;<br />
bitmap.GetBitmap(&bm);<br />
<br />
dc.StretchBlt (0,0,bm.bmWidth,bm.bmHeight,&dcMemory,0,0,32,32,SRCCOPY);<br />
EndPage(dc);<br />
EndDoc(dc);<br />
DeleteDC(dcMemory);<br />
dc.Detach ();<br />
}<br />
DeleteDC(dc);<br />
<br />
The compiler told me there are 0 errors,but I can't see the bitmap appear on the paper after the program is executed.Why?
|
|
|
|
|
This is the classic case of trying to print a device-dependant bitmap (DDB). What you need to do is to convert the bitmap to a device-independant bitmap (DIB) before you print it. There are articles on www.codeguru.com[^] describing it and probably also here somewhere...
Look at the bitmap section[^] at codeguru for some code.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I have a CString variable.How can I add new line in it,something like this:
"firstline";
Then make it like this:
"firstline
second line"
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
CString theString = "Firstline\nSecondline";
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Can you help me with this program
Write a program to implement "Add to save" feature to a document. Hint: Use Timer event
|
|
|
|
|
Hint:
Use SetTimer and if using MFC use OnTimer function to handle event.
If using WTL create a OnTimer message cracker.
Developing with C++ is like programming by the seat of your pants
|
|
|
|
|
Hi everybody. Need build MDI application with tabbed view. Left pane of view must be scroll view and right pane must consist some control. Is anybody know simplest way how do it ? Thanks
|
|
|
|
|
Ranger wrote:
tabbed view...Left pane...right pane
Are you thinking of a tabbed view (PropertyPages) or of a splitter view, which has a bar between two views (like windows explorer)
|
|
|
|
|
Can anyone suggest me the line of codes and the data type of the field through which we can store files in an SQl Server Database through an ODBC Recordset
Samir Sood
|
|
|
|
|
http://www.codeproject.com/database/excel_odbc_write.asp
The idea is the same, u just have to modify it in a way that the driver is pointing to your SQL server and not Excel
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I Developed a Tree Control using Microsoft Tree Control API
in Win32 SDK. When i adding more nodes or items to the Tree Control i am getting memory problem, how can i avoid this problem ?
Any help...
thank you
|
|
|
|
|
how to creat service in vc++?
r00d0034@yahoo.com
|
|
|
|
|
|
|
Here[^] you can download an AppWizard for VC6.
Pavel
Sonork 100.15206
|
|
|
|
|
Hello there,
I used to below function to add string to RichEdit box, it works fine on Win98 or WinXP ... but it has bug in Win2000 !
Function:
void CResultDialog::AddText(CString str, COLORREF rgb, BOOL bold, BOOL italic, BOOL underline)
{
// get current length from rich text box ...
int nCurLen = m_Rich.GetTextLength();
// hide selected text !
m_Rich.HideSelection(TRUE, FALSE);
// move the cursor to end of rich control ...
m_Rich.SetSel(nCurLen, nCurLen);
// attach the new string to the last of rich edit ...
m_Rich.ReplaceSel(str);
int nStartPos = nCurLen;
int nEndPos = m_Rich.GetTextLength();
// configure the character format !
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_ITALIC;
cf.dwEffects = (unsigned long)~(CFE_ITALIC | CFE_UNDERLINE | CFE_BOLD | CFE_AUTOCOLOR);
cf.crTextColor = rgb;
cf.dwEffects |= underline ? CFE_UNDERLINE : cf.dwEffects;
cf.dwEffects |= bold ? CFE_BOLD : cf.dwEffects;
cf.dwEffects |= italic ? CFE_ITALIC : cf.dwEffects;
// select added text ...
m_Rich.SetSel(nStartPos, nEndPos);
// use character format !
m_Rich.SetSelectionCharFormat(cf);
m_Rich.SetSel(-1, -1);
}
I used this function in here:
AddText( "Company: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "Microsoft", RGB(0, 0, 0), TRUE, FALSE, FALSE );
AddText( "\nContact: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "Billi", RGB(0, 0, 0), TRUE, FALSE, FALSE );
AddText( "\nWeb: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "www.m$.com", RGB(0, 0, 0), TRUE, FALSE, FALSE );
It has bug in Win2000,
The bug is colors on the text ...
I think it's because my enter character in my strings ...
Win98 or WinXP count enter character in for getting lenght but Win2000 doesn't it, or vice versa !
How can i solve it ??
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Tried \r\n (which is the normal return on Windows) ?
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Hello there,
I made a MFC project by VC++ .NET and i choose Farsi language for one of my dialogs in my project ...
I put a button in the farsi dialog ...
I wrote farsi string in button and when i run it i see ASCII characters insted my farsi string !!!
What's wrong ??????
How can i solve it ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have the same problem ,
Is it a vc.net's bug ? or i use it wrong ?
|
|
|
|
|
Hi,
I am using VC6.0++ with DAO & MS Access97! So far I use SQL successfully ... well except 2 thing:
*) With this: strSQL.Format ("SELECT * FROM Sample WHERE Title != 'Date'"); I can search the whole Sample table at column "Title" for string "Date"!
1) Let say to do the same, how can I search ... but at any cell has some thing (not empty string, or not empty field)?
2) In the table there is a column with define as COleDateTime, how can I search the same above technique for a equivalent COleDateTime day:
ie: Search for cell has "12/31/2001" in the column "Date"
I appreciate any help help here
Many thanks,
Anh
|
|
|
|
|
1) I think that SELECT * FROM Sample WHERE title <> '' AND title IS NOT NULL (I'm not sure if title IS NOT NULL is necessary).
2) SELECT * FROM Sample WHERE Date = '2001-31-12' should do the trick. Beware if the time is included you may have to issue SELECT * FROM Sample WHERE Date >= '2001-31-12' AND Date < '2001-31-12' .
Try 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
|
|
|
|
|
Hi Michel,
Thank you very much for request #1, it works beautifully! However, the suggestion for #2, I tried and failed! Did you try it successfully, or might be I missing some thing?
Many thanks,
Thanh
|
|
|
|
|
I don't know MS Acces at all, but I know that for the SQL server to understand your date format, you must know the locale it uses.
For instance, in en-US (0x409 or 1033), '12/31/2001' (try that), in fr-CA (0xC0C or 3084), '31/12/2001', etc...
Somebody once suggested the format I put in #2 to be locale-independant, but it doesn't seem to work in Access. Try the '12/31/2001' and see what happens.
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
|
|
|
|
|
newbie beware!
okay, i create a button
HWND myhwnd;
myhwnd = CreateWindowEx(WS_EX_STATICEDGE,"Button","About",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,10,10,25,15,parent,(HMENU)ID,hInst,0);
the font is bold by default, how can i set the font.
Any good reading here, really appreciated, as always, any helps appreciated also.
shotgun
|
|
|
|
|
|