|
Is this a joke?
That simple line statement (made easy in C#) has a little bit of code behind it. Unfortunately in C++ and MFC we have to write these bits ourselves.
I suggest you start by looking at http://www.codeproject.com/staticctrl/clabel.asp?target=CLabel[^]
It is a very good class, written by Norm Almond, that's derived from CStatic. That implements the sort of functionality I believe you want.
Ant.
|
|
|
|
|
I do a project on .NET Visual C++. I use naturely messageboxs in my project.
But When a messagebox is closed by OK buuton, The project is closed completly(An Application::Exit() methot occours). On different projects there isn't any problem about messagebox but on project which I study on there is this problem.( Even if I use direct windows API (messagebox), the error still continues)
|
|
|
|
|
posting a snippet of code of the function that is calling the message box might help.
More info is needed. Try reming out the applicaiton::exit() and see if the app closes after pressing the ok button on the message box.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi
I am new to VC++ and I need to change my mouse cursor whenever my mouse is on the boundary of the button object. The problem is that VC++ allows me to set the WM_SETCURSOR message map but this message is used to set the cursor image of the button if the button style is BS_ICON . I don't want to set the icon image of the button rather change my mouse icon whenever my mouse moves over the boundary. therefore i cannot use SetCusor function for it.
I want to handle this message in the button class only not in the view class.
Can somebody guide me how to do the same? Is it possible ?
|
|
|
|
|
You have WM_MOUSEMOVE message where you get position of cursor and you can compare the point with boundary points of the button and if you need change cursor type.
Regards,
|
|
|
|
|
What you are saying does not seem to make since. A button is just anouther window and as such the message WM_SETCURSOR is all you need to change the cursor as it passes over the button. The statment that "this message is used to set the cursor image of the button if the button style is BS_ICON" does not make since. The cursor image is independent of the window that it's over and it's up to the programmer to change it or accept the default for it.
If you are changing the button image it's because that's what you are telling your program to do. From your description, I would conclude that the reason you only see a change when the BS_ICON style is set, is that you are sending a message to the button instead of setting the cursor.
INTP
|
|
|
|
|
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,
|
|
|
|
|