|
Seems a good idea. Now I have the following..
---------------------------------------------------------------------------
CDC dcMem;
dcMem.CreateCompatibleDC(NULL); // Needed otherwise handle is uninitialised
// Set up all the BITMAPINFO data
char pDIBHdr[sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD)];
BITMAPINFOHEADER *pBitmapInfoHdr;
RGBQUAD *pRGB;
pBitmapInfoHdr = (BITMAPINFOHEADER *)pDIBHdr;
// Setup the header information for the device independent bitmap which
// is going to be used
pBitmapInfoHdr->biSize = sizeof(BITMAPINFOHEADER);
pBitmapInfoHdr->biWidth = 256;
pBitmapInfoHdr->biHeight = 256;
pBitmapInfoHdr->biPlanes = 1;
pBitmapInfoHdr->biBitCount = 8;
pBitmapInfoHdr->biCompression = 0;
pBitmapInfoHdr->biSizeImage = 0;
pBitmapInfoHdr->biClrUsed = 0;
pRGB = (RGBQUAD *)(pDIBHdr + pBitmapInfoHdr->biSize);
for(int ii=0;ii<256;ii++){
pRGB[ii].rgbRed = ii;
pRGB[ii].rgbGreen = ii;
pRGB[ii].rgbBlue = ii;
}
void* pTmpMem;
CreateDIBSection(dcMem.m_hDC,(BITMAPINFO *)pDIBHdr,DIB_RGB_COLORS,&pTmpMem,NULL,0);
dcMem.Rectangle(CRect(0,0,100,100));
pData = (short *)pTmpMem;
// Now use pData to access the actual data out of the bitmap
--------------------------------------------------------------
The output I now get doesn't reflect the Rectangle draw that I performed.
Should it ? Although I have created this DIB is it selected into the DC as the memory surface onto which the draw functions will be occurring. If not how does one achieve that, so that the draw functions accessed via the DC will write into this DIB.
Thanks
Andrew
|
|
|
|
|
You've forget to select your DIBSection into dcMem. The first paremeter you're passing to CreateDIBSection is used only to initialize DC palette when you pass DIB_PAL_COLORS as 3rd param.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi All !
I have read that the C# threading classes in .NET causes an
exception to be thrown in a thread if that thread is being ended
by another thread.
Any idea's on how to implement this with VC 6.0 ? This could provide an
excellent alternative to polling for stop flags.
Kind regards,
Alwin
|
|
|
|
|
March'96 issue of MSJ has the answer, unfortunately, it'll work on NT/2K/XP only. Check the 'QA Win32' by Jeffrey Richter. The article may be in MSDN installed on your HD, if it's not there, check the msdn.microsoft.com.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
this is just an idea.
U heard of 'atexit' . use it to register a fn,
put the handle to the current thread in a global
variable and inside the fn so some thing like this.
HANDLE hOriginalThread ;
viod ThreadFn()
{
atexit(fn) ;
..
..
}
void fn
{
if( GetCurrentThread()!= hOriginalThread)
AfxThrowMemoryException() ;
}
U can work out the way out of global variable .
One last thing, u means of throwning exception is alright
but where will it be caught ?
|
|
|
|
|
There's a number of reasons why this cannot be achieved in general, the most important one being that the compiler often assumes portions of code throw no expceptions and takes advantage of this for optimization. Also, if there's floating point arithmetic involved the issue becomes even more tricky, as these operations are usually performed by a separate coprocessor (you can think of them as performed by a microthread), which yields the approach of "everything can throw an exception" a hard one to handle. Other, less important difficulties are those posed by the hard time programmers will have if they must assume everything can throw --think of how you'd prevent memory leaks in such situations.
First releases of Java included this termination-by-exception approach, but later on they deprecated it for the reasons mentioned.
Of course, these problems can be tackled in C# as this language runs in a strongly managed environment. The downside is resulting poor performance.
That said, you can have a thread inspect for termination conditions and throw accordingly upon calling a selected set of DLL functions (even system functions from KERNEL32, USER32, etc.) Check PJ Naugter's HookImportFunctionByName v1.0 for details.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
does anyone know how to write this as call by constant reference using pointers?? here is what ive been trying to do:
int CComputer::CheckForMoves(const CBoard& rBoard, int depth)
{
CBoard Board = rBoard; <-- but using pointers instead of reference
}
so i can call it in the main function like this:
CheckForMoves(pBoard,1); where pBoard is a pointer of CBoard
is there a way i can do something like that without getting any syntax errors????
cause i have tried all sorts of stuff like that but the compiler wont allow
me to do so....
anyways, thanx for you help
John
|
|
|
|
|
CheckForMoves( *pBoard,1) ;//main fn
int CCtrlResize::CheckForMoves(const CBoard& rBoard, int depth)
{
const CBoard& Board = rBoard; //Init to a const referece, because thats what it is
return 0 ;
}
|
|
|
|
|
Well, I guess I got it wron then!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
What I know that is not allowed!
You have to use either references or pointers.
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Pointers and references are not the same thing, you can't use both at the same time*. You can either write:
int CComputer::CheckForMoves(const CBoard& rBoard, int depth)
{
const CBoard& Board = rBoard;
const CBoard* p = &rBoard;
} which passes the param as a reference, or:
int CComputer::CheckForMoves(const CBoard* pBoard, int depth)
{
const CBoard* p = pBoard;
const CBoard& refBoard = *pBoard;
} which passes a pointer.
* Note for C++ experts: yes I know you can have a reference to a pointer; I didn't mention that above because it would be unnecessarily confusing.
--Mike--
Best score on the mini-putt game: 27
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
hey thanks everyone for help me. ill try all your suggestions to see it would work. thank you very much again
|
|
|
|
|
Try CheckForMoves(*pBoard,1) .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hey Joaquin... thank you it worked... been think bout this the whole day and i didnt try putting a pointer like CheckForMoves(*pBoard,1).... i think i overlooked that part...
muchas gracias mi amigo por me ayudo...
|
|
|
|
|
Hi, veterans, I'm a student of C.S. I'm going to do a Windows program on drawing with MFC for my class project. Before I get into the real coding, I have to write a development plan to describe how I am going to do the project. I never made one before, and I have no any idea how to write a legitimate one. Please help, with some examples if any. Thanks very much.
|
|
|
|
|
i would like to know how to use the "explorer like interface" that is createble from the appwizard. A sample would be great.
Im not so familiar with the doc/view so please keep it as simpel as possible
Thanks in advance.
/Stefan
|
|
|
|
|
check this
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I want my dialog to popup with a fade affect , where in my program should i put the AnimateWindow() function ?
thanx
|
|
|
|
|
OnInitDialog()
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Thanx(so simple..)
|
|
|
|
|
Hey guys
I am playing with ATL as you know. I have a weird problem.
I am testing my ATL stuff using VB/ASP
The problem is that when I was using VB, I find that later when I rebuild my component from VC++ I get this error saying the file cannot be opened for writing.
What I then used to do was to close VB and then rebuild it with no probs. This was an annoyance in a way.
But now its worse. I jus tried it out from ASP and it worked. I was happy too. Now I make a small change and want to rebuild it. I get the cannot open dll error. I closed the IE instance and get the same error.
Now what do I do?
Do I have to restart my machine each time?
I believe the reason for this is that ASP/VB fails to decrement the reference count.
How do I force them to do that?
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Damnation!
I am going to reboot now (
Bye for 5 minutes.
I'll be back...
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Here is the erring code by the way :-
<%
Dim x
Set x = CreateObject("SIMPLEINIEDIT.IniEdit")
Response.Write x.GetPrivateProfileString("nish", "abc", "c:\xyz.ini") & "<br>"
Dim y
y = x.GetNiceArray()
For Each j In y
Response.Write j & "<br>"
Next
Response.Write x.TestMethod()
Set x = Nothing
%>
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
I would say restart the IIS Web Service. IIS is loading the instance of your DLL and locking the file.
Kelly Herald
Software Developer
Micronpc, LLC
|
|
|
|
|
Kelly Herald wrote:
I would say restart the IIS Web Service. IIS is loading the instance of your DLL and locking the file.
Okay, that's possible too.
But still it's an annoyance.
I thought IIS would that, the component is no longer in use and would call Release()
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|