|
StretchDIBits problem with 16-bit (65536) colours
hello all,
my name is durval and i've the following problem in my project:
when the color-palette from the windows-desktop (properties)
16-bit (65536) is set. on ms-c++ print-preview (mfc) the
::StretchBlt(...)/::StretchDIBits(...)/::::BitBlt(...)
doesn't work properly. the bitmap is dividing in 2 parts, the
right (1/3 from the bitmap) will be put on the left place and
the left is displaced to the right.
at all the other color-settings there's no problem: 8-bit, 24-bit...
do you know this problem?
please, if everybody could help me, it would be very nice.
thanx a lot,
durval.
the code:
BOOL CDib::Draw(CDC* pDC, CPoint origin, CSize size)
{
if(m_lpBMIH == NULL) return FALSE;
if(m_hPalette != NULL)
::SelectPalette(pDC->GetSafeHdc(), m_hPalette, TRUE);
pDC->SetStretchBltMode(COLORONCOLOR);
// ::BitBlt( pDC->GetSafeHdc(), origin.x, origin.y, m_lpBMIH->biWidth, m_lpBMIH->biHeight, memDC.m_hDC, 0, 0, SRCCOPY );
// ::StretchBlt( pDC->GetSafeHdc(), origin.x, origin.y, size.cx, size.cy, memDC.m_hDC, 0, 0, m_lpBMIH->biWidth, m_lpBMIH->biHeight , SRCCOPY );
::StretchDIBits(pDC->GetSafeHdc(), origin.x, origin.y, size.cx, size.cy,
0, 0, m_lpBMIH->biWidth, m_lpBMIH->biHeight,
m_lpImage, (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS, SRCCOPY);
return TRUE;
}
-------------------------------------------------------------------
system:
Microsoft (R) Windows NT (TM) Workstation
Version 4.0 (Build 1381: Service Pack 6) x86 Uniprocessor Free
-------------------------------------------------------------------
graphic:
BIOS-Datum: 11/17/20
BIOS-Version: Video memory: 1 MB Device Revision: 2.0
Hardware Version 0.0
Adapter:
Setting: 1280 x 1024 x 65536 75 Hz
Typ: i81xnt4-kompatible Grafikkarte
Description: Intel815 Video Accelerator
Memory: 4 MB
Chip-Typ: Intel815
DAC-Typ: Internal
Driver:
Company: <n a="">
Datei(en): i81xnt4.sys, i81xdnt4.dll
Version: <n a="">, 4.0.32
|
|
|
|
|
Hello.
Is there a portable way to obtain cpu usage counter
on Win32 platform ? "portable" means it will work
on NT as well as on '9x.
Thanks,
Max.
|
|
|
|
|
Simple answer AFAIK is no.
However, if I remember correctly there is that tool in win 98 system tools which will montior and optionally record to a log file all the data you would ever want to know, including CPU usage. If i'm not loosing my mind and this tool does exist (it's been a while since I used 98) you could parse it's log file and get CPU usage that way. Other than that I think it's next to impossible under 98 without using VxD's or something. Unless there is some undocumented API in 98 that the tool uses, I dunno
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
OK, thanks. And further question - how to do it
in WinNT/2k/xp ? The easiest way ? (phd funcs
are quite complex)
Max.
|
|
|
|
|
I create a form in VC like this
CHECKBOX1 TEXTBOX1
CHECKBOX2 TEXTBOX2
....
CHECKBOX9 TEXTBOX9
in init, i want all that objects are disable, whenever user checks on any check box, the next textbox will be enable. Becase i have many checkbox and textbox, i don't know to create a function which i can use for all the group (checkbox and textbox)
Please help me!!
Thien Thanh
azury_thanh@yahoo.com
|
|
|
|
|
If all you have is 9 checkboxes, using the ON_BN_CLICKED() handler is not out-of-line. Or you can look at the ON_CONTROL_RANGE() handler.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hey, I've createt an axtiveX Control which shows a modeless dialog. Now my Control should notify the containerapp when there a changes in dialogs items. I tried to send a message from my dialogclass to the parent (ControlClass) but nothing happend. How can I notify my ControlClass from within my DialogClass?
|
|
|
|
|
You can notify the container application of an ActiveX control by fireing events to it. In order to create them, you should create an Event Map (very much like a Message Map in a "normal" MFC app) between your events and functions.
Look up BEGIN_EVENT_MAP, END_EVENT_MAP macros , and Add Event Wizard.
Peter Molnar
|
|
|
|
|
Thank you,
but only the Controll_Class can fire event's. My problem is to notify the controll_class from within my dialog_class. I tried to send messages but it didn't work. I created a PreTranslation -function in my controll-class, but no messages from the dialog_class reached the controll_class.
|
|
|
|
|
Sorry, I must have misunderstood you.
Your problem can then be led to communicating between modeless dialog and its creator thread.
For this you will have to be able to call the creator thread's functions, which is only possible if you pass a pointer of your creator thread to the modeless dialog. Using this pointer you post messages from the modeless dialog which can be caught in the control class.
Try the following:
1.Add to your modeless dialog (in the header file):
#define WM_SEND_MY_MESSAGE (WM_USER + 1)
COleControl* m_pCreator;
void inline SetCreatorThreadPointer(COleControl* pCreator) {m_pCreator = pCreator;};
2.Add to your control class a message handler:
ON_MESSAGE(WM_SEND_MY_MESSAGE, OnModelessDialogSend)
and also implement the function with prototype OnModelessDialogSend(WPARAM wParam, LPARAM lParam); From here you will fire your events.
3.In your control class:
m_pDialog->SetCreatorThreadPointer(this);
m_pDialog->Create(...);
4.In your modeless dialog, when your message occurs, post a message to your control class:
m_pCreator->PostMessage( WM_SEND_MY_MESSAGE, (WPARAM)"Hi!");
Peter Molnar
|
|
|
|
|
Hi guys
There is a simple way to open a new email with an attachement an the adress destination on it from an app when a button is pressed?
What about to have some text on it?
Best Regards
Doc
|
|
|
|
|
Have you looked at the MapiMessage structure? It is used by MAPISendMail() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Without attachments but with To,CC, subject and body:
ShellExecute(NULL,"open","mailto:doctorpi@codeproject.com?cc=doctorpi@home.com&subject=Information&body=about opening default mail client",NULL,NULL,SW_SHOWNORMAL);
Peter Molnar
|
|
|
|
|
You do have the grasp on this; only you need to re-read your own message again: when you push something into a vector, a copy of whatever you push gets created. In your case, that is a copy of the pointer, not a copy of the object pointed to.
The offending delete call destroys the object, causing subsequent attempts to use the (now) stale pointer from the vector to go haywire.
Solution: Do not store the pointer to the object but the object itself; or store the pointer and make sure to delete as and when appropriate. That is, delete exactly once after the last use of the object in question.
Good luck,
Bernd
|
|
|
|
|
Right, you "copy" the pointer, but you don't copy what the pointer points to. If you call delete on pImageDisplay, then it deletes the CImageDisplay object, thus causing pImageDisplayVector[i] to point to unallocated memory. In other words, don't call delete until you're done with pImageDisplayVector. Just let pImageDisplay go out of scope. Then, in the destructor of whatever object pImageDisplayVector is part of, iterate through pImageDisplayVector calling delete on each item. This will destroy everything that's suppose to be destroyed.
|
|
|
|
|
Your responses really explained the situation! I was quite confused, thinking I had made a copy of the image itself, not just the pointer.........so actually deleting the vectorElement[i] will take care of freeing the memory on the heap since both were pointing to the same thing.. Many thanks for the clarification,
ns
|
|
|
|
|
Hello everbody. I have a strange problem. When I compile my dll (with Visual Studio .NET 2003) in Release the compiler give me those strange errors in linking:
error LNK2005: ___CppXcptFilter already defined in msvcrt.lib(MSVCR71.dll)
error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
error LNK2005: __amsg_exit already defined in msvcrt.lib(MSVCR71.dll)
error LNK2005: _atoi already defined in msvcrt.lib(MSVCR71.dll)
error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
The project property is the same that in debug. I don't know what is the problem. The fact is also more strange because if I compile in Release with another PC the compilation will succeed. The version of the Visual .NET is the same, but I don't know what are the differences.
Can you help me ?
Thank you very much for any answer.
|
|
|
|
|
Interesting.
Recheck project properties and make sure the DLL is set for multithreading and for dynamic linking.
Kuphryn
|
|
|
|
|
In order to link your project with any library I would reccomend you to use
#pragma commment(lib,"yourlib");
instead of adding libraries over Project/Properties/Linker/Additional dependencies, because #pragma's apply to both release and debug build settings, and therefore there is less chance that you forget to link with libraries in either build.
Peter Molnar
|
|
|
|
|
Thank you very much for the answer. I find the problem. I have a library linked to my dll and, in Release, it was too old. After a rebuild, all work right.
Thanks
|
|
|
|
|
Hello all,
I want to notify thread1 to end by itself. I don't like to use the function TerminateThread() to do this job. But thread1 is a worker thread not a UI thread so it doesn't have a message queue. I can't send some messages to it.
How can I do?
Thanks a lot
|
|
|
|
|
Well, if the worker thread waits for an event with WaitForSingleObject then
add one more event for quit event and then set that event by using SetEvent.
The thread should wait for signal from one of the both events by using
WaitForMultipleObjects API.
|
|
|
|
|
Thanks Dudi, I get an idea now.
|
|
|
|
|
Further to a recent discussion thread, I can now stream RGB type formats across a propriatory link and render the image remotely. This proves the concept, however RGB encoding is large so have shifted to H263 encoding and decoding. But of course it isn't generating a picture at the other end :-/ !!
The other end uses Graphedit with the appropriate decoder in place.
When I send the IMediaSample from the sending end I used to just send the sample length and the sample itself, I now also send the Synch , Preroll, discontinuity and Start Stop Reference times to ensure the MediaSample I generate at the other end is representative, ie prior to going into the H263 decoder... but no joy.
Has anyone attempted the same thing and had problems with H263 (have also tried H261) or got any ideas?
Many Thanks
Loz
|
|
|
|
|
hi all,
am stuck with a crucial and interstng problem.
if anyone can help in solving TSP(Travelling sales person) problem using the Branch and Bound Algorithm.?
thanks
Deepesh Dhakad
Indian Institute of Information Technology,Allahabad
India
|
|
|
|
|