|
Really it depends on the data you are trying to display. But lets say for now it is only lines and lines of text, and you want to break it into sections. You have to take into account 2 things, the font size and the screen resolution. A font of size 12 will appear a lot smaller on a 1024*768 resolution than it would on a 800*600.
So to calculate this you need to use the GetDeviceCaps() function to find out information about the screen. And create a suitable font by passing it the value of the this function. Try searching for some printing tutorials, they will help you understand this. Here is a good one[^]
Another method is to draw the text. Often with Tip of the Day, the text is drawn onto a yellow background. So you could create a bitmap, and draw text onto it using DrawTextEx(), then resize this bitmap according to your display needs. The only drawback here is that if you create a small bitmap, the text may become distorted when resizing. My first method is the best.
-- modified at 8:50 Thursday 23rd March, 2006
Corrected the function name.
|
|
|
|
|
Hello waldermot.
u suggested me to take a vector or something like that for storing the links clicked
by the user.
so I took a CStringList in which initially i added all ids of pages.
& whenever user clicks on next Iam getting the next element from list & accordingly calling the functions.
Its working for "Next" navigation
& for previous navigation I have taken one more list into which i am adding all those ids that are getting visited from
"Next" navigation.
it is also working.
But there is some problem which i'll discuss after showing the code snippet which is as follows
void CMyStartPage::OnInitialUpdate()
{
CString strID;
for(int i=1; i <= 20 ; ++i)
{
strID.Format(_T("%d"),i);
m_strMainList.AddTail(strID);
}
m_MainPos = m_strList.GetHeadPosition();
m_PrevPos = NULL;
}
HRESULT CMyStartPage::OnNext(IHTMLElement *pElement)
{
if (m_pos)
{
CString strID = m_strMainList.GetNext(m_Mainpos);
m_strPrevList.AddTail(strID);
int nID = atoi(strID);
//Logic for calling perticular method depending upon id goes here
}
m_Prevpos = m_strPrevList.GetTailPosition();
return S_OK;
}
HRESULT CMyStartPage::OnPrevious(IHTMLElement *pElement)
{
if (m_Prevpos)
{
m_strPrevList.GetPrev(m_Prevpos);
if (m_Prevpos)
{
CString strID = m_strPrevList.GetAt(m_Prevpos);
int nID = atoi(strID);
//Logic for calling perticular method depending upon id goes here
}
}
return S_OK;
}
Suppose there are 4 links, user clicks on "Next" link-1's information gets displayed, again user clicks "Next"
link-2's inf.gets diplayed.
Now user clicks "previous" then link-1's inf. gets displayed.
which is correct, but after clicking previous when user clicks "Next" he assumes that he'll be shown link-2's infom.
but it shows link-3's infor. I think it is because incorrect handling of m_MainPos.
can u plz tell me how to manage it.
so that the navigation works properly.
Thank u.
|
|
|
|
|
hi
I am a beginner to vc++.
I am opening a file("c:\Mydoc.doc") and reading data from it and after that i just want to write data of 1.2 MB part from first file("c:\Mydoc.doc") to New file("c:\Newdoc1.doc") and remaining to other file("c;\Newdoc2.doc"). Code is Giving warning .
Pls Help me How these waring can be removed?
Code is:
double dSplitsize,dNumBytes;
FILE * oFile , * sFile;
int intnumr;
oFile = fopen ("c:\Mydoc.doc", "rb");
sFile = fopen ("c:\Newdoc1.doc" , "wb" );
dSplitsize=1.2f;
dNumBytes= dSplitsize*1024*1024;
intnumr= fread (buff1,sizeof(char),dNumBytes,oFile);//warning c4244:
intnumw= fwrite(buff1,sizeof(char),dNumBytes,sFile);//warning c4244:
warning C4244: 'argument' : conversion from 'double' to 'unsigned int', possible loss of data.
Thanks in advance
alok singh chauhan
-- modified at 8:02 Thursday 23rd March, 2006
|
|
|
|
|
Hi, I think you should use an explicit data type conversion. E.g.
<br />
intnumr= fread (buff1,sizeof(char),(size_t)dNumBytes,oFile);<br />
intnumw= fwrite(buff1,sizeof(char),(size_t)dNumBytes,sFile);<br />
My advice is to use only INT variables for dSplitsize and dNumBytes.
|
|
|
|
|
why are you using a double ?
change this :
double dSplitsize, dNumBytes; into this :
unsigned int dSplitsize, dNumBytes;
|
|
|
|
|
In addition to the other replies:
ariesaloksingh wrote: dSplitsize=1.2f;
dNumBytes= dSplitsize*1024*1024;
intnumr= fread (buff1,sizeof(char),dNumBytes,oFile);//warning c4244:
intnumw= fwrite(buff1,sizeof(char),dNumBytes,sFile);//warning c4244:
What are you exactly trying to do here ? You know that you want to read exactly 1.2 MB ? So, the number of bytes should be a unsigned integer and not a double value (you can only read entire bytes ).
So, change your dNumBytes value into unsigned and then do:
dNumBytes= (unsigned)(dSplitsize*1024*1024);
|
|
|
|
|
Hi,
how can I force a socket (connection-oriented sockets - TCP socket) to send
the data in its buffer immediatelly (flush socket)? I need wait at the end when data was physically sended (from network card).
Jiri M.
Jiri M.
|
|
|
|
|
Flusing is not possible if you want to transfer data reliable (if you want to make sure that the other end gets the data you have sent).
For more information search for "graceful close" or
see http://tangentsoft.net/wskfaq/newbie.html[^]
|
|
|
|
|
hi
i am using visual studio c++ 6 and SDK (feb 2003 edition)
I want to display data from a database (MySQL 4.1.18) in a dialog box i have. Do i use a editbox or listbox or datagrid or ??? i just want to display it, dont want the user to edit it etc. so i think it is called virtual data?
i want to have row and columns and the columns to have headings. eg
name | address | phone | sex | subject | aaa| bbb | ccc | etc | etc
---------------------------------------------------------------------
mark | usa | 0212 | male | math | aaa| bbb | ccc | etc | etc
tom | address | phone | sex | subject | aaa| bbb | ccc | etc | etc
ken | address | phone | sex | subject | aaa| bbb | ccc | etc | etc
si | address | phone | sex | subject | aaa| bbb | ccc | etc | etc
is there any sample app/code here that does this?
many thanks
-- modified at 7:36 Thursday 23rd March, 2006
|
|
|
|
|
I am currently creating a similar application. My method of displaying the data is within a list view. This is suitable for my needs since I only need to display to the user a few hundred list items with some 15 columns.
If you are coding in MFC you have a few more options available to you, for example datagrids and tables, though I have never used them.
|
|
|
|
|
i am using MFC & dialogs alright
|
|
|
|
|
There are a lots of examples for using the CListCtrl - exactily what you need!
|
|
|
|
|
Which IDE should one use between - Visual Studio and Borland CBuilder? Which of them is more popular?
|
|
|
|
|
Definitely Visual Studio is more popular and is still growing
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
you are on a Visual Studio dedicated forum...
guess what most people here will answer...?!
|
|
|
|
|
could anyone suggest a really good book or something to get me started with VC++? I've know a decent amount of C++ but never did anything in VC++.
|
|
|
|
|
Try and get Charles Petzold for reading and go through the SDK samples that are on the accompanying CD. You will then feel a lot more comfortable in dealing with VC++
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
|
Hi,
I am getting the handle to active window and now i want to find out whether it is an internet explorer or not.
is there any way to do that?
if it is an internet explorer i want to log the URL to a text file.
Thanks&Regards,
kk_MFC
|
|
|
|
|
There are different ways to do this
you can either use EnumWindows to enumerate all windows and match the class name.
To see if Internet Explorer is running use
HWND hExplorer = ::FindWindow("IEFrame", NULL);
if (!hExplorer)
{
hExplorer = ::FindWindow("CabinetWClass", NULL);
}
If you want to get the URL then you can see
http://www.codeproject.com/cpp/DDE_with_IE_and_Netscape.asp[^]
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
hi,
We have provided mailing facility in our application using MAPI32.dll.
The Problem we are facing is we could send mails successfully to external mail ids from our LAN but on the clientside they could not send mails .
what can be the problem ???
can that be the problem with configuring of mail clients ???(eg:outllok express)
we are usig Eudora whereas they are using outlook as their default mail client.
Any Suggestions or Links please.
Thanx in Advance.
|
|
|
|
|
How can i add lex and yacc files to mfc project.
|
|
|
|
|
by importing files within your project ?
|
|
|
|
|
|
Hi,
Could someone please suggest/point me in the direction of an article, to show how I can display an animation made up of generated images sotred in a single HBITMAP in a Windows Form PictureBox?
Many thanks in advance,
Ljubica
|
|
|
|