|
The first thing that comes to mind is that your CRect g is too small. you are trying to draw the text into a 2x2 pixel area. The second is to make sure that GetText() is actually getting the text and that CString s is not empty.
try CRect (0,0,pInfo->rectDraw.right, pInfo->rectDraw.bottom);
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
Thank you very much, it works!
Now I have the next Problem:
Only the first CString is printed, but I want to print the whole content of the ListBox.
First I made a for statement:
CString test;
int anz=m_ctrlListe.GetCount();
for(int i=0;i<anz;i++)
{
this-="">m_ctrlListe.GetText(i,test);
CRect g( 750,750,pInfo->m_rectDraw.right,pInfo->m_rectDraw.bottom);
pDC->DrawText(test,g ,DT_LEFT || DT_TOP );
}
It is logical, that only the last entry is printed.
How must I update the CRect to print the whole content of the ListBox.
Thank you very much!
Have a nice day.
Lucky 2002
|
|
|
|
|
DrawText() returns the height of the text drawn, so simply increase g.top by that value before you draw the next line.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
I still have another problem:
for (UINT page = Info.GetMinPage();
page <= Info.GetMaxPage() && bPrintingOK;
page++)
{
dc.StartPage();
Info.m_nCurPage = page;
OnPrint(&dc, &Info);
bPrintingOK = (dc.EndPage() > 0);
}
Info.GetMaxPage returns the value 65535.
But in my example it must be only one site.
If I set page=1, it works. But maybe later I want to print more pages.
Where can the mistake be?
Thank you very much.
Greetings
Lucky2002
|
|
|
|
|
If that's all you want to do, and don't need ano of the "fancy" GDI stuff, just open LPT1: and write the chars to it.
|
|
|
|
|
Hi there,
In a dialog based application, I need create a window with spliter
control. In the creation of the MSVC Formview class, i find a debug error:
"Error: Dialog with IDD 0x%04X must have the child style" (lpszResource).
Where can i set this style?
This is also the problem I required last night with detailed source code.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&fr=26
Thanks for all the replys!
Best regards,
chen
|
|
|
|
|
chen wrote:
Where can i set this style?
In the dialog resource editor:
Rightclick - Properties - Styles tab - Style Combobox - bottom of the list
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
chen wrote:
Where can i set this style?
open the dialog in the resource editor. open the properties dialog; there is a drop down list of styles to choose from; "child" is one (popup is another)
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
anybody knows how to load and "get" into a HFONT a TT font file (like I have myfont.ttf and I want to use it without installing it prior to use)
|
|
|
|
|
see CreateScalableFontResource and AddFontResource
-c
Being just contaminates the void. --Robyn Hitchcock
|
|
|
|
|
I want to create a pdf finder. It can find keywords from the pdf files stored on my harddisk. So I need to know the structure of pdf. Anyone knows the details of the pdf structure? Thanks!
|
|
|
|
|
Hi Ivex,
Have a look at this http://partners.adobe.com/asn/developer/acrosdk/
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
|
I have a dialog-based app. How can I hide its icon on the taskbar?
|
|
|
|
|
Check out Nishant's article here: http://www.codeproject.com/dialog/dlgboxtricks.asp
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
ShowWindow(SW_HIDE)
Help me!
|
|
|
|
|
This one has been driving me mad for hours. I should have stopped to ask for help a long time ago.
Under certain circumstances I am unable to open the clipboard after using keybd_event to send a synthesized ctrl-c keystroke. (here's how i'm using keybd_event)
keybd_event(VK_CONTROL, 0, 0, 0);
keybd_event('C', 0, 0, 0);
keybd_event('C', 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
if (OpenClipboard())
...etc
The circumstances under which OpenClipboard fails is if I have previously opened the clipboard and have "pasted" text into it with the CopyStringToClipboard() function below. (Here are both of the clipboard functions i'm using)
void CClipboardDlg::CopyCurrentClipboardText()
{
if (OpenClipboard())
{
HANDLE hClipboardData = GetClipboardData(CF_TEXT);
char * pchData = (char*)GlobalLock(hClipboardData);
CString strFromClipboard = pchData;
GlobalUnlock(hClipboardData);
CloseClipboard();
}
}
<BR><BR>
void CClipboardDlg::CopyStringToClipboard()
{
CString strData;
m_ClipboardStringList.GetText((m_iClipboardListPosition), strData);
if (OpenClipboard())
{
if (::IsClipboardFormatAvailable(CF_TEXT)||
::IsClipboardFormatAvailable(CF_OEMTEXT))
{
HGLOBAL hClipboardData;
EmptyClipboard();
hClipboardData = GlobalAlloc(GMEM_DDESHARE, strData.GetLength() + 1);
char * pchData;
pchData = (char*)GlobalLock(hClipboardData);
strcpy(pchData, LPCSTR(strData));
GlobalUnlock(hClipboardData);
SetClipboardData(CF_TEXT, hClipboardData);
}
CloseClipboard();
}
}
The strange thing is before I ever call CopyStringToClipboard() I can open the clipboard before and after the keystroke just fine. After calling CopyStringToClipboard() I can open the clipboard fine before sending the keystroke but not afterward. Stranger still, if I send the keystroke twice (not in code, but say, by a registered hotkey that calls the function) then it works fine for the second and for every subsequent keystroke until I call CopyStringToClipboard() again! It's only that first keystroke after calling CopyStringToClipboard() that behaves badly.
My first suspicion was I wasn't allowing enough time between sending the keystroke and attempting to open the clipboard but I found that waiting 5000 ms was the minimum time until the clipboard could be opened. That is beside the fact that everything works fine until CopyStringToClipboard() gets called.
I eagerly await enlightenment with my open hand poised in front of my forehead and the word "DOH" on the tip of my tongue.
|
|
|
|
|
Given an existing .mdb database, I want to change the Password every time I close the database.
Ideas
|
|
|
|
|
class CMyDaoDatabase : public CDaoDatabase
{
// ....
virtual ~CMyDaoDatabase()
{
// 1. random gen new password.
// 2. set the new password into the MDB file
// 3. save the new password into register or file
// (maybe before saving, you can encode the password)
}
};
///////////////////////////////////////////////////////
// I am not sure my idea, but you can try!
|
|
|
|
|
So its in the CDaoDatabase and not in the CDaoWorkspace.
Thanks
|
|
|
|
|
Hey, uh, how do you delete a file from C++?
Dude
|
|
|
|
|
int remove( const char *path );
#include <stdio.h>
void main( void )
{
if( remove( "remove.obj" ) == -1 )
perror( "Could not delete 'REMOVE.OBJ'" );
else
printf( "Deleted 'REMOVE.OBJ'\n" );
}
|
|
|
|
|
I thought perror function wasn't available in VC++ ?
I saw it in Borland all right.
Or maybe I just didn't link with the correct libraries.
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
Hey, uh, try DeleteFile, Dude!
Scot Brennecke
Software Developer
VC++ MVP
|
|
|
|
|