|
oppstp wrote: Is the only way to solve above potential problem by making each USER_DEFINED_MESSAGE unique ?
YES! They MUST be unique.
See WM_APP[^] for what values are safe to use.
You can also use RegisterWindowMessage()[^] if you need messages unique system-wide.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply.
I will check the USER_DEFINED_MESSAGE totally and redefine them if need
|
|
|
|
|
if(SaferGetLevelInformation(s, SaferObjectAllIdentificationGuids, lpQueryBuffer, dwInBufferSize, lpdwOutBufferSize) == TRUE)
{
SaferCloseLevel(s);
}
else
{
printf("Error Code::%d\n",GetLastError());
}
The Above function fails and returns an error code:: 122(i.e The data area passed to a system call is too small.)!!!
can anybody suggest me where i am wrong!!
Thankx!!!
|
|
|
|
|
Hi,
Try to increase the size of the buffer(3rd parameter).
Also confirm this size greater than or equal to returned buffer size in last parameter "lpdwOutBufferSize".
The error you mentioned seems generally "buffer parameter was too small".
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Thankx suman !
I already increased the buffersize 50 times more .....but i got the same result
|
|
|
|
|
Aabid wrote: can anybody suggest me where i am wrong!!
How about showing the definition and initialization of lpQueryBuffer , dwInBufferSize , and lpdwOutBufferSize .
"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
|
|
|
|
|
You must've hit the Post button two seconds before me!
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
SAFER_LEVEL_HANDLE s;
TCHAR lpQueryBuffer[MAX_PATH * 10] = "";
DWORD dwInBufferSize = sizeof(lpQueryBuffer);
LPDWORD lpdwOutBufferSize = &dwInBufferSize;
if(SaferGetLevelInformation(s, SaferObjectSingleIdentification, lpQueryBuffer, dwInBufferSize, lpdwOutBufferSize) == TRUE)
{
SaferCloseLevel(s);
}
else
{
printf("Error Code::%d\n",GetLastError());
}
|
|
|
|
|
Have you tried using a different address for lpdwOutBufferSize ? Having it use the same address as dwInBufferSize seems odd.
"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
|
|
|
|
|
As noted, don't have lpdwOutBufferSize point to your dwInBufferSize variable.
Also, since you have lpQueryBuffer defined as a TCHAR, you should use
TCHAR lpQueryBuffer[MAX_PATH * 10] = _T("");
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
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
|
|
|
|
|