|
This is a well-known VC++ bug. The compiler is unable to deduce the template parameters unless they're present in some form in the arguments for the function. Try the following workaround (I don't have my VS handy, but I'm reasonably sure it works):
#include "stdafx.h"
#include <stdio.h>
template<class DATAType,DATAType data>Test(DATAType* dummy=0)
{
printf("Sizeof DATAType %d\n",sizeof(data));
printf("Data = %d\n",data);
}
int main(int argc, char* argv[])
{
Test<char,0>();
Test<int,1>();
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can i display an image stored in the resources in the application in an HTML File which is displayed in a CDHtmldialog ???
I would like also not to have to specify the name of the application, if this is possible.
Thanks.
|
|
|
|
|
In your res file you need a folder resource named "GIFS".
Then add your image to the project in that folder and name it with quotes:
"MyImage.gif"
Then in the html page refer to it like you normally would in any html file:
background="GIFS/MyImage.gif" (as an example for using it as a background)
Art
|
|
|
|
|
Hi,
I get the following runtime error:An attempt was made to access an unnamed file past its end.
With this code where i try to open a textfile and put them in a stringarray.
<br />
CFile cfFile;<br />
<br />
cfFile.Open(dlg.GetPathName(), CFile::modeRead);<br />
<br />
CArchive ar (&cfFile, CArchive::load);
<br />
CStringArray test;<br />
test.Serialize(ar);
Thanks for helping!
Willem
|
|
|
|
|
You may want to first serialize the size of the CStringArray , followed by each CString element. See "Serializing a homogenous collection class" in this[^] article
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi guys ,
i build a DLL file using .DEF function specifier ,now when i want to use the DLL in other application compiler throw me LNK2019 like errors .
does anybody give me a pattern in using DLL within win32 application .
thank u in advance.
|
|
|
|
|
hello,
i have another problem with child window, when i want to allow resizing i display border and when i want to prevent resizing i hide border.
now i do this to show Sizable Border:
pChild->ModifyStyle(0 ,WS_SIZEBOX ,SWP_NOSIZE | SWP_NOMOVE |SWP_SHOWWINDOW );
pChild->SetWindowPos(NULL, 0, 0, 0,0,
SWP_FRAMECHANGED |
SWP_NOMOVE | SWP_NOSIZE |
SWP_NOZORDER);
before do this i have scrolled my view with :
ScrollWindow(-posHorz,-PosVer);
my problem is when i want to show the border the view do a "ScrollTo (0,0)" ! i put "SWP_NOMOVE " in the SetWindowPos my child window don't move and why my view repositioned to (0,0) ??
i have try to remove SWP_FRAMECHANGED in the SetWindowPos and my view don't move but sizable borders aren't show!
If you know how to add sizable border and remove them easily ...
Excuse me for very bad english
|
|
|
|
|
Hail everyone,
I wonder, what gonna happen with STL container, let's say vector, if there is no memory for add new element? Method push_back returns nothing. In source code of vector I was able to find only 2 exceptions, _Xlen (length_error) and _Xran (out_of_range), but nothing else.
I'm not very familiar with STL, so any help is appreciated.
Thanks in advance.
|
|
|
|
|
Here are two excellent STL references.
http://www.sgi.com/tech/stl/
http://www.josuttis.com/libbook/idx.html
try()
catch(...) // Catch any exceptions.
Kuphryn
|
|
|
|
|
in: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
Is there a limitation to size the MainFrame?
The following code-snippet works up to: int sz=7, but not with sz=8. Why?
int ySize=::GetSystemMetrics(SM_CYFULLSCREEN);
int xSize=::GetSystemMetrics(SM_CXFULLSCREEN);
cs.cy = ySize*sz/10;
cs.cx = xSize*sz/10;
cs.x=(xSize-cs.cx)/2;
cs.y=(ySize-cs.cy)/2;
return CFrameWnd::PreCreateWindow(cs);
Gabor Kalman
|
|
|
|
|
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."
|
|
|
|