Click here to Skip to main content
16,009,391 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: storing data on SD card in win CE Pin
luboss18-May-05 8:28
luboss18-May-05 8:28 
GeneralRe: storing data on SD card in win CE Pin
João Paulo Figueira18-May-05 10:56
professionalJoão Paulo Figueira18-May-05 10:56 
GeneralRe: storing data on SD card in win CE Pin
luboss18-May-05 17:45
luboss18-May-05 17:45 
GeneralRe: storing data on SD card in win CE Pin
luboss18-May-05 8:56
luboss18-May-05 8:56 
GeneralCall Shell("help.exe") in .Net CF Pin
Jumba666616-May-05 10:04
Jumba666616-May-05 10:04 
GeneralPocket PC Setup problem Pin
dhirub4u13-May-05 3:21
dhirub4u13-May-05 3:21 
GeneralRe: Pocket PC Setup problem Pin
Anonymous1-Jun-05 6:40
Anonymous1-Jun-05 6:40 
GeneralSave Bitmap problem in eVC++ 4.0 Pin
chongkeng_woon11-May-05 23:56
chongkeng_woon11-May-05 23:56 
I use ATL Com AppWizard(in embedded Visual C++) to create a signature capturing DLL, i successfully let user to sign on a given rectangle square box.

However,
i have a big problem when coming to capture the signature inside the rectangle and save it to bmp (or jpg) file. i get the following attached code and trying to compile it inside embedded Visual C++ 4.0, and it comes out this error:

"GetDIBits: undeclared identifier" ...

it seems like eVC++(or Pocket PC 2003 SDK) doesn't have this library or doesn't support this function...

is there anyway i can do it ? this problem has been struggling me for few days ...

thanks


