|
Have a look at my previous post carefully. You will find that the variable m_datetime should be a control variable and not a string type variable and then use the code provided in the previous post
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
///////////plz do reply///////////////
thanks this will works but how itwill be converted into mysql format
m_datetime .UpdateData();
char *str=new char[100];
m_datetime.GetWindowText (str,10);
AfxMessageBox(str);
now how can i convert str into string so that iw will store in mysql table;
can i convert it wuth this but as str is not redefined so wat can i do now
SYSTEMTIME m_jdate;
GetSystemTime(&m_jdate);
CString s;
s.Format("%04d/%02d/%02d",m_jdate.wYear ,m_jdate.wMonth,m_jdate.wD
hi
-- modified at 4:11 Wednesday 7th June, 2006
|
|
|
|
|
paras_s12 wrote: can i know how to store a date format dd-mm-yyyy as in mfc in to
mysql table in the format yyyy-mm-dd send code plz
Format the date as
CTime t;
CString strdate=t.Format("%Y-%m-%d");
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
it works thanku for this but it will not display other date
it display only current date
is it possible if then tel me how
hi
|
|
|
|
|
Your original question was about formatting a date to store in a database table. I showed you how to format the date. I assumed you already knew how to store data in the table. What about "displaying" are you wanting to know?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have two objects: CBitmap bmp1, CBitmap bmp2. There is a sample picture in the bmp1 and the same picture in the bmp2.
Now, I get a copy of the part bmp1 and put it to the CBitmap bmp3. But I don't want to create another CBitmap object. I want release bmp2 interior and put there the new part of the picture wchich is in the bmp3. How can I do it. I can't do bmp2 = bmp3, there is no function like: bmp2.Assign(bmp3).
What can I do?
Regards
mwgomez
Poland
|
|
|
|
|
if you want to copy bmp3 to bmp2 you can use :
bmp2->Canvas->Draw(0,0,bmp3);
bye
|
|
|
|
|
V_shr wrote: bmp2->Canvas->Draw(0,0,bmp3);
Where is Canvas variable Situated?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
you are speaking about CBitmap , do you mean Graphics::TBitmap ???
|
|
|
|
|
I mean the MFC library and the CBitmap class (Visual Studio).
regards
mwgomez
|
|
|
|
|
V_shr wrote: do you mean Graphics::TBitmap ???
I believe Poster is refering to MFC:: CBitmap (Though MFC is not a namespace)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi ThatsAlok,
maybe in future
whitesky
|
|
|
|
|
WhiteSky wrote:
maybe in future
I believe in 2106 when our ancestor are coding (oops thinking)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
2106 but one question why 2106
whitesky
|
|
|
|
|
gomez_a wrote: CBitmap bmp1, CBitmap bmp2
what about CBitmap* PASCAL FromHandle( HBITMAP hBitmap)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Please, give me a suggest:
How can I get a HBITMAP, when I have only CBitmap bmp3?
I found an example:
HBITMAP hBitmap = (HBITMAP) ::LoadImage (NULL, lpszPathName,
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
But, my bmp3 is not from a file.
Regards
mwgomez
|
|
|
|
|
if you have CBitmap you can use bmp3.m_hObject
whitesky
|
|
|
|
|
I wrote a class in MFC (MyClass : public CWnd), in this class I have a field
CBitmap mBitmap; // not a pointer
I set the bitmap using method:
SetBitmap(UINT nIDResource)
{
return m_Bitmap.LoadBitmap(nIDResource);
}
But now I want to set the bitmap using:
SetBitmap(CBitmap *pBitmap);
I don't know how to assign (change?) CBitmap *pBitmap to CBitmap mBitmap.
This is only a practice, but I want to understand it.
Regards
|
|
|
|
|
I dont understand you have one function SetBitmap(UINT nIDResource) now
you want to pass SetBitmap(CBitmap *pBitmap); to this function or your problem
CBitmap mBitmap
whitesky
|
|
|
|
|
Suppose we have a class:
class CBitmapViewer : public CWnd
{
...
public:
CBitmap m_Bitmap; // the BMP is loaded here
CRect R; // the whole window size
public:
virtual BOOL Create(CWnd* pParentWnd, const RECT& rect, UINT nID,
DWORD dwStyle = WS_VISIBLE);
BOOL SetBitmap(UINT nIDResource);
};
I am creating the picture 1:
CRect RPicture1(10, 10, 200, 200);
mPicture1 = new CBitmapViewer();
mPicture1->Create(this, RPicture1, ID_OBRAZEK);
mPicture1->SetBitmap(IDB_BITMAP_CHILD);
I am creating the picture 2:
CRect RPicture2(10, 220, 200, 410);
mPicture2 = new CBitmapViewer();
mPicture2->Create(this, RPicture2, ID_OBRAZEK);
mPicture2->SetBitmap(IDB_BITMAP_CHILD);
There are two picture on the screen.
Now the user can mark the part of the first window.
This coorinates are placed in CRect Rf.
Now, I am cutting down a part of the picture one - using the Rf coordinates:
int mWidth = Rf.Width();
int mHeight = Rf.Height();
CBitmap bmp_part;
bmp_part.CreateBitmap(mWidth, mHeight, 1, 24, NULL);
// get the bitmap size
BITMAP bitmap_size;
bmp_part.GetObject(sizeof(BITMAP), &bitmap_size);
// get a bitmap's part from Picture1 and place them into the bmp_part
unsigned char *pData2 = new unsigned char[bitmap_size.bmHeight * bitmap_size.bmWidthBytes];
mPicture1->m_Bitmap.GetBitmapBits(bitmap_size.bmHeight * bitmap_size.bmWidthBytes, pData2);
bmp_part.SetBitmapBits(bitmap_size.bmHeight * bitmap_size.bmWidthBytes, pData2);
delete[] pData2;
/*
when I have a part of the Picture1 in the bmp_part a want to replace a Picture2 with bmp_part.
*/
For example using:
mPicture2.Assign(&bmp_part);
or I can to create the new object:
mNewBitmap = new CBitmapViewer();
mNewBitmap->Create(this, R3, ID_OBRAZEK3); // CRect R3 - where the window is placed
mNewBitmap->AssignBitmap(&bmp_part);
From this moment I want some help, becouse I don't know how to do it
Regards
|
|
|
|
|
Hope I understood your question
<br />
void CAnswerDlg::OnBnClickedTest()<br />
{<br />
CBitmapViewer *mNewBitmap;<br />
CBitmap bmp_part;<br />
bmp_part.Attach((HBITMAP)LoadImage(AfxGetInstanceHandle(),"c:\\0.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION));<br />
<br />
CRect R3;<br />
mNewBitmap = new CBitmapViewer();<br />
mNewBitmap->Create(this, R3, 1);
mNewBitmap->SetBitmap2(&bmp_part);<br />
mNewBitmap->DestroyWindow();<br />
<br />
<br />
}<br />
<br />
BOOL CBitmapViewer::Create(CWnd* pParentWnd, const RECT& rect,UINT nID,DWORD dwStyle)<br />
{<br />
return CWnd::Create("CBitmapViewer","",dwStyle,rect,pParentWnd,1,0);<br />
}<br />
<br />
BOOL CBitmapViewer::SetBitmap(UINT nIDResource)<br />
{<br />
return m_Bitmap.LoadBitmap(nIDResource);<br />
}<br />
<br />
void CBitmapViewer::SetBitmap2(CBitmap *m)<br />
{<br />
m_Bitmap.Attach((HBITMAP)m->m_hObject);<br />
}<br />
whitesky
|
|
|
|
|
gomez_a wrote: How can I get a HBITMAP, when I have only CBitmap bmp3?
CBitmap::operator HBITMAP
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi Guys,
A structure,which consists of member variables ( eg: int, float data type ) is written in a shared memory from a BackEnd application, which is accessed by a Front End application. When I try to write a Cstring variable or TCHAR array as member variable of the structure, it is not working, and exception occurs. Actually my need is to write a string to shared memory - from Back end, which is accessed by Front End. The string should be a member of this structure. So plz help me what datatype to be used.
Thanks in Advance
Velayudhan
|
|
|
|
|
velayudhan_raj wrote: A structure,which consists of member variables ( eg: int, float data type ) is written in a shared memory from a BackEnd application, which is accessed by a Front End application. When I try to write a Cstring variable or TCHAR array as member variable of the structure, it is not working, and exception occurs. Actually my need is to write a string to shared memory - from Back end, which is accessed by Front End. The string should be a member of this structure. So plz help me what datatype to be used.
Try Char* instead.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|