|
Hi all, I know this is cheeky in the C++ section but pleeease help me!! I need to shave some time off of the compiler generated interrupt code. In the code below (#int_gobal with compiler generated interrupt code within it) this shoul compile then work the same as it previously did but the compiler stops on '03.5', this is the status register bit 5 so i tryed 'BTFSC STATUS,5' but that didnt work either. Im very confused, please help me.
#int_global
isr() { // Will be programmed at location 4
#asm
BTFSC 03.5
GOTO 00A
MOVWF 25
SWAPF 03,W
MOVWF 26
GOTO 00F
........ etc ....
#endasm
}
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
|
|
|
|
|
i duuno much about PICs, but other controlers ... so ... first, why not doing all the stuff in asm ? ... secondly, giving 03 will always work whereas STATUS must be an alias and should be used only if it is defined somewhere as being equal to 03 (like an #include STATUS 03)(check the include files and/or your compiler settings)
Could you post the BTFSC description function ??
~RaGE();
|
|
|
|
|
Hi !
Just like to know how difficult this is to skin a dialog app such winamp does (must be the 100000th to ask it, but ... ) ? Someone knows about a _good_ article on that ?
Thanks ...
~RaGE();
|
|
|
|
|
Yes, my article and it is VERY good.
http://www.codeproject.com/dialog/winampwnd.asp
I thank you
James
|
|
|
|
|
James Spibey wrote:
Yes, my article and it is VERY good.
Lol ... Ok, I´ll take it
James Spibey wrote:
http://www.codeproject.com/dialog/winampwnd.asp
well, i must really have searched like a '*Ä+ä#, because i did not find it on CP ...
Thanks a lot, that´s exactly what i was looking for.
~RaGE();
|
|
|
|
|
Hi !
I have a "one euro question" ...
I´d like to know how to allocate memory for a 20x10 "matrix"; I´ve tried foolowing :
int **Table;
*Table=new int[nb_lines];
for(int i=0;i<10;i++)
{
Table[i]=new int[nb_columns];
}
This works - at least it compiles and does something in the app, but it still crashes when in use, so i guess there must be another way to do it .BTW, i do not want to declare another structure or use another thing, i´d really like to know how to do it this way (it´s just for fun)... Anyone knows ?
~RaGE();
|
|
|
|
|
And this:
int **table;
table = new int*[nb_lines];
for(int i = 0; i < nb_lines; i++) {
table[i] = new int[nb_columns];
}
I think ...
Hello World!!!
from Raphaël
|
|
|
|
|
Hi,
I've got a pointer pointing an image (buffer) and I want to display this image in the client area (view)...
How to do this simply ???
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
what kind of "buffer" ?
to display anything in Windows, you've got to convert it to a DIB or HBITMAP first.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I get an image from a frame grabber...
Thus the image comes from a buffer in the SDRam memory. I think it must exist an Object which encapsulate un pointer which pointe to this buffer...
I think... No?
Hello World!!!
from Raphaël
|
|
|
|
|
do you have any documentation?
most devices will return a DIB (HDIB, LPDIB, LPBITMAPINFO, etc) or an HBITMAP.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
For the moment I use some code and that works... but I don't find that very clean...
BITMAPINFO* m_pInfo; // is a member of the view
void CArchitectureView::SetBitmapInfoHeader()
{
unsigned short max_shade = 256;
m_pInfo = (BITMAPINFO *) malloc (sizeof(BITMAPINFOHEADER) + max_shade * sizeof(RGBQUAD));
m_pInfo->bmiHeader.biBitCount = 8;
m_pInfo->bmiHeader.biClrUsed = max_shade;
m_pInfo->bmiHeader.biSize= 40;
m_pInfo->bmiHeader.biPlanes = 1;
m_pInfo->bmiHeader.biCompression = BI_RGB;
m_pInfo->bmiHeader.biSizeImage = 0;
m_pInfo->bmiHeader.biXPelsPerMeter = m_pInfo->bmiHeader.biYPelsPerMeter = 0;
m_pInfo->bmiHeader.biClrImportant = 0;
m_pInfo->bmiHeader.biWidth = 0;
m_pInfo->bmiHeader.biHeight = 0;
for(int i = 0; i < (int)m_pInfo->bmiHeader.biClrUsed; i++) {
m_pInfo->bmiColors[i].rgbBlue = m_pInfo->bmiColors[i].rgbGreen = m_pInfo->bmiColors[i].rgbRed = i * (BYTE)(256 / m_pInfo->bmiHeader.biClrUsed);
m_pInfo->bmiColors[i].rgbReserved = 0;
}
}
I use this method during the Initialize of the view...
void CArchitectureView::OnInitialUpdate()
{
CView::OnInitialUpdate();
if(m_pInfo == NULL)
SetBitmapInfoHeader();
}
And the OnDraw() methods... pIm is a pointer to the image
void CArchitectureView::OnDraw(CDC* pDC)
{
CArchitectureDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if(pDoc->ImAff == NULL)
return;
int H = pDoc->MyImList->GetImage(0).GetHeight();
m_pInfo->bmiHeader.biWidth = pDoc->MyImList->GetImage(0).GetWidth();
m_pInfo->bmiHeader.biHeight = -H;
int mode = pDC->SetStretchBltMode(COLORONCOLOR);
void* pIm = (void*)(pDoc->ImAff);
StretchDIBits(pDC->GetSafeHdc(),
0, 0, m_pInfo->bmiHeader.biWidth, H,
0, 0, m_pInfo->bmiHeader.biWidth, H,
pIm, m_pInfo, DIB_RGB_COLORS, SRCCOPY);
pDC->SetStretchBltMode(mode);
}
yeap... It's clean???
Hello World!!!
from Raphaël
|
|
|
|
|
that's really about as clean as you are going to get. image drawing is not simple.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
In my app I have an IPicture and would like to save this as a gif file (I'm aware of licensing restrictions). However I'm unsure of the best way to go around this? I've found lots of info on other image formats but not this one.
Can anybody shed any light on the best way of doing this please.
Thanks
Jas
|
|
|
|
|
I added a ListControl, which is working fine (no Owner data though)
i can put text into it, but weird thing is that i get the text backward.
I.e:
original text:
aaaaaaaaaaaaa
bbbbbbbbbbbbb
ccccccccccccccccc
ListControl text:
cccccccccccccccc
bbbbbbbbbbbb
aaaaaaaaaaaa
this is weird, now the code i put text into the listControl is this (a function i did):
static int VList(char Temp[])
{
if (hList3==NULL) return 1;
LVITEM LvItem;
memset(&LvItem,0,sizeof(LvItem));
//============================
LvItem.mask=LVIF_TEXT;
LvItem.iItem=0;
LvItem.iSubItem=0;
LvItem.pszText=Temp;
SendMessage(hList3,LVM_INSERTITEM,0,(LPARAM)&LvItem);
return 0;
}
it get the text and put it into the ListControl, but backwarded..
now, i saw in a MFC example that in order to make it Virtual ListControl, i need to use the "Owner data" property, but if i check it i get no text in the ListControl,can anyone tell me why and how to fix it ??
thank u all,
Ben
|
|
|
|
|
You get the text backwards because you insert every new peice of text at position 0 (top of the list). So if you add aaaa at 0 and then add bbbbb at 0, it pushes aaaaaaaa to 1 etc..
Add the item to the end by getting the count of items in the list:
LvItem.iItem = control.GetItemCount() ;
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hallo! I have a problem concerning adding new elements to a CArray with an CArray inside (which is a pointer)
class cl
{
int i;
CArray<int,int> *ptrint;
CString str;
}
CArray <cl,cl> tst;
when I try to Add a new element to tst, first of all I did the following:
cl toinsert;
toinsert.i = 3;
toinsert.str = _T("asdf");
toinsert.ptrint = new CArray<int,int>
toinsert.ptrint.Add(3);
toinsert.ptrint.Add(4); //2 elements insertet in my int-array
tst.Add(toinsert);
well, this works, but actually the memory of the int-array can not be released by
tst.ptrint->SetSize(0);
and with delete it doesn't work too.
Next thougth was that I get memory just for my "toinsert"-thing and .Add will copy the Data - so I deleted the "toinsert"-thing after inserting but then the int-Array vanishes.
after all I tried to do this:
tst.ptrint = new CArray<int,int>;
which has to work normally but it doesn't !!!
Has anybody a good idea how to solve this problem - I'm getting crazy
thanks a lot out there
|
|
|
|
|
CArray is a template, you cannot use it that way.
You have to declare it in a way, when compiler will know type to insert into it, e.g:
CArray <cl, cl&> tst;
|
|
|
|
|
I think you are better off if you use a std::vector of std::vector . I have used them successfully.
Best regards,
Alexandru Savescu
|
|
|
|
|
thanks a lot you guys, i'll try the std:vector asap, for now i have solved my problem by using a struct cl instead of class cl where i have direct access to my pointer and where i can get mem whereever i want.
i know i have made an error above, its a CArray <t,t> a.s.o.
thank you !
|
|
|
|
|
I have an article on using vector here on CP, it's far superior to CArray which was written to fill the gap until vector arrived.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi
I want to change the text of the of the status bar and the text of tool tips upon the context.
I can add a pane in witch I can write but I don't know how to write in the message pane.
Is anybody knows how to do that?
Thanks in advance
mic
|
|
|
|
|
There are two ways to do what you want:
1. Get the status bar object and call SetPaneText() on it.
2. For the pane ID e.g. ID_MY_PANE, write a CCmdUI handler for it and update the text in that handler
Not sure about the tooltips.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
thank you very much
I try it
mic
|
|
|
|
|
when drag & drop buttons from CToolBarCtrl, default drag icon is a small hand, i need my own icon for special required.
do u know how to change the small hand to my icon?
thx
includeh10
|
|
|
|