|
I've just tested it and it works with sz == 10 as well.
You may send me a sample project if you wish (mail@BartoszBien.com).
Regards,
BB
|
|
|
|
|
If it is a problem related to CFormView (which is inherited from CScrollView ), check if CScrollView::ResizeParentToFit is not called where it should not be. Hasn't tested it, but this may be the case.
Regards,
BB
|
|
|
|
|
Hello,
I have some queries
1. Is it possible to directly access Video RAM from User Application?
2. If not, How to read/write data directly to Video RAM ?
When searched, I found that certain IOCTLs ( like IOCTL_VIDEO_MAP_VIDEO_MEMORY ) available for Video RAM access. But It seems that these IOCTL are being used by the video driver. Can we have access to these IOCTLs and How?
Can you provide some clue as to how we can go ahead.
Regards
Sandeep
|
|
|
|
|
You can use DirectDraw to get access to the video memory! Just create a primary DirectDraw surface !
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hello!!
Thank you for your reply.
I have one more question.
Does DirectDraw allow the application to get the whole of the VRAM or just a part of it? Can the full VRAM be tested by writing data to it and then reading it back?
Sandeep
|
|
|
|
|
I think yes, but I don't know exactly!
You can access the whole video memory, that you will see on your monitor screen!
But most graphic-cards have more momory and you can allocate some memory directly in the graphic-card memory!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Thank you for your answer.
I am now able to get the total video memory which is free and total video memory in the system by using function IDirectDraw::GetCaps().
I am now able to get the pointer of the surface by using DDSURFACEDESC2 structure and IDirectDrawSurface::Lock(). I have locked the surface using the function IDirectDrawSurface::Lock(), and then went on to write data in the surface till total memory. i.e. I am filling the total video memory with my data. The data is also seen on the screen. But after the screen is completely filled, the screen can be refreshed again by pressing alt+tab and again ALT+TAB (or if the screen is refreshed by some other event). My question is if I have locked the surface how does the screen get refreshed?
I have written the data in blocks of 4 KB.
I am reading the data back and then comparing it. If I increase the size of data to be written from 4K to 5K then my compare fails. Even if I increase the data size to 8k (to see if it has to do something with page size) then too, the compare fails..
Can anyone tell me why 4096 so special?
I also need advise on feasibility of following:
While writing data on whole of VRAM can I show the data written on anypart of VRAM on the screen in a window?
Can anyone help me out?
Regards,
Sandeep
|
|
|
|
|
Hello,
I have a MDI project with Doc/View and i'm able to creaye objects like circles and drag&drop them.
But i would like to use bitmaps resources instead of these objects and continue to move them.
If someone has an idea
Thanks.
|
|
|
|
|
Help me please. How can I insert a bitmap from clipboard into RichEdit Control? I use MFC. Thanks!
|
|
|
|
|
Take a look at CodeGuru - http://www.codeguru.com/Cpp/controls/richedit/article.php/c5383/
__________
Chulips
|
|
|
|
|
AppWizard created this Hello World example (as Win32 Application).
I didn't change anything.
The example works fine, but in the following situation
there is a problem ???
Start the example and do following:
1. press: Alt+Space
2. select: Move (the Move label in the system menu)
3. press: Enter (or Esc)
After that Windows displays error message:
"This program has performed an illegal operation
and will be shut down."
Thanks in advance for any help.
|
|
|
|
|
Well, it works well here (as always)...
Are you sure you didn't change anything ? Can yo start the application in debug mode and tell us more where it crashes by looking at the call stack ?
Thanks.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Well, I do start the aplication in debug mode.
(in VC 6.0 I press F5)
But I get error message from Windows:
"This program has performed an illegal operation
and will be shut down."
If I go to the VC (using break execution)
the current statement is:
default:
return DefWindowProc(hWnd, message, wParam, lParam);
and the call stack is:
WndProc(HWND__ * 0x00000c84, unsigned int 274, unsigned int 61456, long 0) line 169 + 24 bytes
KERNEL32! bff7363b()
KERNEL32! bff94407()
Anyway, "Hello World" example is too simple.
There is almost no code in it.
And it is the code generated from AppWizard.
And after
1. press: F5
2. press: Alt+Space
3. select: Move (the Move label in the system menu)
Windows displays 4arrow cursor for move window
and I quess control is in some system code not in the app?
Now (while 4arrow cursor is on the screen) I press Enter (or Esc) and get error message
from Windows:
4. press: Enter (or Esc)
After that Windows displays error message:
"This program has performed an illegal operation
and will be shut down."
Any ideas ?
Thanks.
|
|
|
|
|
hi
I´m trying to read from a txt file a line:
<br />
<br />
CFile arch;<br />
CString linea="";<br />
<br />
arch.Open("c:\\archivo.txt", CFile::modeRead );<br />
<br />
arch.Read(&linea, 1024);<br />
<br />
arch.Close;<br />
<br />
But, It doesn´t work
Who can explain me how i have to do?
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
You might want to try something like this:
CHAR pFileChunk[1024];
CFile arch;
CString linea;
if(arch.Open(("c:\\archivo.txt", CFile::modeRead ))
{
arch.Read(pFileChunk, 1024);
linea = CString(pFileChunk);
}
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
Use CStdioFile with CFile::typeText flag while opening and then it's ReadString method.
Pavel
Sonork 100.15206
|
|
|
|
|
If you want to read 1024 bytes you need to do it to a buffer not a CString object.
char szBuffer [1024];
...
arch.Read (szBuffer, 1024);
|
|
|
|
|
First, if you use the read function like you did, it will copy byte by byte what it reads from the file at the adress of your linea class so it will probably erase important data inside your class. Use a char buffer instead !!
char Buffer[1025];<br />
arch.Read(Buffer,1024);
This will copy the 1024 firsts bytes from your file in the buffer (I suppose that the data in the file are characters).
Second, it will read the BYTES (!!!) from your file so if you have several lines in it, it will copy all of them in the buffer (and the end of line char also)!!! Perhaps what you can do is read the file characters by characters and test if it's an end of line!!
|
|
|
|
|
Martin_Viet wrote:
arch.Open("c:\\archivo.txt", CFile::modeRead );
did you read the documentation????
One access permission and one share option are required
|
|
|
|
|
Thanx at ALL !!!!
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
If I put a breakpoint in OnItemChanged of my CListCtrl, and debug, it runs through the function many many times! The statement at which I step into this function is a SetItemState to highlight a previous element.At first I thought it ran only twice, so I put a boolean flag which returned the code right away at the second pass after setting it to false again (the first time it runs, this flag is set to true at the end of the function....).
However OnItem runs over and over again, setting and unsetting the flag:
OnItemChanged()
{
if (flag)
{
flag = false;
return
}
if (some condition)
{
AfxMessageBox(...);
flag = true;
<code>list1.SetItemState(....);</code>
return;
}
so I alternate between getting the messagebox and not in pairs of runs. Funnily enough after a zillion times of doing this it suddenly goes through like it should and the UI shows again, with the highlight where I intended it to be.
My intention was to have the messagebox pop up only once, and when dismissed the highlight should have been on the desired item and the UI ready for the next move.
}
Appreciate your help,
ns
|
|
|
|
|
This function gets called when a item receives the focus, when a item loses the focus, when a item is selected...
I filter that using this code:
void CPPDlgParametritzacions::OnItemchangedLctrlIntroduccio(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if ((pNMListView->iItem != this->m_iElementSeleccionatAnt) && (pNMListView->iItem != -1))
{
this->m_iElementSeleccionatAnt = pNMListView->iItem;
if (this->m_cLCtrlParametritzacions.GetItemState(pNMListView->iItem, LVIS_SELECTED) == LVIS_SELECTED)
{
hope this helps...
|
|
|
|
|
Thanks. I'll work on your suggestion. Why this is happpening is because I am forcing the selection back to the one is was on, i nstead of the newly selected one, and I am doing this in the OnItemChanged....thats why it runs 4 times....
Appreciate your help,
ns
|
|
|
|
|
SetItemState might well be triggering several OnItemChanged calls - especially if you're changing the selection, because it might (depends if you've got multi-select enabled) unselect one item before selecting the next.
Anyway, whatever is going on, the easy solution is to set your flag before your call to SetItemState, and unset the flag when the call to SetItemState has returned:
::OnItemChanged(...) {
static bool flag = false;
if (flag) return;
...
if (some condition)
{
flag = true;
list1.SetItemState(...);
flag = false;
}
...
}
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Thanks.
In my pretranslatemsg, i trap enter for a text box. If I dont like the user entry I return right away. If I accept it, then I go ahead and move my selection in an adjacent listctrl ahead by one ....using SetItemState(++m_index..)
WIth this happening ,in this function your lock-unlock works great.
However I also have the case where the user puts in a bad entry in the textbox and tries to advance to a new selection in the listbox. OnItem runs of course. In this I check to see if I like the entry . If I dont I want to force the selection to remain where it is, not move the one I just clicked on. Again I do SetItemState....this time in OnItemChanged. However now the unlock-lock trick doesnt work because oddly , after it goes through the first two times,
lock
setItem runs onitem
unlock
runs onitem and returns as it should
onitem runs yet again! but my flags all restored so it goes through all over again.
Thanks for the help again,
it then does another pair.............probably because it was trying to go to the new one and I forced it back or something.
ns
|
|
|
|