|
First look for some overload of Find method that takes some argument to tell him that this find is case sensitive.
|
|
|
|
|
How to select correct width to lock from 24bpp bitmap of random width, that the locked bitmpa data has the stride equal to 3 * locked bitmap data width?
bitmapData.stride == bitmapData.width * 3
Чесноков
|
|
|
|
|
Depends how your bitmap is stored.
If you have this structure:
BITMAPINFOHEADER bmHeader it has a member
LONG width = bmHeader.biWidth
|
|
|
|
|
I need to do it using GDI+
How do we need to decrease bitmap width, that after it was locked to read its RGB triplets, the stride in that array will be equal to (3 * width)
e.g. 640x480 24bpp bitmap has stride 1920 = 3 * 640
but some 257x150 24bpp has stride not equal to 3 * 257
What is the formula to decrease 257 to fit into 3 * width = stride?
Чесноков
|
|
|
|
|
I believe the memory holding the pixel data is DWORD aligned. So wouldnt you just do:
#define ALIGN(val)((val + 3) & ~3)
DWORD iSize = (sizeof(RGBTRIPLE) * bitmapData.width);
iSize = ALIGN(iSize);
Am I right?
Best Wishes,
-David Delaune
|
|
|
|
|
say we have width = 257;
what is the width should be to (width * 3) % 4 = 0
Чесноков
|
|
|
|
|
(((257 * sizeof(RGBTRIPLE)) + 3) & ~3) == 772;
Best Wishes,
-David Delaune
|
|
|
|
|
I do not need to estimate stride of bitmap given the width I need to estimate width of the bitmap for a stride. In the equation 257 is the x variable needed to be found:
(((x * sizeof(RGBTRIPLE))) + 3) & ~3) = 772
we have width = 257
257 * 3 = 771, 771 / sizeof(DWORD) = 192.75
hence we need to decrease 257 the way the stride / 4 = integer
252 * 3 = 756, 756 / sizeof(DWORD) = 189
How can we found that width = 252 from original 257?
Чесноков
|
|
|
|
|
I am not understanding the numbers you are showing me. For example:
Chesnokov Yuriy wrote: 257 * 3 = 771, 771 / sizeof(DWORD) = 192.75
Why are you dividing 771 by sizeof(DWORD)? This does not make any sense to me. Each pixel is represented by 3 bytes or sizeof(RGBTRIPLE). The padding will be at the end of the memory allocated. Like this:
xxxxxxxxxxxxxxxxPADDING
You should be able to calculate the original bitmap width by checking that stride modulo RGBTRIPLE is equal to zero. For finding the best width where width is equal to stride you can multiply width by RGBTRIPLE and check that it is equal to the alignment. Something like this:
#define ALIGN(val)((val + 3) & ~3)
#define ISSTRIDEALIGNED(val)((val * sizeof(RGBTRIPLE)) == ALIGN(val * sizeof(RGBTRIPLE)))
DWORD OriginalWidth24(DWORD dwInStride)
{
if(0 != dwInStride % sizeof(RGBTRIPLE))
{
--dwInStride;
}
return dwInStride / sizeof(RGBTRIPLE);
}
DWORD BestWidthEqualStride(DWORD dwWidth)
{
while(dwWidth && (sizeof(RGBTRIPLE) * dwWidth) != ALIGN(dwWidth * sizeof(RGBTRIPLE)))
{
--dwWidth;
}
return dwWidth;
}
And you can check their values:
DWORD dwBitmapWidth = 257;
DWORD dwNonAlignedSize = (dwBitmapWidth * sizeof(RGBTRIPLE));
DWORD dwAlignedSize = ALIGN(dwBitmapWidth * sizeof(RGBTRIPLE));
DWORD dwOriginalWidth = OriginalWidth24(dwAlignedSize);
DWORD dwWidthEqualsStride = BestWidthEqualStride(dwBitmapWidth);
Best Wishes,
-David Delaune
|
|
|
|
|
Hi techies,
I have a problem and i really dont know how this happens.
I have a property page window with say 4 property pages.(sheet1,sheet2,sheet3sheet4) and obviously they all have common "Ok" "Apply" and "Cancel" button. Each of the sheets have their own classes say Csheet1,Csheet2,Csheet3,Csheet4 with each of them having their own function definations for "Ok" "Apply" and "Cancel" (like Csheet1:: onOK(), Csheet2:: onOK(), Csheet4:: onOK(),, etc).
But if im in sheet4 and press Ok or Apply why the hell it goes to Csheet1:: onOK() and then to Csheet4:: onOK(),, though im averse to this action. please help me...!!
i just want the functions of class correponding to the sheets to be invoked.
say if im in sheet1 and press "ok" or "Apply" then Csheet1:: onOK() or Csheet1:: onApply() resp. should be opened..!!1
please get a solution.
|
|
|
|
|
Does the problem only happen on the sheet4 when you click the 'ok' button and it jumps to the Csheet1::onOK() function?
aravind.sn wrote: ... and obviously they all have common "Ok" "Apply" and "Cancel" button.
Also from the above, are you saying that they all share the same buttons ? if that is so then that is the problem !
|
|
|
|
|
Yes any page you go and click ok, it will first go to the Csheet1::onOK() and then to their class defined Csheetx::onOK() funtion.
"Also from the above, are you saying that they all share the same buttons ? if that is so then that is the problem !"
RE: Generally its the property of the property page which looks like sharing the same "OK" "Apply" and "Cancel" button,, for example,, open your Internet option (in internet explorer) the bottom 3 buttons look like common.
|
|
|
|
|
hi
Where does the ACL of any file or directory is stored ?
say if we created an acl for a file in windows operating system
and moved that file to another operating system like mac
does that previously created ACL still holds to that file ??
Thanks
Anil Veeraghattapu
|
|
|
|
|
|
I have a MFC SDI project(use multiple byte) created in VC++ 2003. Now I convert it to VC+2008.
I add the SetTitle("aaa.bbb") in OpenFile function, but the title does not change.
I create a new MFC SDI project and SetTitle("aaa.bbb") in openFile function, and then the title change to be "aaa.bbb".
|
|
|
|
|
Are you using a 'multibytechar' set or 'unicode' in the converted code.This problem mainly arises due to the inappropiate settings.In Visual Studio go to project->properties->Configuration properties->General-> Character Set and set the value accordingly.
Kushagra,
I hate coding but I love to develop
|
|
|
|
|
Hello all,
i am using ReadFile function to Read a Sector from different type of storage devices like Pen Drive, Hard Disk, Memory Card iPod.
with all devices excluding iPod it is working fine means it return 1.
when i am trying to Read iPod it fails means it return 0;
i am using apples 120 GB iPOD, and when i try to get error Code by using
DWORD dw = GetLastError();
it is 87
/////used by window9x
long drive_num;
int sector, disk_read;
int drive_no;
char drv,szflp_drv[20];
strcpy(szflp_drv , "\\\\.\\a:");
char phydisk[20];
strcpy(phydisk,p);// p is a string like "\\\\.\\PhysicalDrive0",+"Drive No"
//Ex. if Drive No.3 then "\\\\.\\PhysicalDrive3",
drv = p[17];
/////used by windowsnt
HANDLE hCD;
DWORD dwNotUsed;
drive_no = atoi(&drv);
///////////////////////////////////
//////Check which os is installed
hCD = CreateFile (phydisk, GENERIC_READ ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hCD != INVALID_HANDLE_VALUE)
{
DWORD dwSize = total_sector * 512;
__int64 y=512*start_sector;
__int64 ss= myFileSeek(hCD,y,FILE_BEGIN);
int aa;
aa = ReadFile (hCD, buffer, dwSize, &dwNotUsed, NULL);
DWORD dw = GetLastError();
}
|
|
|
|
|
Shiv Murti Pal wrote: DWORD dw = GetLastError();
it is 87
First clue:
87 = ERROR_INVALID_PARAMETER
|
|
|
|
|
where is error plese suggest me
|
|
|
|
|
It means that one of the parameters (probably for ReadFile) is invalid. Use the debugger and check the values.
|
|
|
|
|
Before executing the value of ReadFile Parameters are
int aa;
aa = ReadFile (hCD, buffer, dwSize, &dwNotUsed, NULL);
hCD = 0x00000798
buffer = 0x0012f1bc
dwSize = 512
dwNotUsed = 3435973836
NULL
After executing the value of ReadFile Parameters are
dwNotUsed = 0
All other are Same
Note:- in case of all other devices where the ReadFile return success (1)
dwNotUsed = 512
Now Sir suggest me what i should do
|
|
|
|
|
Have you seen the Return Value section of MSDN?
If the function succeeds, the return value is nonzero.
If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.
If the return value is nonzero and the number of bytes read is 0 (zero),
the file pointer is beyond the current end of the file at the time of
the read operation. However, if the file is opened with FILE_FLAG_OVERLAPPED
and lpOverlapped is not NULL, the return value is 0 (zero) and GetLastError
returns ERROR_HANDLE_EOF when the file pointer goes beyond the current end
of file.
What is the value of aa when the function returns? Try calling GetLastError() to get more information.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
the value of aa is 0 i have already explained
|
|
|
|
|
hello sir/Madam (Michael Schubert)
Sir please guide me sir, i think u ware only one step away from solution, in your last responce please help sir
|
|
|
|
|
Hi,
How to generate Keyboard events.
I want to generate Alt+Tab Event in middle of my application.
How to generate Alt+Tab event in a dialog based application.
Thanks in advance.
With best wishes.
|
|
|
|