|
|
Up |
|
|
  |
Author: SharonSharon
Date: Dec 25, 2008 08:03
Hello helping experts,
I'm using VC2005 with .NET Framework 2.0, C#.
I using the Win32 GDI function:
HPEN CreatePen(int fnPenStyle,int nWidth,COLORREF crColor)
as PInvoke as follow:
[ System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
private static extern IntPtr CreatePen(PenStyles enPenStyle, int nWidth, int
crColor);
But when I'm using/invoking the CreatePen by my C# code as follow:
Color color = Color.Yellow;
int crColor = color.ToArgb() & 0xFFFFFF; // or just color.ToArgb()
IntPtr gdiPen = CreatePen(/*PS_SOLID*/0, 1, GetRGBFromColor(PenColor));
The color I'm getting is not the color being drawn. In most of the colors
I'm setting, the color being drawn is deferent.
What am I doing wrong?
--
Thanks
Sharon
|
| |
|
| |
no comments
|
|
  |
Author: SharonSharon
Date: Dec 25, 2008 07:58
Hello helping experts,
I'm using VC2005 with .NET Framework 2.0, C#.
I using the Win32 GDI function:
HPEN CreatePen(int fnPenStyle,int nWidth,COLORREF crColor)
as PInvoke as follow:
[ System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
private static extern IntPtr CreatePen(PenStyles enPenStyle, int nWidth, int
crColor);
But when I'm using/invoking the CreatePen by my C# code as follow:
Color color = Color.Yellow;
int crColor = color.ToArgb() & 0xFFFFFF; // or just color.ToArgb()
IntPtr gdiPen = CreatePen(/*PS_SOLID*/0, 1, GetRGBFromColor(PenColor));
The color I'm getting is not the color being drawn. In most of the colors
I'm setting, the color being drawn is deferent.
What am I doing wrong?
--
Thanks
Sharon
|
| |
|
| |
no comments
|
|
  |
Author:
Date: Dec 24, 2008 13:37
"Rick" discussions.microsoft.com> wrote in message
news:63156C50-F75E-4083-97CC-D3479B81F40D@microsoft.com...
> Hello,
> I want to get current display monitor interface connected to VGA or DVI.
> What's API retrieve the monitor connector type ?
I would say the best bet is via WMI, but I don't see that information in the
Win32_VideoController or Win32_DesktopMonitor WMI classes...
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
>
> thanks
> Rick
>
|
| |
|
no comments
|
|
  |
Author: Joseph M. NewcomerJoseph M. Newcomer
Date: Sep 22, 2008 09:32
You won't get a WM_CHAR for some keys because, guess what, they don't generate characters!
For exmaple, left arrow, right arrow, up arrow, down arrow, insert, page up, page down,
print screen, scroll lock, function keys, and so on have no equivalent characters in the
character set, so they do not generate any WM_CHAR message when TranslateMessage is
called. I'm not sure there is any specific guarantee, but take a look at the virtual
key-codes table and you can pretty muich figure out which ones don't generate characters.
Note that left-arrow has a virtual key code that is the code for '%%', but whose name is
VKEY_LEFT. OTOH, '%%' has no WM_KEYDOWN (for a US-ASCII keyboard it is 5 with the shift
key down)
Generally the way we handle this is to look for the VKEY_ values we care about and ignore
everything else.
joe
On Sat, 13 Sep 2008 13:23:17 -0700 (PDT), nate@ nate879.org wrote:
>I need to get keycodes and ASCII characters from the same keypress.
>But I can't get that to work. Apparantly, I have to handle both
>WM_KEYDOWN and WM_CHAR. But the WM_CHAR message isn't generated for
>some keys! I need a way to figure out when I won't get a WM_CHAR
>message.
|
| |
|
no comments
|
|
  |
Author: Larry LindstromLarry Lindstrom
Date: Sep 18, 2008 04:11
Hi Folks:
Developing on Win32, VS 2008 Pro, C++ Win32 no MFC.
A dialog has an owner draw listbox, and when
drawing the listbox items I create a clip region for
each of several pieces of text in the function that
actually calls Graphics::DrawString().
After the function finishes, I'd like to draw a
border around the listbox item, but the region is
still being clipped.
I've resolved this by drawing the bounding
rectangle before the text, but I'm wondering how
the clipping can be turned off.
Thanks
Lary
|
| |
|
2 Comments |
|
  |
Author: Siegfried HeintzeSiegfried Heintze
Date: Sep 17, 2008 20:14
I have a custom LCD display connected to a embedded processor with which I
communicate via USB.
Can someone point me to an example of drawing to a GDI+ bitmap without
drawing to a window first? I want to create a list box in a GDI+ bitmap
instead of a window and then scroll the contents of the listbox by
simulating mouse clicks while periodicatlly piping a copy of the bitmap
display (via IMediaSample) down thru the USB to create an animation on the
embedded device.
I don't know how to create a listbox outside of the context of a dialog
box -- so I need help there. I don't know how to create any window (let
alone a listbox) on a GDI+ bitmap so I need help there too. I guess I would
set up a winproc and use SendMessage(WM_LBUTTONDOWN ...) to the handle of
the bitmap?
Also, I want to populate each element of the list box with images. I've seen
the code for that in MFC books. I'll need a pointer for that too.
Thanks!
Siegfried
|
| |
|
3 Comments |
|
  |
Author: JojoWuJojoWu
Date: Sep 17, 2008 01:44
Hi,
I have a c++ win32 program 'mypoweroff.exe', it can pop-up a window to
support options and calls ExitWindowsEx(EWX_FORCE | EWX_POWEROFF, 0) to
shutdown the machine with enabling the SE_SHUTDOWN_NAME.
I have the other service program 'mysvc.exe', it calls CreateProcess to
launch 'mypoweroff.exe' with SYSTEM privilege and specifying the current
logon user session id.
They worked well on 2000,XP(32&64),2003(32&64),Vista(32&64). But it changes
from shutdown to logoff on 2008(32&64) when current logon user is a user of
Users group. It also logoff the user when i launched the 'mypoweroff.exe'
with run as Administrator. If the current logon user is a user of
Administrators group, it worked well.
It will work well if i add Everyone into the 'shut down the system' of
group policy, but i cannot do this way.
Is it a windows issue? or I can add some code to make it corrent?
Please support me some information.
thank you,
Jojo
|
| |
|
3 Comments |
|
  |
Author: Siegfried HeintzeSiegfried Heintze
Date: Sep 17, 2008 01:08
We have been advised that DirectDraw and therefor WPF are very slow because
the WPF function RenderTargetBitmap does not use hardware acceleration. We
are not interested in displaying images on a monitor (which DirectDraw and
WPF are very good at). We need to render to an offscreen pixmap (bitmap) and
pipe that image thru a USB to an embedded device very quickly to create a
real time animation. We are already doing this animation on simple things
like scrolling.
WPF (and I assume DirectDraw) has some very nice demos of rotating a image
in 3 space to give it a perspective. They also map images to wierd surfaces.
I need to reinvent these features without WPF and DirectDraw so we can
render to a bitmap quickly.
How can I reinvent these features of WPF using GDI+? What kinds of things
would I live search for to learn how to use
(1) Intel's CPU resident SIMD (sse) features with the Microsoft compiler (I
found...
|
| Show full article (2.26Kb) |
|
3 Comments |
|
  |
Author: Siegfried HeintzeSiegfried Heintze
Date: Sep 15, 2008 12:11
Can anyone recommend a good source of sample programs that demonstrate pixmap
(bitmap) manipulations? Perhaps a good book?
I need to take a pixmap, map it to a 3D cylinder, and rotate the cylinder
and create an animation and then pump the frames thru a USB to an embedded
device to create a real time animation on that embedded device. I have no
interest in display this on a microsoft window.
I'm told by multiple sources that DirectX (and therefor WPF) are poor
choices for this since there is no hardware assist for the bitmap rendering!
Thanks!
Siegfried
|
| |
|
1 Comment |
|
  |
|
|
  |
Author:
Date: Sep 12, 2008 03:05
I've saw once the program which painted custom internal scrollbars in various windows. When I'm trying to paint in NC area in my own window, standard scrollbars are painting over mine whatever I do. How can fully get control over what is painted in my window non-client area?
|
| |
|
2 Comments |
|
|
|
|