|
I wanna use WINDOWINFO and GetWindowInfo in my applican but the compiler can not identify them.Any idea?
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
|
|
|
|
|
That function requires windows98 or later, ans WindowsNT4.0 with the SP3.
The compiler will not let you see this function because you probably have this definition in your "stadafx.h" file:
#define WINVER 0x0400
That basically says use version 4.0 and below API functions. You will need to change this definition to this:
#define WINVER 0x0500
The only drawback to doing this is that you will have to check the version of the OS that your app is running on before you call the version 5.0 API functions if you want your app to run on Windows 95.
Good Luck.
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!
|
|
|
|
|
Thanksssssss,I change it and it works now.
How do you know these things kilo?
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 worked for a company that had to analyze every aspect of the Windows API in order for their product to work properly. Needless to say I learned things that you wouldn't believe about the Windows API, and I learned how to read the documentation very well in order to find the details that I needed.
I would like to add one thing, I think that the MSDN documentation is excellent. So many times I see people complain that Microsoft's documentation sucks, and they complain that this feature is not documented. I find that if I spend a few extra minutes reading all of the remarks and information for each function you can usually solve your problems.
Anyway, the way that I knew how to solve this problem is that at the bottom of the docuementation for each function in the SDK docuemntation you will see this:
Requirements
Windows NT/2000 or later: Requires Windows NT 4.0 SP3 or later.
Windows 95/98/Me: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
This will help you decide if you can use it or not, and which version headers that you need to use in order
to get the compiler to give you access to the functions.
If you have any more questions ask away.
Good Luck.
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!
|
|
|
|
|
If you have windows.h included and User32.lib it should work... and what I know these are already included?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Thanks Rickard,the problem was what kilo said.
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
|
|
|
|
|
Is this the correct way to set a CView's background?
CView::OnEraseBkgnd(pDC);
CRect r;
CBrush b;
b.CreateSolidBrush(RGB(200,200,200));
GetClientRect(&r);
pDC->FillRect(r,&b);
return true;
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I would say yes, except that you probably do not want to send a call to the base class since you are redrawing over the entire screen anyway. You may end up with a flicker if white, then your gray color that you define.
Are there any problems that you are seeing?
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 would say yes, except that you probably do not want to send a call to the base class since you are redrawing over the entire screen anyway. You may end up with a flicker if white, then your gray color that you define.
Are there any problems that you are seeing?
Thanks Kilo. I am not facing any probs. The reason I had to do this was that I assumed that the background of the view would be RGB(255,255,255) but it was not that
So I thought what the heck and made the background and my image background my own slightly grayish color.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
but please be warned..
it is not not not nice at all to set a window's background not in the color the user defined in his / hers settings..
e.g. i have got a slight grayish background for all windows (otherwise my eyes burnt after staring 8 hours++ at the monitor)
<rant>
and i hate all programmer and want to rip out their nuts *you can add any hate - fantasy you like, e.g. slipknot lyrics*, who override my settings with stupid settings (e.g. white)..
like lotus notes does.. (at least the client i have to use)
if you don't want to use windows settings use another platform...
and if you are a smart programmer you would use a transparent bitmap, altough it could look totally crappy if the background could be too dark...
but.. you are a smart programmer, aren't you? so you are paid to find a solution..
maybe it is not a too good idea to override windows settings.. not?
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Well in this case I am the single end-user. This is a test program where I am trying to decode an unknown image format. I like grays. I want a gray background since I am going to be running this program close to 600 times today and tomorrow before I manage to crack the image format
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Should work. You can use CDC::FillSolidRect which could be marginally faster - it uses a trick with ::ExtTextOut and doesn't create brush.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Hi,
For some bizzare reason I can't run any of my GDI+ projects in Debug mode. Keep getting compile-errors when i try to dynamically instantiate a Bitmap object. Also the IDE doesn't list the members of GDI+ objects as I code.
Anyone any clues?
Cheers
Richard
|
|
|
|
|
You don't mention what compile-errors you're getting.
If you're getting Error C2660: 'new' : function does not take three parameters, then an MFC generated define, DEBUG_NEW, defines a "new" operator that takes three parameters. It only applies to debug builds. You can undefine DEBUG_NEW so that debug builds also work or use the scope resolution operator ( :: ) before new to use the default C++ version, like this:
bitmap = ::new bitmap
|
|
|
|
|
Hi,
I have been looking at the GDI+ BitmapData Class for direct pixel data access. In MSDN it mentions you can get "bottom up" bitmap as well as "top down", when do you get bottom-up, is this present in any particular standards?
Cheers
Rich
|
|
|
|
|
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...
|
|
|
|