|
Christian Graus wrote:
EastMohican wrote:
is the bitmap generated for sure a DIB?
Yes, it always has the same pixel format as the image on disk
Yes, but I was a little bit confused working with grayscale JPEGs. Working with such images using libjpeg , for example, you can determine that the image is grayscale. But GDI+ is loading such images using Format8bppIndexed. So, how to check that the image is grayscale ? Only analyzing it's palette.
Christian Graus wrote:
Lock bits provides the bits only, and may actually throw an exception if the image is 8 bit.
Yes, it may. But why not to lock using the pixel format of the image ? So, you will not get exceptions. Besides, you will not get exception if you are locking for read only. It works for 8 bit images locking them as 24 bit.
Andrew
|
|
|
|
|
Thanks Andrew. Any idea about the Palette if I want to convert a GIF to HBITMAP for instance (without forcing the pix format as > 8 bits) ?
<< after getting the HBITMAP from my GDI+ Bitmap::GetHBITMAP() method, in case the bitmaps is (for instance) Indexed 8 bits, where can I get the accompanying Palette information (if any) in order to make a HPALETTE (GDI)object? >>
|
|
|
|
|
Sorry, but I have no ideas. I remember, that I had some problems with palette of HBITMAP. But it was not so important for me that time. I am working mostly with image processing, so it's not preferable for me to work with 8 bpp images (only if they are grayscale).
Andrew
|
|
|
|
|
Thanks anyway.
Amazing the tremendous confusion dominating the Web and newsgroup regarding GDI/GDI+.
Even the posts apparently signed from Microsoft staff are often vague or ambiguous and sometimes wrong. Sounds like nobody is working on it...
Regarding the help, it's like a supermarket where apples are between the shoes and the fridges! Important linked concepts are rarely connected, it's worse than hell to solve the puzzle(s).
Is there a pilot in the plane?
|
|
|
|
|
EastMohican wrote:
Is there a pilot in the plane?
He is jumped out
MS forgot about Video for Windows after DirectShow was appeared. So will be with GDI too, because there is GDI+ now. They are too busy with their new technologies.
Andrew
|
|
|
|
|
Andrew Kirillov wrote:
But why not to lock using the pixel format of the image ?
I said 'may' because all I know for sure is that it does in my image processing articles ( which I never tested against 8 bit, IMO 8 bit is crap ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Any easy way to set breakpoints on a bunch of functions? Eg all methods in a class or functions matching a string?
Thanks.
|
|
|
|
|
Writing a macro for that might just help.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Hi!
I create an object of class A in my code. An object of dialogWnd, dlg, is created. See dialogWnd below. When I attempt m_Slide.SetRange(1, 300), in OnInitDialog(), my program crashes every time. Can anyone give me some idea what is going on? Also, how do you distinguish between CSlider controls if you have more than one is a dialog resource?
class A : public CMDIChildWnd
{
public:
dialogWnd dlg;
};
BOOL dialogWnd::OnInitDialog()
{
CDialog::OnInitDialog();
m_Slide.SetRange(1, 300);
return TRUE;
}
class dialogWnd : public CDialog
{
public:
dialogWnd(CWnd* pParent = NULL);
virtual ~dialogWnd();
//Dialog Data
//{{AFX_DATA(dialogWnd)
enum {IDD = IDD_DIALOGWND};
CSliderCtrl m_Slide;
//}}AFX_DATA
Thanks.
Jerry
|
|
|
|
|
jerry1211a wrote:
my program crashes every time.
Kind of vague on your description aren't you? Usually when a program crashes (especially in DEBUG mode) there will be some kind of error message. If you would enlighten those of us without mind reading abilities as to what the actual error message is we may be able to help you.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
jerry1211a wrote:
how do you distinguish between CSlider controls
Check with GetDlgCtrlID.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
What does the dialog's DoDataExchange() method look like? Put a breakpoint on the SetRange() method and single-step from there. Where does it "crash?"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey there!
Sorry about my confusing explanation, I had been coding all day as was burned out. Anyway, what I am looking for is a simple example of a project just using a slider control, showing DoDataExchange, etc. I assume I need a separate slider class to init the control through a construtor?? I can't seem to find an example.
Thanks again, you have helped me before
Jerry
|
|
|
|
|
jerry1211a wrote:
Anyway, what I am looking for is a simple example of a project just using a slider control, showing DoDataExchange, etc...I can't seem to find an example.
There are several examples here.
jerry1211a wrote:
I assume I need a separate slider class to init the control through a construtor??
For each slider control on the dialog, a CSliderCtrl member control variable will be needed.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks...have a good weekend.
|
|
|
|
|
Hi,
I am doing a project in win32 . I use DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE messages to do certain things when a usb device is connected and disconnected.When I tested the app in XP the above messages are being called twice. ie when I plug the usb device the DBT_DEVICEARRIVAL is called and after certain time say a sec later it automatically calls DBT_DEVICEREMOVECOMPLETE and again DBT_DEVICEARRIVAL. I dont know why it does that. Do anyone have any ideas...pls help
|
|
|
|
|
From MFC dlg app. I post message
CWnd* pWnd = FindWindow(NULL, _T("Osiris"));
HGLOBAL hGlobal = ::GlobalAlloc(GHND, 64000);
LPVOID pMem = (LPVOID)::GlobalLock(hGlobal);
::memcpy(pMem, (LPVOID)"AAA", 4);
::GlobalUnlock(hGlobal);
pWnd->PostMessage(0x450, (WPARAM)hGlobal, GetSafeHwnd());
In the other MFC dlg app. I reciving
LRESULT COsirisDlg::OnUser(WPARAM pWparam, LPARAM pLparam)
{
HGLOBAL hGlobal = (HGLOBAL)pWparam;
LPVOID pMem = ::GlobalLock(hGlobal);
// GlobalFree(pMem);
DWORD dwErr = 0;
if(!pMem)
dwErr = GetLastError();
TCHAR* pChar = (TCHAR*)pMem;
error is always 6 - bad handle.
Why it could be?
Thanks.
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Why are you not using the WM_COPYDATA message? Passing data to another application is what it is designed for.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks David. I don't want SendMessage I need to Post
When you use post message. In msdn mentioned you need to use send. I try post it not works.
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Given that constraint, you'll need to use some other form of IPC (e.g., the clipboard, DDE, memory-mapped file, pipes). The problem is not sending/posting the message between the two, but allowing one process to allocate memory and have the other access it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I think GlobalAlloc allow access memory across process?
In classicall clipbord you use GlobalAlloc. I even found my old C code where I do exactly what I doing now. I thought I foregot something. I understand memory-maped files but information I passing not worth it. It just one small array.
I'll use copule tries. Can't it believe it not work. Thanks.
If will have any ideas/sugestions why
GlobalAlloc
GlobalLock
GlobalUnlock
--------------
another process
--------------
0x0000 = GlobalLock !!! FAIL (WHY)
Let me know.
Thanks.
We yesterday got soberb with Bacchus ...
|
|
|
|
|
Alex_Y wrote:
I think GlobalAlloc allow access memory across process?
A pointer from GlobalAlloc() is only good in one process' address space.
See here for more.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks. Yes Microsoft as ususal did some magic around WM_COPYDATA, and nobody knows this magic. Because in 16-bit and in VS5 you was not able to access to structure. You was forced to use GlobalAlloc. I had server 32bit VS5 and client 16bitVS4. But that functionality scilently disappiared and WM_COPYDATA not requiring global handle anymore. Magic
Thanks a lot.
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Alex_Y wrote:
I think GlobalAlloc allow access memory across process?
If I remember correctly that was possible in 16bit windows but it does not work with 32bit windows.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks I think you right I used to use it in 16bit compiler, but nobody mentioned it the help
Thanks.
We yesterday got drunk with Bacchus ...
|
|
|
|