|
hi everyone
does anyone know how i can round a value up
if you consider the below
a should equal 3
b = 68
a = (b / 30)
thanks
si
|
|
|
|
|
try
a = ( (b + 29) / 30 )
The general case:
int roundup(int n, int div)
{
return (n+(div-1))/div;
}
Steve S
|
|
|
|
|
Does ceil() help?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
Can anyone help me to find information about the different image file formats. Formats for image files like TIFF,GIF,BMP,JPEG and MPEG.
Kindly help..
Thanks
Vini
|
|
|
|
|
|
There is probably more than one site that provides this information. For a quick reference to code that handles these formats, I would reccomend seeing the article CxImage (@ codeproject) it should point you in the right direction. There is also a book (that is out of date call "Graphics File Formats" with CD) that may be of some help.
INTP
|
|
|
|
|
Hi,
I used in one of my projects implicit linking of DLL's from a foreign DLL file. From the DLL i had also the .h and the .lib files. I included the header file and linked the project with the .lib file.
For some reason, my application can't find a specific function in the DLL, subsequently I get a linker error message :
"RTest error LNK2019: Nicht aufgelöstes externes Symbol '"void __cdecl XaarJetPCICWriteColour1Memory(unsigned long,unsigned int,unsigned int,char *,unsigned int)" (?XaarJetPCICWriteColour1Memory@@YAXKIIPADI@Z)', verwiesen in Funktion '_main'", that actually means he can't find the function in the DLL.
In the DLL, the function was exported using __declspec(dllexport).
I thought first, it was only a problem with this function, but i could not call up any of the functions exported from the dll.
Note: I might have used explicit linking (handles ...) but i was requested to use only implicit linking.
Any ideas why can't I find the function in the DLL?
Thank you.
Oliviu Gagiu
|
|
|
|
|
was it exported by extern "C" __declspec(dllexport)?
is yes, then the export is in C name convention and the import has to be the same, so extern "C" it
Don't try it, just do it!
|
|
|
|
|
No. The programmer of the DLL used only a macro
#define DLLExport __declspec(dllexport)
DLLExport void func_name(...)
for all the exported functions.
Oliviu
|
|
|
|
|
i would like to know the code for the exit button that i created on the window to close the application. I have tried OnExit() and it works fine when it runs on the pc at home.. but when i run this program and try to press the exit button to terminate the program. it will prompt for some kind of error message tat needs mi to press either "ok" to terminate the program or press "cancel" to debug the program
To anyone that could help.. thanks
|
|
|
|
|
use PostQuitMessage(exitcode)
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
I don't know exactly you use which .NET application. I show you close a program completly on Visual C++ .NET:
You add below code in your button::onClick(..) methot (exit button);
Application::Exit();
|
|
|
|
|
Hi,
I am using Visual C++ for my application but i am not very sure of the code u say.
i have a function name:
void CProjectGrid::OnExit()
{
OnExit();
}
i tried on the above and it works fine with the pc at home.. but when i run this program in school, it prompt mi for some error. so for the coding that you showed me. Where should i place it in the function above?
Thanks for your help
|
|
|
|
|
Hi,
Thanks for the help given.. I have solved my problems.
thanks a million
dreamerzz
|
|
|
|
|
Hi all,
i want to store my window as a bitmap file and read it.(Without using MFC classes)
Can somebody help me!!!!!!!!!!!
|
|
|
|
|
do not waste your time. exist more programs to saving screen in various picture format. i use ctrl+insert buttons to store screen into clipboard and paste that into Micrsoft paint where i arrange what i want but only for making documentation with screenshots (its free tool).
regards,
|
|
|
|
|
Pls its a kind of assignment and i have to do it.So can u help me in reading a bitmapm file
|
|
|
|
|
Ok. I think that you are can use API functions. Here is my approach with small code:
HWND DeskHwnd; // desktop window
HDC hdc, hdcMem; // device
HBITMAP hBitmap; // bitmap handler
unsigned char *bits; // data bits
DeskHwnd = GetDesktopWindow(); // get windows handler
hdc = GetDC(DeskHwnd); // get dc
hdcMem = CreateCompatibleDC(hdc); // mem dc
hBitmap = CreateCompatibleBitmap(hdcMem, YOURwidth, YOURheight); // bitmap handler with your size
BITMAPINFO lstr_Info; // bitmap info
BITMAPFILEHEADER lstr_Header; // bitmap info header
// fill bitmap info header
memset(&lstr_Info, 0, sizeof(BITMAPINFO));
lstr_Info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lstr_Info.bmiHeader.biWidth = fwidth;
lstr_Info.bmiHeader.biHeight = fheight;
lstr_Info.bmiHeader.biPlanes = 1;
lstr_Info.bmiHeader.biBitCount = 24;
lstr_Info.bmiHeader.biCompression = BI_RGB;
lstr_Info.bmiHeader.biSizeImage = 0;
lstr_Info.bmiHeader.biXPelsPerMeter = 0;
lstr_Info.bmiHeader.biYPelsPerMeter = 0;
lstr_Info.bmiHeader.biClrUsed = 0;
lstr_Info.bmiHeader.biClrImportant = 0;
// use this function and check if is greater than 0
GetDIBits(hdcMem, hBitmap, YOURstartPos, YOURheight, 0, &lstr_Info, 0);
// you got information about bitmap header
if ((bits = (unsigned char *)malloc(lstr_Info.bmiHeader.biSizeImage)) == NULL)
EXIT;
// now you can read bits
GetDIBits(hdcMem, hBitmap, 0, YOURheight, (VOID *)bits, &lstr_Info, 0);
OK, you have almoust all information about the bitmap to save it on your disk. This code is only pseudo code.
Here are some usefull functions for saving this bitmap into clipboard:
OpenClipboard(DeskHwnd);
EmptyClipboard();
SetClipboardData(CF_BITMAP/*2*/, hBitmap);
CloseClipboard();
Best Regards,
|
|
|
|
|
|
Do a thurough search of MSDN, there was and still may be a sample program (dibview or some thing) that did what you are looking for (in C). If you are willing to do a bit of reverse enginering, then take a look at some of the articles at codeproject. Since MFC are just wrapers for the SDK (written in C), they can (for the most part) be reduced to C. Otherwise you need to look at how a bitmap file is layed out and go from there. One other place you can look for code is "sourceforge".
Every thing you need to know about bitmaps (.bmp) is actualy in the MSDN library.
P.S. Do not for get about the function LoadImage(), which was new when Win95 came out.
INTP
|
|
|
|
|
I am getting this assertion when i start my application
File: dbgheap.c
Expression : _CrtIsValidHeapPointer(pUserData)
Compiler causes assertion when i am deleting an array, array is being created and deleted in
right way the strange thing is that i am getting this assertion not every time i run my programme
required help in this regard
|
|
|
|
|
are you doing any allocation at the start of the program?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
My project contains a process which should save a Bitmap with 24 bit colordepth.
First we developed this program for 32 bit and then we wanted to change the program into a 24 bit version
That seems to be kind of difficult.
As far as I know there are 2 changes needed:
- the bitmaparray (array which contains the color values) is the size of the image times 3 (It was times 4 at 32 bit)
- In the bitmap header there is one bitmap depth variable
--> set to 24 bit
well, if I change these 2 things the result varies
Once the bitmap contains a totally distorted picture, another time the pixel lines are alternatingly red, green and blue (value is 255 so these colors are fully set 1111 1111)
If I draw this bitmap in MS Paint or some other program I'll get the same data as it is stored with my C++ program
My program's bitmap however can't be displayed correctly
So has anybody experienced that problem or has anybody a solution for it?
Would be nice if you reply
|
|
|
|
|
well, another crazy thing is that sometimes the picture is displayed correctly
sometimes distorted
|
|
|
|
|
When an image is distorted then the information associated with is wrong! It appears that someone wrote the code regarding bitmaps based on the requirment that they would be 32 bit. The simpilist solution I can think of is to use my class CDibData to read and store your bitmaps or one of the other classes presented at codeproject. Simply changing the depth (BitCount) will not work!
What you seem to be doing is what is call "pock and hope".
INTP
|
|
|
|