|
Will IOCP promotes the performence much in a server with only one CPU?
|
|
|
|
|
Yes.
What is IOCP? Just kidding.
Define "much".
It should improve perfomance. Even more so on the latests chips (dual core).
Of course that is also dependent on your code not eating up the benefits.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
iocp good any cpu
Kuphryn
|
|
|
|
|
How can I do attribution with DWORD type?
With CString
<br />
CString str;<br />
Str="something";<br />
Can I do something similar with DWORD type?
|
|
|
|
|
DWORD val;<br />
val = 4;
If you mean something different than this, you need to be more specific.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: you need to be more specific.
Be careful where you point that! See this[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
I've been search around web, and I can't find how can I code a dialog to open a file with his respective application.
For example, Click on button an open a pdf on adobe reader.
|
|
|
|
|
|
like this
<br />
CString FileName=_T("Ping");<br />
CString strParam=_T("127.0.0.1");<br />
<br />
ShellExecute(NULL,_T("open"), FileName,strParam,NULL,SW_SHOW);<br />
<br />
|
|
|
|
|
And If I want to open a pdf on folder?
I want to attach to my program a Help manual on pdf.
|
|
|
|
|
Just use ShellExecute like this:
ShellExecute(NULL, _T("open"), "C:\\MyFolder\\MyPdf.pdf", "", "", SW_SHOW);
RicoH
Don't think you are, know you are...
custom hardware & software - olloc.be
-- modified at 10:48 Friday 12th May, 2006
|
|
|
|
|
|
i am trying to use some activex controls that came with vc++ 6, but it wont let me insert any of them into my dialog, keeps saying connot be instantiated, or i need a design time license. is there anyway around all that?
|
|
|
|
|
I'm trying to create an 8 bit DIB image with a grayscale palette
I create the image like so
char* bmpStruct = new char[ sizeof(BITMAPINFO) + (sizeof(RGBQUAD) * 256) ];
bmpInfo_ = (BITMAPINFO*)bmpStruct;
bmpInfo->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
bmpInfo->bmiHeader.biWidth = width;
bmpInfo->bmiHeader.biHeight = -height;
bmpInfo->bmiHeader.biPlanes = 1;
bmpInfo->bmiHeader.biBitCount = 8;
bmpInfo->bmiHeader.biCompression = BI_RGB;
bmpInfo->bmiHeader.biSizeImage = height * width;
I then create the rgb pal colors:
RGBQUAD* colors = &bmpInfo->bmiColors[0];
for ( int i=0;i<256;i++ ) {
colors->rgbBlue = i;
colors->rgbGreen = i;
colors->rgbRed = i;
colors->rgbReserved = 0;
colors ++;
}
A call to CreateDIBSection() then create the bitmap. This works fine. The problem arises when I try and blt the image to an HDC.
As I understand it, I need to create a palette, select it into the dest DC via a call to SelectPalette(), then call RealizePalette, and then to draw the image I call SetDIBitsToDevice(). I do all this, and the image does get drawn, however the colors it uses don't seem to reflect what I put into the palette.
I create the palette with this code:
unsigned char* tmp = new unsigned char[ sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * 255) ];
LOGPALETTE* pal = (LOGPALETTE*)tmp;
pal->palNumEntries = 256;
pal->palVersion = 0x300;
PALETTEENTRY* entry = &pal->palPalEntry[0];
for (int i=0;i<pal->palNumEntries-1;i++ ) {
entry->peRed = bmpInfo.bmiColors[i].rgbRed;
entry->peGreen = bmpInfo.bmiColors[i].rgbGreen;
entry->peBlue = bmpInfo.bmiColors[i].rgbBlue;
entry->peFlags = 0;
entry ++;
}
HPALETTE palette_ = ::CreatePalette( pal );
This should give me a palette with a smooth gradient from black to white (0 to 255).
When I alter the bits of a the image (I create an image of 256 pix wide and 100 tall) so that the bits of each line range from 0 to 255, I expect to see this smooth gradient, but instead I see a gradient from 0 to 127! Assigning a pixel the value of 255 instead displays an RGB value of 127,127,127. Something stupid is going on, but I just don't get it.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Hey, it helps to use the right parameters!!
Note to self: do NOT call SetDIBitsToDevice() using DIB_PAL_COLORS, which is kind of what I would expect to use, nope, instead use DIB_RGB_COLORS, and everything is fine! Woot!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Hi,
I'm looking for a way to convert from a unicode CString (project is in UNICODE) to a Base64 string, so I can send it via XML to a web service.
Not much luck trying to use the ATL functions... maybe someone can see what i'm doing wrong or has a sample that works ? thanks !!!
CString csTest = _T("test123");
DWORD dwLen = csTest.GetLength();
int nDestLen = Base64EncodeGetRequiredLength(dwLen);
LPSTR strEncoded = new CHAR[nDestLen];
Base64Encode((const BYTE*)csTest.AllocSysString(), csTest.GetLength(), strEncoded, &nDestLen);
//strEncoded contains: "dABlAHMAdA==ÍÍýýýýÝÝÝÝÝÝ " after conversion
LPSTR strDecoded = NULL;
int iLen = 0;
Base64Decode(strEncoded, nDestLen, NULL, &iLen);
strDecoded = new CHAR[iLen]; //iLen is 7 at this point
Base64Decode(strEncoded, nDestLen, (BYTE*)strDecoded, &iLen);
//strDecoded contains: "t" after conversion, not the original "test123"
|
|
|
|
|
Not sure what is the problem with your code but this works
CString s(_T("Hello world"));
CString sout;
int nDestLen = Base64EncodeGetRequiredLength( s.GetLength());
int outLen = s.GetLength();
LPSTR encoded = new CHAR[ nDestLen];
ZeroMemory( encoded, sizeof(CHAR) * nDestLen);
LPCSTR inPtr = s;
Base64Encode((const BYTE*)inPtr, s.GetLength(), encoded, &nDestLen);
LPSTR decoded = new CHAR[ outLen + 1];
ZeroMemory( decoded, sizeof(CHAR) * (outLen+1));
Base64Decode( encoded, nDestLen, (BYTE *)decoded, &outLen);
sout = decoded;
std::cout << (LPCTSTR)sout << std::endl;
delete [] encoded;
delete [] decoded;
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Are you compiling this in a Multibyte project ? then it works.... but if I try to compile it in a UNICODE project, I get this error:
error C2440: 'initializing' : cannot convert from 'CString' to 'LPCSTR'
on the line where you set LPCSTR inPtr = s;
since s, the CString, is LPCTSTR.
I ended up using something like this, which converts the unicode to LPSTR first, but not sure if it's the best... (also on my Decode function, I needed to convert the decoded string from MultiByte back to WCHAR to get it to match the original:
//since we're unicode, first let's convert to UTF-8
int iRes = WideCharToMultiByte(CP_UTF8, NULL, csSource, csSource.GetLength()*sizeof(TCHAR), NULL, 0, NULL, NULL);
LPSTR szMultiByte = new CHAR[iRes];
iRes = WideCharToMultiByte(CP_UTF8, NULL, csSource, csSource.GetLength()*sizeof(TCHAR), szMultiByte, iRes, NULL, NULL);
//convert to b64
int iDestLen = Base64EncodeGetRequiredLength(iRes);
LPSTR szDest = new CHAR[iDestLen];
Base64Encode((BYTE*)szMultiByte, iRes, szDest, &iDestLen, NULL);
CString csDest(szDest);
delete szMultiByte;
delete szDest;
return csDest;
|
|
|
|
|
So you have a solution now or no?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Yes, it seems ok now, thanks for the feedback.
|
|
|
|
|
|
|
Sachin .S .Potdar wrote: am looking out for a code for Encryption and Decryption of data using RC4 algorithm in VC+
try HERE[^]
Sachin .S .Potdar wrote: Student persuing Masters in Computer Application.
Where?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi all,
I have problem in msflexgrid, its scrolls don't take the theme of xp.
please answer me..
best regards
-- modified at 13:33 Thursday 11th May, 2006
|
|
|
|
|
How do I get notification that a button is being held down.
In my app I want a single click to advance to the next record and I want a click and hold to advance records slowly.
I was going to set a Timer in the LBUTTONDOWN while tracking in the rectangle of the button but the button eats the LBUTTONDOWN notification for the dialog.
How do I get a button to pass on the LButtonDown notification to its parent dialog? (I tried setting the Notify flag but it didn't change anything)
Thanks in advance.
Dave
I'm pretty sure I would not like to live in a world in which I would never be offended.
I am absolutely certain I don't want to live in a world in which you would never be offended.
Dave
|
|
|
|
|