|
It would help if you show how you declare, define, and initialize your lpQueryBuffer, dwInBufferSize, and lpdwOutBufferSize.
When you changed the size of the lpQueryBuffer, did you also note that change by changing the dwInBufferSize value?
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I am trying to create a grayscale version of an icon. I have extracted the icon and have an HICON but how would I create a grayscale version? I have been trying to figure it out and it seems I need to create an HDC and draw the icon into that but I am new to graphics and am a bit lost...
|
|
|
|
|
hIconGrey = ::CopyImage( hIcon, IMAGE_ICON, 32, 32, LR_MONOCHROME );
too easy too find it
Greetings from Germany
|
|
|
|
|
Thanks for the reply but I have tried that and the image comes out just black and white, I need grayscale so the image looks like the original but no colour. Is there a way I can do that using that function?
|
|
|
|
|
You need to convert RGB values to grayscale values.
The typically formula used is
BYTE 8bitGrayscaleValue = (0.30 * RedByte) + (0.59 * GreenByte) + (0.11 * BlueByte)
or the integer (no floating point) version:
BYTE 8bitGrayscaleValue = (BYTE)((((int)RedByte * 30) + ((int)GreenByte * 59) + ((int)BlueByte * 11)) / 100);
You could create a 24bpp DIB section the dimensions of the icon, select it
into a memory DC, and draw the icon on the memory DC. Then using the pointer
to the DIBSection's pixel bits, iterate through the RGB pixel values, converting
each to grayscale.
That's the easiest way I can think of to access the pixel data of an icon.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Also, this may help:
CreateGrayscaleIcon[^]
The use of GetPixel() and SetPixel() are way slower than accessing pixel data directly as I proposed
in my previous post, if that's an issue.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
im trying to implement this example (http://www.codeproject.com/KB/openGL/GLBase.aspx) into my own little app.
cause i want to learn opengl,c++ & oop.
my german compiler (VC++ 2008 Express Edition) tells me there is in an error in the code.
basicly it sais 'int' cannot be converted to VSYNC, converting into an enumeration requires an explicit typecasting.
code:
in misc.h:
...
typedef enum tagVSYNC
{
VSync_Default = 0x0001,
VSync_On = 0x0002,
VSync_Off = 0x0003
} VSYNC, *PVSYNC;
typedef struct
{
VSYNC Status;
HWND hWnd;
HDC hDC;
BYTE nBPP;
BYTE nRefresh;
bool bFullscreen;
bool bZoomed;
} RENDERARGS, *PRENDERARGS;
...
in WinMain.cpp:
...
RENDERARGS Args={0}; <-this is the line the compiler complains about
...
can someone please help me?
modified on Wednesday, July 2, 2008 11:55 AM
|
|
|
|
|
testcrap wrote: RENDERARGS Args={0};
This is used to initialize the elements of an array. RENDERARGS isn't an array
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
It is a legitimate statement. The problem is that Status is an enum .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
there is no enum tagVSYNC for 0.
Greetings from Germany
|
|
|
|
|
if i change typedef to
typedef enum tagVSYNC
{
VSync_Undefined = 0x0000,
VSync_Default = 0x0001,
VSync_On = 0x0002,
VSync_Off = 0x0003
} VSYNC, *PVSYNC;
the error stays the same.
if i remove "VSYNC Status;" from the struct RENDERARGS it gets initialized without a problem.
is there a quick way to initialize RENDERARGS with null?
|
|
|
|
|
try a memset.
Greetings from Germany
|
|
|
|
|
if i initialize Args with this line it works:
RENDERARGS Args={VSync_Undefined,0,0,0,0,0,0};
also a little test works:
tagVSYNC test=VSync_Undefined;
tagVSYNC test2=(tagVSYNC)0;
can i get this line to work with some trick?
tagVSYNC test=0;
thx 4 help so far !
|
|
|
|
|
testcrap wrote: can someone plaes help me?
Have you considered something like:
typedef struct tagRENDERARGS
{
VSYNC Status;
HWND hWnd;
HDC hDC;
BYTE nBPP;
BYTE nRefresh;
bool bFullscreen;
bool bZoomed;
tagRENDERARGS()
{
Status = VSync_Default;
hWnd = 0;
hDC = 0;
nBPP = 0;
nRefresh = 0;
bFullscreen = 0;
bZoomed = 0;
}
} RENDERARGS, *PRENDERARGS;
...
RENDERARGS Args;
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hello everyone,
Any tool could be used to detect which process or module (e.g. DLL) is occupying a specific TCP port?
When I write code to bind to a specific port, there is always error says the port is occupied. I typed netstat but the port is never showed. Do I need some special parameter to netstat?
thanks in advance,
George
|
|
|
|
|
telnet See here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi AnShUmAn,
Using telnet, you can check whether a port is occupied, but you can never know which process occupied the port. Any comments?
regards,
George
|
|
|
|
|
I think we have a counter for it(Im not sure).
|
|
|
|
|
Hi Hamid,
I do not know how to use counter to monitor the port and which process is using the port. Could you more description about your idea please?
regards,
George
|
|
|
|
|
You can use of PdhAddCounter for insert and monitor tcp/ip.
|
|
|
|
|
Hi Hamid!
I think you can use TCPViewer, it is very powerful.
regards,
George
|
|
|
|
|
Thanks ,btw did you see my previous link for read memory adress?
|
|
|
|
|
Yes, Hamid! It needs manually develop some code, and now a quick usable tool is better for me.
regards,
George
|
|
|
|
|
George_George wrote: Any tool could be used to detect which process or module (e.g. DLL) is occupying a specific TCP port?
Use netstat .
This command lists out all opened TCP ports along with the exe's name
netstat -p TCP /b
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|