int WindowToBmpFile(LPCTSTR szFName, HWND hWnd)
{

HDC hDC, hMemDC;
HANDLE hBits, hFile;
HBITMAP hBitmap, hTmpBmp;
RGBQUAD RGBQuad;
DWORD ImgSize, plSize, dwWritten;
int i, CRes, Height, Width;
BITMAPFILEHEADER bmFH = {0x4d42, 0, 0,0};
LPBITMAPINFO pBmInfo, pBmInfoMem;

if((hFile = CreateFile(szFName, GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)) == NULL) return 1;

SetCursor(LoadCursor(NULL, IDC_WAIT));

if(hWnd==HWND_DESKTOP)
{
Width = GetSystemMetrics(SM_CXSCREEN);
Height = GetSystemMetrics(SM_CYSCREEN);
}
else
{
RECT rc;
::GetClientRect(hWnd,&rc);
Width = rc.right-rc.left;
Height = rc.bottom-rc.top;
}

hDC = ::GetDC(hWnd);
hMemDC = CreateCompatibleDC(hDC);
hBitmap= CreateCompatibleBitmap(hDC, Width, Height);
pBmInfoMem = (LPBITMAPINFO)GlobalAlloc(GHND, sizeof(BITMAPINFO)+256*sizeof(RGBQUAD));
pBmInfo = (LPBITMAPINFO)GlobalLock(pBmInfoMem);
ZeroMemory(pBmInfo, sizeof(BITMAPINFO)+256*sizeof(RGBQUAD));
SelectObject(hMemDC, hBitmap);
BitBlt(hMemDC,0,0,Width,Height,hDC,0,0,SRCCOPY);

pBmInfo->bmiHeader.biSize = (DWORD)sizeof(BITMAPINFOHEADER);
pBmInfo->bmiHeader.biWidth = Width;
pBmInfo->bmiHeader.biHeight = Height;
pBmInfo->bmiHeader.biPlanes = 1;
pBmInfo->bmiHeader.biBitCount = (WORD)GetDeviceCaps(hDC, BITSPIXEL);
pBmInfo->bmiHeader.biCompression = BI_RGB;
pBmInfo->bmiHeader.biClrUsed = 256;
GetDIBits(hDC, hBitmap, 0,Height, NULL, pBmInfo, DIB_RGB_COLORS);
if(!pBmInfo->bmiHeader.biSizeImage)
pBmInfo->bmiHeader.biSizeImage = ((((pBmInfo->bmiHeader.biWidth * pBmInfo->bmiHeader.biBitCount) + 31) & ~31) /
* pBmInfo->bmiHeader.biHeight;
CRes = GetDeviceCaps(hDC, SIZEPALETTE);
plSize = CRes*sizeof(RGBQUAD);
ImgSize= pBmInfo->bmiHeader.biSizeImage;

bmFH.bfOffBits = plSize + sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER);
bmFH.bfSize = ImgSize + bmFH.bfOffBits;

WriteFile(hFile, &bmFH, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
WriteFile(hFile, &(pBmInfo->bmiHeader), sizeof(BITMAPINFOHEADER), &dwWritten, NULL);

hBits = GlobalAlloc(GHND, pBmInfo->bmiHeader.biSizeImage);
LPVOID lpBits = (LPVOID)GlobalLock(hBits);
ZeroMemory(lpBits, pBmInfo->bmiHeader.biSizeImage);
GetDIBits(hDC, hBitmap, 0,Height, lpBits, pBmInfo, DIB_RGB_COLORS);

WriteFile(hFile,lpBits,ImgSize,&dwWritten,NULL);
GlobalUnlock(lpBits);

GlobalUnlock(hBits);
GlobalFree(hBits);

GlobalUnlock(pBmInfo);
GlobalFree(pBmInfoMem);
DeleteObject(hBitmap);
DeleteDC(hMemDC);
::ReleaseDC(hWnd,hDC);
CloseHandle(hFile);
SetCursor(LoadCursor(NULL,IDC_ARROW));

return 0;
}
GeneralRe: Save Bitmap problem in eVC++ 4.0 Pin
GDavy12-May-05 1:15
GDavy12-May-05 1:15 
GeneralRe: Save Bitmap problem in eVC++ 4.0 Pin
chongkeng_woon13-May-05 19:28
chongkeng_woon13-May-05 19:28 
GeneralDevelop mpeg video palyer for Pocket PC (with Media Player SDK?) Pin
michaelwinter9-May-05 12:50
michaelwinter9-May-05 12:50 
GeneralSend Object through network Pin
aRtsZ9-May-05 4:59
aRtsZ9-May-05 4:59 
GeneralIcon on TaskBar not in Tray Pin
9-May-05 2:04
suss9-May-05 2:04 
GeneralHelp me- Emulator not running Pin
hithesh8-May-05 7:46
hithesh8-May-05 7:46 
GeneralRe: Help me- Emulator not running Pin
eli150219799-May-05 0:44
eli150219799-May-05 0:44 
GeneralRe: Help me- Emulator not running Pin
hithesh9-May-05 6:49
hithesh9-May-05 6:49 
GeneralDownloading to device Pin
hithesh7-May-05 11:41
hithesh7-May-05 11:41 
Generalserver app in ppc 2002 emulator Pin
Anonymous7-May-05 4:46
Anonymous7-May-05 4:46 
Generalisolated storage Pin
balkang6-May-05 9:34
balkang6-May-05 9:34 
GeneralRe: isolated storage Pin
Dan_P6-May-05 13:43
Dan_P6-May-05 13:43 
GeneralDisplaying MessageBox makes my form disappear Pin
clenci6-May-05 2:04
clenci6-May-05 2:04 
GeneralRe: Displaying MessageBox makes my form disappear Pin
clenci9-May-05 3:14
clenci9-May-05 3:14 
Questionhow do i call a printer? Pin
gundamhamtaro6-May-05 1:08
gundamhamtaro6-May-05 1:08 
GeneralFast pixel drawing on VB.net CF or C# Pin
CarlosMMartins5-May-05 5:27
CarlosMMartins5-May-05 5:27 
GeneralLocation information Pin
dboytime3-May-05 23:52
dboytime3-May-05 23:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.