In my program, it prints the arry called buff, but it doesn't reconise the \n escape sequaence in my char array. Heres my program (AGAIN!), and can you please tell me whats wrong.
Thanks
In my program, it prints the arry called buff, but it doesn't reconise the \n escape sequaence in my char array. Heres my program (AGAIN!), and can you please tell me whats wrong.
Thanks
I don't think that's gonna work. For each line you need to call the TextOut function:
Maybe there are other (more simple) solutions but I can't think of one.Code:if(StartDoc(pd.hDC,&di)>0 && StartPage(pd.hDC)>0) //new doc...new page { TextOut(pd.hDC,100,100,"Line 1", 6); TextOut(pd.hDC,100,200,"Line 2", 6); TextOut(pd.hDC,100,300,"Line 3", 6); TextOut(pd.hDC,100,400,"Line 4", 6); TextOut(pd.hDC,100,500,"Line 5", 6); EndPage(pd.hDC); //end of page EndDoc(pd.hDC); //end of doc }
>>TextOut(pd.hDC,100,100,"Line 1", 6);
[picky]
TextOut(pd.hDC,100,100,"Line 1", lstrlen("Line 1")); // safer to use
[/picky]
FaceMaster,
One thing you could try as it cuts down on code.
When you have a lot of similar controls (like your edits for the days) it can be handy to use loops to deal with them. ie use a loop to clear them all.
To do this I edit 'resource.h' . Find the edit contols (ie #define MON_ONE 1000) and put them in numerical order. Or use consecutive ID when creating them.
#define MON_ONE 1001
#define MON_TWO 1002 ect (or TUE_ONE ??)
then in a header define a start for the loops and number of loops.
#define FIRST_EDIT 1001//id of first edit MON_ONE
#define NUM_EDIT 7 //number of loops / controls
then you can
Now match an array of data's indexes to the edit's index and you have easy way to update you dialog.Code:for(i=0;i<NUM_EDIT;i++) { SetDlgItemText(hWnd,(FIRST_EDIT+i),"Some Text");//the resource ID is an int cast, so substituting an int works }
Something you could try.....Code:char sEditBuffers[NUM_EDIT][64]; for(i=0;i<NUM_EDIT;i++) { SetDlgItemText(hWnd,(FIRST_EDIT+i),sEditBuffers[i]); }
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Try using \r\n. I had this problem in VC6, but just \n works for me in .NET but so does \r\n so i just stick to that since thats what im used to.
"only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein