|
I want to use UIDL.
But I don't know how to use.
Any example?
Thank you very much.
|
|
|
|
|
There is some DC,
and I want to know which window owns it..
Is it possible?
thanks you.
|
|
|
|
|
|
There is just API method:
HWND hwnd_parent = ::WindowFromDC(di.hdcDraw);
|
|
|
|
|
Fine
You have answer.
Vitali
http://www.creative-case.com
|
|
|
|
|
Dear sir,
i am doing project in client server program like
we are transferring files from server to client
so, am going to use like FTP implementatins..
so, i want to know how we are using client server program
can u please send how to implement this code. i am going to develope
this in wi32 console application in VC++.
Thanks in advance,
Rathi.
|
|
|
|
|
One solution is raw winsock. Look in CodeProject code section for examples of winsock designs.
Kuphryn
|
|
|
|
|
Hi all,
i have a dialog, i catch the OnPaint() message. here is the code
void CMyDialog::OnPaint()
{
CPaintDC dc(this);
GetWindowRect(m_rectDlg);
PlaceTitleBorder(dc);
}
in in the PlaceTitleBorder() method i draw a bitmap:
void CMyDialog::PlaceTitleBorder(CPaintDC &dc)
{
BITMAP bmp;
memset(&bmp,0,sizeof(bmp));
::GetObject(m_hTitleBorder,sizeof(bmp),&bmp);
HDC compatibleDC = ::CreateCompatibleDC(dc);
HBITMAP hSavedObj;
hSavedObj = (HBITMAP)::SelectObject(compatibleDC,m_hTitleBorder);
BOOL bRes = StretchBlt(dc,
m_rectTitleBorder->left,
m_rectTitleBorder->top,
m_rectTitleBorder->Width(),
m_rectTitleBorder->Height(),
compatibleDC,
0,
0,
bmp.bmWidth,
bmp.bmHeight,
SRCCOPY);
::SelectObject(compatibleDC,hSavedObj);
::DeleteDC(compatibleDC);
}
when dialog appear i see the bitmap ok. when i move the dialog around the screen and go out of the bounds of the screen, and then return to the screen, the bitmap disappears (not redrawn???) can any1 help me??
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi YaronNir,
I think this is not good way to rewrite OnPaint in dialog
(hmmm - f.e. because dialog may contain other elements).
Insted this let try to put cpecial element on the dialog
and draw bitmap in to it.
Hope this help.
Vitali
http://www.creative-case.com[^]
|
|
|
|
|
hi,
thanks for the reply...
What can you suggest i do ??
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
I'm doing that too, but it works. Even if the dialog needs a refresh / redraw.
Just to show an example, which should not look very strange from your point of view :
1) Define the handlers for InitDialog and OnPaint and add a CBitmap object in the dialogs header :
class CMyDialog : public CDialog
{
:
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
:
CBitmap m_bmMyBitmap;
:
};
2) make sure that the OnPaint:handler are in the CPP-File :
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
//{{AFX_MSG_MAP(CMyDialog)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
3) Init the Bitmap object in the OnInitDialog function
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_bmMyBitmap.LoadBitmap( IDB_MY_BITMAP );
}
4) Fill the OnPaint-Handler :
void CDialogDruckauswahl::OnPaint()
{
CPaintDC dc(this); // device context for painting
// fill dialog background with some color.....
CRect crRect;
GetClientRect( &crRect );
COLORREF crColor = RGB( 255,255,255 );
CBrush* pFillBrush = new CBrush( crColor );
CBrush* pOldBrush = dc.SelectObject( pFillBrush );
CPen* pNewPen = new CPen( PS_SOLID, 1, crColor );
CPen* pOldPen = dc.SelectObject( pNewPen );
dc.Rectangle( crRect );
dc.SelectObject( pOldPen );
delete pNewPen;
pNewPen = NULL;
dc.SelectObject( pOldBrush );
delete pFillBrush;
pFillBrush = NULL;
// in welchen Bereich ?
DrawBitmap( &dc, crRect, &m_bmMyBitmap );
}
5) at least : define the bitmap drawing function :
void CMyDialog::DrawBitmap( CDC* pDC, CRect crRect, CBitmap* pBM )
{
// create a memory dc to prepare drawing via bitblt ...
CDC* pmemDCBitBlt = new CDC();
pmemDCBitBlt->CreateCompatibleDC( pDC );
CBitmap* pOldBM = pmemDCBitBlt->SelectObject( pBM );
// blit the bitmap into our view using the bitblt-xor-mode
pDC->BitBlt(crRect.TopLeft().x, crRect.TopLeft().y, crRect.Width(), crRect.Height(), pmemDCBitBlt, 0, 0, SRCCOPY );
// free the memory dc and the bitmap ....
pmemDCBitBlt->SelectObject( pOldBM );
delete pmemDCBitBlt;
pmemDCBitBlt = NULL;
}
|
|
|
|
|
Hi,
thanks for the reply,
i wrote something similar to what you've posted and it works!
thanks a lot
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I need to open a Text file and read the first line which is like "Run","FileNo","Distance",...
Then i've pickup words like Run,FileNo.
I was able to open, read Line using CStdioFile.ReadLine();
How to parse the line and get the words??
Thanks In advance.
Warm Regards,
KKR
|
|
|
|
|
|
Thanks for Flashy Response,
Now My entire line is in a CString , shall i have to convert it to char* , to apply those functions like strtock();
Warm Regards,
KKR
|
|
|
|
|
this is very simple:
use syntax similar:
strtok( (char*)(LPCTSTR)CStringvariable, ... );
or use GetBuffer member from CString
Vitali
http://www.creative-case.com[^]
|
|
|
|
|
Thanks Mr Vitali,
I got the result.
Warm Regards,
KKR
|
|
|
|
|
Hi all.
Can i determine progrommaticaly whether keyboard connected with computer???
Thanks.
|
|
|
|
|
Hi,
I need to call into a library to perform a lengthy operation after a user presses a button.
I would like to bring up a dialog asking the user to wait a moment (no buttons on this dialog).
In the background I would like the operation to be performed. When it is ready, the dialog should be destroyed.
Has anyone done anything similar to this? Could someone point me to a sample or give me a few tips?
I am using MFC.
thanks,
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
This sounds like a job for a background worker thread.
There are two methods I use to unblock a lengthy operation:
1. pumping the message queue intermittently (in VB, this was known as DoEvents)
2. Threads. (worker or UI, depending on the usage).
you should be able call your function via a worker thread, using an event to signal when the process is finished and therefore when to destroy your status dialog.
Have a look at: http://users.stargate.net/~newcomer/workerthreads.htm[^], where there is an excellent article on thread usage.
I Dream of Absolute Zero
|
|
|
|
|
Well if you want to avoid the complexity of threads in C++, just put up a modeless dialog before you start your lengthy operation. Whether it has buttons on it like a "Cancel Lenghty Operation" button is up to you - having a button like this is actually harder, because you need to be able to interrupt the operation ( you would need to set a boolean and test that boolean as often as possible inside the lengthy operation). Anyhow what you described is easier - when the operation is finished, send a meessage to your modeless window to tell it to close down!
|
|
|
|
|
I need to write a function that takes as input, two fraction values from a user like (3/4 and 5/6). The function then adds these values and then return the resultant in the form of similar fraction number. How can i do so ?? Is there any way to convert a decimal number into a fraction or display a decimal number into a fraction. Can i take help from iostreams.
I've already made a function which accepts and returns fraction values in the form of string. But it not seems to me a good solution ;(
|
|
|
|
|
A solution could be to store separately the two numerators and the two denominators with 4 int variables, and then calculate the addition like this
N1/D1 + N2/D2 = (N1*D2 + N2*D1)/(D1*D2).
The next task would be to simplify the result by finding the greatest common divisor of the new numerator and the new divisor.
HTH,
K.
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Hi,
I'm not very experienced in VC++ but I can't think of a function to deal with fractions and as you have no other answers I guess there isn't one and you are just going to have to do the hard work yourself!
You could carry on with your original method and read in 2 strings, then convert them to 4 integers or you could give the user 4 boxes and let them enter 4 integers, 2 for each fraction (perhaps you could display a bar between the upper and lower digit to show that they are fractions). Then you can read in 4 integers, brush up on your maths for adding fractions (its quiet easy really) and you should be sorted.
Hope this helps, regards,
Ali
|
|
|
|
|