|
You have a number of options:
1) Implement your own callback mechanism.
2) Use more mature technique such Observer design pattern.
3) If you program in new C++/CLI, event model is a good notification mechanism to use.
- It's easier to make than to correct a mistake.
|
|
|
|
|
is there a solution to directly turn off a hard-disk?
I need such a small program for testing purposes!
Please help.
It should be as small as like that:
http://www.codeproject.com/system/display_states.asp
|
|
|
|
|
|
Hi guys
I get following error when running my program.
Run-Time Check Failure #2 - Stack around the variable 'Temp' was corrupted.
where 'Temp' is a pointer to a class.
Does anyone know what the source of this run time error is ?
regards
Mahdi
|
|
|
|
|
I am developing a flow-chart program which needs many nice and simple shapes, such as heart (or "I love u"), mushroom etc, and formulas to draw them.
do u know links which provide this kind of shapes and formulars?
thx
|
|
|
|
|
asked in an interview---
what is marshalling in c++, pls give me a small code example.
thanx in advance
kumar_windows
|
|
|
|
|
All data/variables that are passed as parameters to processes, or passed through contexts must have appropriate marshalling functions. These functions convert the data to and from a binary stream.
The passing of data and values after being converted to binary stream is called "marshalling".
Marshalling is acheived through the use of the classes mStream and umStream, which marshal and unmarshal data respectively.
The global functions:
mStream & operator<< (mStream & s, T const &v);
umStream& operator>> (umStream& s, T &v);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The term "marshalling" usually refers to COM; specifically when you make an object in one apartment accessible in another. See Here[^] for details.
Steve
|
|
|
|
|
Hi,
I have a bitmap file in memory, including the header. Now I would like to create a CBitmap/HBITMAP from it.
My problem is that LoadImage only loads a .bmp from a file, but not from a buffer.
CBitmap::CreateBitmapIndirect allows to create the CBitmap from a BITMAP structure, but unfortunately this structure is different from the bitmap header. The BITMAP structure also has no pointer to the color palette??
Is there a better way to load the bitmap than going through the header to find the data myself?
|
|
|
|
|
Put the bitmap into a stream using CreateStreamOnHGlobal() and write the bitmap contents to it.
Then use the GDI+ Bitmap::FromStream() to load it into a bitmap object, then you can create a Graphics object on the HDC and display it using DrawImage.
Whenever you are using bitmaps from any of the major formats or trying to create, manipulate, convert a bitmap/image, GDI+ will save you loads of time and effort. You can hybrid GDI/GDI+ without much effort so you don't have to give up what you already know.
|
|
|
|
|
Thanks, but I would like to avoid to use GDI+.
Maybe LoadImage can be used with a named pipe?
|
|
|
|
|
ABuenger wrote: I would like to avoid to use GDI+.
For each his/her own.
Good day.
|
|
|
|
|
|
Thanks, here is the working code, pvImage points to the beginning ('BM') of the bitmap file.
PBYTE pBitmapData = (PBYTE) pvImage;<br />
<br />
BITMAPFILEHEADER *pBitmapFileHeader = (BITMAPFILEHEADER *) pvImage;<br />
<br />
pBitmapData += sizeof(BITMAPFILEHEADER);<br />
<br />
BITMAPINFO *pBitmapInfo = (BITMAPINFO *) pBitmapData;<br />
<br />
PBYTE pData = (PBYTE) pvImage + pBitmapFileHeader->bfOffBits;<br />
<br />
CClientDC clientDC (NULL);<br />
<br />
HBITMAP hBitmap = CreateDIBitmap (clientDC, &pBitmapInfo->bmiHeader, CBM_INIT, pData, pBitmapInfo, DIB_RGB_COLORS);<br />
<br />
pBitmap = new CBitmap;<br />
ASSERT (NULL != pBitmap);<br />
<br />
VERIFY (pBitmap->Attach (hBitmap));
|
|
|
|
|
I have a program with a thread which appears to work, but it does something strange. The thread contains an infinite loop with a particular condition to exit the loop. The program runs as a console program. The thing that is strange is that the function that creates the thread starts the thread and I can see the numbers being printed on the screen, but then it suddenly ends. I can increase the amount of numbers being printed on the screen by putting a Sleep method in the calling function that creates the thread. Why does it do this? I would expect that the thread should continue to print numbers until the condition to jump out of the while loop is reached. I don't really understand threads that well so maybe my assumptions are wrong. It seems like the function that creates the thread ends and then the thread ends as well. Is this what is happening and I need to somehow stall the calling function from ending in order for the thread to do everything that I want it to do?
Z.K.
|
|
|
|
|
Well, I got it to work the way I want, but inserting a getche() in the function that creates the thread.
Z.K.
Z.K.
|
|
|
|
|
Hi,
Does anyone know how to declare an enum type in Vs7 so that it is exposed on the COM interface in an ATL project?
It is easy to do this in VS6, you just edit the IDL file, compile and it's done. In VS7 however, the IDL file is
compiled from the ATL interface header file. I've tried declaring the enum in this header file, but when it's
compiled only the interface code appears in the generated IDL file.
Any help greatly appreciated
Ian McLauchlan
|
|
|
|
|
I need a plot curve the example? Who may provide? Extremely thank!
alantop
|
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Thanks two.I want the curve is free, no rule, casually for two, may draw passes
through these two curves.
alantop
|
|
|
|
|
hi friends,
in my application i have applied a bitmap image as the background of dialog but when i do this the background of static controls,radio buttons is not changing how can i get rid of this problem.
please suggest a solution for this problem.
sathish
|
|
|
|
|
Use ModifyStyleEx(0, WS_EX_TRANSPARENT); for control.
As well as you have to handle the OnCtlColor of the Dialog and Return the NULL brush for controls
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
For Static Controls
See Here[^]
(You can also do this)
For a radio button try this in OnCtlColor as A_Laxman suggests:
if(pWnd->GetDlgCtrlID()==IDC_RADIO1 || pWnd->GetDlgCtrlID()==IDC_STATIC) //IDC_RADIO1 is controlID for radio button
hbr=(HBRUSH)GetStockObject(NULL_BRUSH);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i my project io have one list control and one add button.one we click on the add button a new window is open to enter the item after clicking ok the item should be entered in list control.up to here my program is working
after that once we again complie we did not get the aded items.please solve my problem.
thank u,
vasu.
|
|
|
|