|
Thank you soo much for ur fast reply , i really appriciate that
Here is my load code
//////////////////////////////////////////////////////////
char cqueuetype::infile()<br />
{<br />
char Title[30];<br />
char Content[100];<br />
char Date_Time[36];<br />
<br />
ifstream infile("c:\\queue.txt",ios::in);<br />
cout<<"\n\n\n\t Data are be saved now\n\n\n"<<endl;<br />
infile >> counter;<br />
for (int b=0;b<counter;b++) <br />
{ <br />
<br />
infile.ignore(7);<br />
infile.get(Title,30,'#');<br />
infile.ignore(13);<br />
infile.get(Date_Time,36,'#');<br />
infile.ignore(6);<br />
infile.get(Content,100,'#');<br />
node* temp;<br />
temp=new node;<br />
<br />
temp->Title=Title;<br />
temp->Date_Time=Date_Time;<br />
temp->Content=Content;<br />
temp->next= NULL; <br />
if (front==NULL)<br />
{<br />
rear=temp;<br />
front=temp;<br />
temp->next=NULL;<br />
}<br />
else<br />
{<br />
temp->next=front;<br />
front->next=temp;<br />
front=temp; <br />
}<br />
} <br />
infile.close();<br />
return 0;<br />
<br />
}
/////////////////////////////////////////////////////////////
My regards,
Bahy
|
|
|
|
|
Remarks:
for (int b=0;b<counter;b++)
|
|
|
|
|
for (int b=0;b<counter;b++)
|
|
|
|
|
Ok ok ok !! Stop it Don't overflow the forum by trying to format it
for (int b=0;b<counter;b++)
|
|
|
|
|
The only way to print a < symbol is to use the tag next to the 'code' tag. But ok, I understood what it was... And when you say that it cannot load the data, what is exactly the problem ? (Try to be as much precise as possible).
|
|
|
|
|
Do u have A personal email , to send u da file?
|
|
|
|
|
Other peope here are also able to help you. I don't know if I can solve your problem so it is better to post everything on the forum. And I don't need your source files because I don't have the time to run a project for that.
Better try to understand your problem and then give here a good description of what is happening. Also, a tool that could help you a lot is the debugger (press F9 to set a breakpoint somewhere in your code and press F5 to start the debugger). You will be able to watch the different variables and see what's happening.
|
|
|
|
|
Its ok... Thanks anywayz for your help... :->
My regards,
Bahy
|
|
|
|
|
Hello,
ana_bahy wrote:
but now i got a problem which is...as soon as close my programe and run it again , and ask da program to display da memos , it cant display it well , cause it cant read it from da file...
does <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_istream_basicistreamgetline.asp" rel="nofollow">ifstream</a>[<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_istream_basicistreamgetline.asp" target="_blank" rel="nofollow" title="New Window">^</a>] help?
Example:
std::ifstream infile("c:\\queue.txt",ios::in);
char Buf[256];
::SecureZeroMemory(&Buf[0], 256);
infile.getline(&Buf[0], 255, '\n');
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I'm currently using SetDlgItemText to change the text in the edit boxes, and each of the edit boxes has OnChangeEdit function that runs as soon as its contents are changed. Now in a few rare cases, I need to change the contents of the edit box without starting the OnChangeEdit function. Is there a way to temporarily disable that function or modify the contents of the box without OnChangeEdit noticing? I just wanted to know if there is an easy way to deal with this before I start writing code that complicates my program.
|
|
|
|
|
I think the easiest way for doing that is use a member variable of the class. Use a boolean for example. And, at the begining of your OnChangeEdit function, check if this boolean is true or false. If it is false, return, otherwise continue.
I don't think this will complicate your program a lot
|
|
|
|
|
You obviously type faster than I do... (See my post below...)
|
|
|
|
|
Yes, it seems ... But I think it is a rather common solution also
|
|
|
|
|
I have not ever been aware of such a command, not since Windows 3.1 anyways.
I usually set a boolean that I test in the OnChangeEdit. If the boolean is true, then just return from the OnChangeEdit. Set it before changing your text, clear it after done changing the text.
|
|
|
|
|
I want to translate ,scale and rotate a polygon
using win32 GDI or API's
you can also use the XForm matix to achive this
i'am unable to do it properly ,could some one help on this
thanks in advance
pradish
thanks in advance
pradish
|
|
|
|
|
I never used XForm so I have no idea what function you'd call to apply the transform. I suggest you look up 2D transformations.
For example here is an examlpe of what you're talking about.
To summarize:
Translations are easy, all you do is take each point in your polygon and add an offset to it to shift each point.
Scaling you perform by multiplying each point by some number. However if you just do scaling on each point of the polygon you're scaling about the screen origin so your polygon will move. To do scaling on the polygon only you'd need to translated it to center the polygon at (0,0) coordinates and then apply scaling, then apply the inverse transform to move it back to where it was.
Rotation is similar. You're multiplying each point by some sines and cosines, but you have to consider about which point you're rotating your polygon.
|
|
|
|
|
Thank you Budric,it was very informative
and Thanks for the link that is just funtastic
|
|
|
|
|
Has anyone tried Jeffrey Richter's IAT patching technique on IE to intercept wininet calls? I cant seem to get it working, so would like to know other's experiences to decide if digging deeper is worth trying.
Basically, none of the modules in IE seem to have WININET functions like InternetConnectW or HttpSendRequestW in their import tables, but windbg does show IE calls them.
Thanks in advance
|
|
|
|
|
Hi,
//Formatting of the code supplied
I am writing an application which supports loading, processing, and displaying of various image file formats.
I have a class, CDib, derived from CBitmap that displays the bitmap data on the device context supplied using BitBlt(...). I think this is a fairly general way dc voodoo.
//!Code Snippet (1)
//!CDib is derived from CBitmap
//!@param dc: reference to CDC where the image is to be drawn
//!@param pbm: CBitmap pointer that contains the image data, in most cases a pointer to itself
<code>
BOOL CDib::Draw(CDC& dc, CBitmap* pbm, const CRect* rcDst, const CRect* rcSrc)
{
CRect rc;
if (!rcSrc) {
// if no source rect, use whole bitmap
rc = CRect(CPoint(0,0), GetBitmapSize(pbm));
rcSrc=&rc;
}
if (!rcDst)
// if no destination rect, use source
rcDst=rcSrc;
bool bRet;
//Create a memory DC and load the bitmap onto it
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap* pOld = (CBitmap*)(memDC.SelectObject(pbm));
if(rcSrc->Size() == rcDst->Size()){
bRet = dc.BitBlt(rcDst->left, rcDst->top,
rcDst->Width(), rcDst->Height(),
&memDC, rcSrc->left, rcSrc->top, SRCCOPY);
} else{
dc.SetStretchBltMode(COLORONCOLOR);
bRet = dc.StretchBlt(rcDst->left, rcDst->top,
rcDst->Width(), rcDst->Height(),
&memDC, rcSrc->left, rcSrc->top, rcSrc->Width(), rcSrc->Height(),
SRCCOPY);
}
//!Delete the memory DC
memDC.DeleteDC();
return bRet;
}</code>
This function works fine if I load a BMP file using CBitmap::LoadImage(...).
Now,since the program can load other image file formats, I tried using CBitmap::CreateBitmap(...) but that didn't work. So, what I have done now is to use CreateCompatibleBitmap(...) and CreateCompatibleDC(...) to create a CDC and CBitmap object, and then linked them together using SelectObject(..), and then use SetPixel(...), now the problem is that SetPixel(...) is very very slow. I want to ask the readers if there is an alternate way to SetPixel where I can load a chunk of image data to the CBitmap object, and then pass it to CDib::Draw(..) function.
<code>//!Code snippet 2
//!@param pData: image data that needs to be displayed
void CImageDraw::CreateBitmap(BYTE* pData)
{
//!Create a DC
CDC dc;
dc.CreateCompatibleDC(NULL);
//!If m_dib exists delete it
if((HBITMAP)m_dib)
m_dib.DeleteObject();
m_dib.CreateCompatibleBitmap(AfxGetMainWnd()->GetDC(), m_nImgWidth, m_nImgHeight);
CBitmap *pOldBitmap = (CBitmap *)dc.SelectObject(&m_dib);
for(int y = 0; y < m_nImgHeight; y++){
for(int x = 0; x < m_nImgWidth; x++){
//!This is very very slow.....I need an alternative
dc.SetPixel(x,m_nImgHeight-1-y, RGB(pData[3*x+2+y*m_nImgWidth*3], pData[3*x+1+y*m_nImgWidth*3], pData[3*x+y*m_nImgWidth*3]));
}
}
dc.SelectObject(pOldBitmap);
dc.DeleteDC();
}
</code>
Thanking in anticipation
Swati<code></code>
|
|
|
|
|
The reason I use such ugly code, is because that's the only code I know. I am a begginer in programming. At the moment I am reading some materials on STL and MFC, but find it quite difficult to understand, as I have a lot of gaps in my programming knowledge. To that I have no one to ask for help apart from the forum. So THANK YOU all for helping me out!
Maybe you could help me out with this error I get:
cannot convert parameter 1 from 'unsigned short' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast.
The solutions you helped me out with, was not exaclty what I was looking for. Basicaly pszData is only 1 character at a time. So I want to store that 1 character in an array, then add the next character that comes from pszData and add it to the array. When I have 10 characters, That's when I want to display on screen. pszData recieves a character at different times, could be a split second or a whole day.
Thanks in Advance!
void CChildView::SortData(LPCTSTR pszData)<br />
{<br />
TCHAR buffer[10];<br />
<br />
????? I have no idea what to put here ???? <br />
Can anyone please help me.<br />
<br />
buffer[10] = _T('\0');
DisplayData(buffer);<br />
There is no fixed set of rules according to which clear, understandable, and provable programs can be
constructed. There are guidelines, of course, and good ones at that; but the individual programmer's style
(or lack of it), his clarity of thought (or lack of it), his creativity (or lack of it), will all contribute
significantly to the outcome.
-- Peter J. Denning
|
|
|
|
|
hello there,
First of all, don^t forget that the first position in an array is position 0. so if you have an array of 10 elements the tenth element is at array[9]!
In the code you posted you should make your buffer an array of 11 if you want to do:
TCHAR buffer[11],<br />
...<br />
buffer[10] = _T('\0');<br />
Then to copy the first 10 chars of the pszData string you could use:
_tcsncpy( buffer, pszData,10); <br />
Hope this gets you along...
<edit>
Sorry I did not read your post completely correct at first
From what I understand this function will be called multiple times an after the tenth time you want to display the 10 chars passed. you could do like this:
void Childview::SortData(LPCTSTR pszData)<br />
{<br />
static int nPass=0;<br />
static LPTSTR buffer[11];<br />
buffer[nPass++] = pszData[0];<br />
if( nPass == 10 )<br />
{<br />
buffer[10] = NULL;<br />
DisplayData(buffer);<br />
nPass = 0;<br />
}<br />
<br />
}
Allthough I think it would be better if you just passed a single TCHAR as parameter and not the string, but that is up to you....
<\EDIT>
Davy
|
|
|
|
|
Thanks, I will try it... the reason I want to store it in an array, is because I want to sort out the data, There is actualy 80characters that I need to store in the array, and only send to the display about 10.
The program recievs data from a COM port(rs-232), I got the program from this website, and just want to modify it. I write simple code, as it's what I am familuar with.
Thanks!
are you australian?
|
|
|
|
|
tomek18 wrote:
are you australian?
Nope. I`m no bloke from down-under.
100% European. Born and raised in tiny Belgium, and about 5years ago moved to and still living in sunny Greece
Greetings,
Davy
|
|
|
|
|
GDavy wrote:
Born and raised in tiny Belgium
Cooool, a compatriot .
|
|
|
|
|
Potverdikke, It's great to see a Belgian!
|
|
|
|
|