|
I do not know if it is present in any standards, but in the regular GDI, when you get access to the bits through GetDIBits, you can specify whether you want a bottom up, or a top-down bitmap.
So it is a common thing, it has been around since windows 3.0, maybe longer. I think it really depends on what you are doing to determine how you may want to scan your bitmap.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Sometimes your bitmap is upside down, or you want to flip your bitmap vertically at runtime, this is an easy way to accomplish that with no extra code beside specifying the scanline order that you desire.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have a STA COM object which is the gate to a service that has 15 threads, each corresponding to a Logical connection against an MVS. When this COM object lives inside the COM+ I can see from the performance monitor that it utilizes up to 8 threads. So no matter how many clients hit the component it will utilize up to 8 threads.
However, when the same component lives outside the COM+,regsvr32 kkkk.dll, it will utilize all 15 threads.
1. Is there such a limitation in COM+?
2. Why the same component operates perfectly outside COM+?
3. Is there a chance to increase the number of threads while the component lives inside COM+?
Thx
Spiros Prantalos
|
|
|
|
|
Which win32 API should I use to find out which external window has focus?
Thanks
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
GetFocus will return the handle to the window if that window belongs to the calling threads message queue. If a window in that thread does not have the focus, then the result will be NULL.
If you want to find out the focus window that belongs to a different thread or even a different application, you can call GetForegroundWindow to get a handle to the window with which the user is currently working then associate your threads message queue with that window by calling AttachThreadInput . THen you will be able to successfully call GetFocus on that window and get the handle of the control with the focus.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thank for reply kilowatt.
kilowatt wrote:
, you can call GetForegroundWindow to get a handle to the window with which the user is currently working then associate your threads message queue with that window by calling AttachThreadInput. THen you will be able to successfully call GetFocus on that window and get the handle of the control with the focus.
I can't understand one thing,when I use GetForegroundWindow to get the handle to the window that user is currently working then whats the need for GetFocus ?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
GetForegroundWindow will tell you which is the top-level window that the user is working in. If you wanted to find the actual control that had the keyboard focus you would need to do that other stuff that I described.
I hope that helps.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
I hope that helps.
Yes,I got the point now.Thank you.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Hi again kilo
Do you mean something like this?
HWND hwnd;
DWORD dword;
hwnd = (HWND)GetForegroundWindow();
GetWindowThreadProcessId( hwnd , &dword);
AttachThreadInput( dword , GetCurrentThreadId() ,true);
hwnd = GetFocus();
Thanks
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
i have a dialog based app and too many CMyRichEdit controls used in it.
i wanted to change fonts of my CMyRichEdit objects in MyRichEdit.cpp but i could not succeed.
Where should i start from?
When i do it in my OnInitDialog in CMyDialog class i achieved to change fonts of my individual CMyRichEdit controls
but i want to change all controls at once.
Is there anyone who can help me?
Thanks for ur help,
Atilla Selem
just listening to you...
|
|
|
|
|
It might help if you explain why you could not succeed in changing fonts in MyRichEdit.cpp. You would normally set the font in the CMyRichEdit class.
|
|
|
|
|
How do I draw a pixel into a CView?
What's the API call to draw a pixel?
I guess I put all the code in the OnDraw of the CView derived class!
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
CDC::SetPixel
Thanks
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
How many SetPixel operations will you be performing?
If you are doing a lot, you may want to consider creating a bitmap and accessing the bits directly becuase set pixel will slow your program down by orders of magnitude.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
How many SetPixel operations will you be performing?
If you are doing a lot, you may want to consider creating a bitmap and accessing the bits directly becuase set pixel will slow your program down by orders of magnitude.
I am trying to decrypt an unknown image format! I wanted to try out different combinations and reproduce the image. We have a hard copy of the image and the image file [some kinda custom format from the mid 80s]
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Sounds interesting?
Are you doing that for fun, or have you tried to find the decoder and it is not available?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
Are you doing that for fun, or have you tried to find the decoder and it is not available?
Part fun, part serious. We have a client who's been using this image format for almost 20 years. The main program is in GWBASIC and they have this external program [written with assembler]. Partial sources available. Long assembler listings
I understand that the first 32 bytes is some kinda header. The rest of it has a lot of 0xFFs in them. I am assuming the 0xFFs are the black spaces and am making guessed at what the other bytes mean.
One problem is I don't know the width of the image in pixels!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish wrote:
How do I draw a pixel into a CView?
Don't, it will be dog slow. Create a DIB section instead and get direct access to the bits, then blit that bitmap to the view. It will be both much faster and easier to handle.
|
|
|
|
|
Mike Nordell wrote:
Don't, it will be dog slow
Yeah it sure was slow
So slow it looked like some kinda animation where I could see it drawing it on screen
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I have pure Win32 based project with own message loop, something like:
CreateWindow();
for (;; )
{
EngineMain();
if(!PumpMessage()) break;
}
DestroyWindow();
When there is nothing todo (e.g. dialog is miminized) I would like to tell Windows that I'm idle. Currently the CPU consumption is allways 100%, because the message loop is running like crazy, hehe. Well, I'd like to avoid that.
thx, Moak
|
|
|
|
|
You code never blocks, like GetMessage() normally does. You need some mechanism to make your thread block (and thus receive no CPU time) when the queue is empty, then unblock when a message arrives in the queue.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
thx, i did without PeekMessage and it blocks + CPU consumption is low!
|
|
|
|
|
I am just curious, how did you end up doing it?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
I am just curious, how did you end up doing it?
I'll block with WaitMessage() when there is no window visible. Member variable m_data.bVisible is set in my WindowProc callback handler (have a look on WM_SIZE).
BOOL CBlueSharkEngineWindow::PumpMessage()
{
assert(m_data.bCreated);
assert(m_pInterface);
MSG msg;
while (::PeekMessage (&msg,NULL,0,0,PM_NOREMOVE))
{
if (!::GetMessage (&msg, NULL, 0, 0))
{
m_pInterface->pConsole->Logfile(SHARKENGINE_LOG_DEBUG3, "Quit message received");
return FALSE;
}
::TranslateMessage (&msg);
::DispatchMessage (&msg);
}
if(!m_data.bVisible) WaitMessage();
return TRUE;
}
Greets, Moak
|
|
|
|
|
I think you should create a worker thread that does whatever your EngineMain funtion is doing. Thus, you can still handle all other Windows messages
Best regards,
Alexandru Savescu
|
|
|
|