|
There is related [^] article, targetd to VS 2003. But should usefull to you.
|
|
|
|
|
Can somebody tell me how to create a border for dialog which is rounded rectangle.
plz provide an example.
|
|
|
|
|
A dialog already has a border, but if you are setting the window region to be a rounded rectangle, the border will not be correctly displayed. The best way to draw a border would be to create two rounded rectangles, one a little smaller than the other. From this you will be able to create a region, which you can give a color by calling FillRegion() .
|
|
|
|
|
Is there any better way. As i have more than 100 dialogs and for each dialog drawing two rect's and filling region may not be better solution.
if the dialog is rectangle i m doing as,
CRect rectWindow;
//CDC *pDC;
CPen BlackPen(PS_SOLID, 1, RGB(0, 0, 255)), *pPrevPen;
pDC = GetWindowDC();
GetWindowRect(rectWindow);
INT iLeft = 0,
iTop = 0,
iRight = rectWindow.Width() - 1,
iBottom = rectWindow.Height() - 1;
pPrevPen = pDC->SelectObject(&BlackPen);
pDC->MoveTo(iLeft, iTop);
pDC->LineTo(iLeft, iBottom);
pDC->LineTo(iRight, iBottom);
pDC->LineTo(iRight, iTop);
pDC->LineTo(iLeft, iTop);
pDC->SelectObject(pPrevPen);
ReleaseDC(pDC);
in OnCtlColor and it works well but for rounded rectangle...
-- modified at 13:35 Tuesday 5th December, 2006
|
|
|
|
|
Raj Gopal wrote: As i have more than 100 dialogs and for each dialog drawing two rect's and filling region may not be better solution.
You could make a CRoundedRectDialog class derived from CDialog. Do all your specialized
drawing there in that one class and derive your 100+ dialogs from this new dialog class.
Also, OnCtlColor gives you a chance to change the color of CONTROLS before they are drawn.
You may want to do your dialog drawing in WM_PAINT/WM_ERASEBKGND/WM_NCPAINT handlers instead.
Doing it in OnCtlColor the performance will be bad since it's called before EVERY control is drawn,
every time
|
|
|
|
|
you are right mark that is good idea.
i have one doubt.. why dont i find all the messages like WM_DRAW, WM_ERASEBKGROUND.... in the class wizard. how do i get all the message?
can you provide me some sample that changes all the controls color including dialog, so that it looks good.
|
|
|
|
|
Raj Gopal wrote: why dont i find all the messages like WM_DRAW, WM_ERASEBKGROUND.... in the class wizard. how do i get all the message?
What version of Visual Studio? In 2003 they are in the class properties under messages.
You can always add handlers the old-fashion way too (in the code editor).
Raj Gopal wrote: can you provide me some sample that changes all the controls color including dialog, so that it looks good.
What kind of look are you going for? Color changes are fairly simple except for muli-part
controls like combo boxes, trackbars, etc. Custom shaped controls will take more work since
you'll have to draw them yourself.
For the background of dialogs you can go with simple color change or use a bitmap.
|
|
|
|
|
Hey LaHaHa! Hopefully you'll see this here. I think we broke the message board on that
long ongoing joystick thread I can't respond to you there without error anymore.
I'll continue here and hopefully you'll see this.
LaHaHa wrote: I think my problem is the initialization.
My program need to periodically do the initialization of joystick.
What makes you think this? I believe what you need to do is periodically check the status
of the joystick buttons, right? Initialization only needs to happen once.
|
|
|
|
|
Mark Salsbery wrote: What makes you think this?
fish filet?
led mike
|
|
|
|
|
Yes!!!
Apparently 512 nested message levels is all this forum software could take
*edit* spelling
|
|
|
|
|
Thank you for your help!
I think my problem is the initialization.
My program need to periodically do the initialization of joystick. Could you give me more suggestions?
Please help!
|
|
|
|
|
I'm still not sure why you think you need to initialize repeatedly.
You should (after initialization) be either periodically polling for joystick actions or
waiting for an event from the joystick.
|
|
|
|
|
If I plug the joystick after the initialization, the program cannot detect the joystick. So how can I initial the joystick without periodically do it?
Please help!
|
|
|
|
|
You'll need to make sure your initializations fail if no joystick is attached.
If it fails then maybe prompt the user to attach the device.
Is that why you had it on the timer? The timer method should work - you could set a timer to
attempt to acquire the joystick every few seconds.
I'll put together a code sample today.
Mark
|
|
|
|
|
Thank you for your help!
I am looking for your code sample.
|
|
|
|
|
I have an MFC ActiveX control project that has been continually growing over the past three years. Within the last year or so, I noticed that the linker would just hang every so often, perhaps no more than once or twice a week. Lately, it's been hanging almost every other build (debug build). I've searched the internet with no success yet.
My hope is that someone has experienced this and perhaps discovered the cause. Any troubleshooting tips or ideas on the matter are greatly appreciated. Although, upgrading to Visual Studio .NET 200x is not currently an option.
Kevin Fournier
SRP Computer Solutions, Inc.
|
|
|
|
|
In case anyone is interested, I think I may have found the problem to this. I have an Office 2007 release candidate installed, which included the Windows Search service (searchindexer.exe). This process is always running and is usually 60-100 Megs in size. Well, I don't need to search my drive or emails that often, so I killed it. The linker hasn't hung on me since.
Kevin Fournier
SRP Computer Solutions, Inc.
|
|
|
|
|
Hi,
I have created a function and a class in a DLL.
I want to write a .DEF file instead using __declspec(dllexport) and __declspec(dllimport).
I wrote the .DEF file like this..
LIBRARY "Sample.dll" //dll name is Sample.dll
EXPORTS
Multiply @1 //it is the function name
CRectArea @2 //it is the class name and this class contains a
//method called subtract
Please say how to export that function.
and I wrote a client program which uses that dll dynamically.
//written globally in the implementation file of client
typedef int (CALLBACK* LPFNMLTPLY)(int,int);
//** I don't know how to declare that function from the class CRectArea
HINSTANCE hClcltr=LoadLibrary("DefExported.dll");
LPFNMLTPLY lpfnMuliply;
lpfnMuliply = (LPFNMLTPLY)GetProcAddress(hClcltr,"Multiply");
m_Rslt=lpfnMuliply(m_PartOne,m_PartTwo); //m_Rslt will be displayed
//in the message box.
FreeLibrary( hClcltr );
//now I want to use the function from class
Please can anybody help me.
Thanks inadvance.
|
|
|
|
|
The only way to import a class from a dll is by implicit linking (so, without using LoadLibrary and GetProcAddress but using the lib file supplied with the DLL).
|
|
|
|
|
To export/import a class I believe you have to use __declspec(dllexport) and __declspec(dllimport).
Mark
|
|
|
|
|
VC wizard can help you to create a dll class in a second - that is a perfect sample.
|
|
|
|
|
Did you see examples of dll on codeproject for export class
|
|
|
|
|
Yes Mr.whitesky I practiced the samples and while practicing I got the about.
Anyhow thank you very much all of YOU.
|
|
|
|
|
I glad you find it
|
|
|
|
|
Hi,
I am trying to close a dialog box that I created using CreateDialog(). The dialog appears and all the buttons work well, however, if I attempt to close the dialog using the "x" box on the system menu, nothing happens. I understand that usually the "x" box sends either the IDCANCEL or the WM_CLOSE message when depressed, but that doesnt' seem to be happening. Any ideas?
Thank you,
Joe
|
|
|
|