|
MFC doesnt allow you to change button's default background color. You will have to use owner drawn button and its methods to change the background
|
|
|
|
|
Subclass CButton and override DrawItem() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks for all the help.
Now I have used the owner-drawn button and able to change the color of the focused button (using WM_SETFOCUS, WM_KILLFOCUS and DrawItem).
But facing another problem:
WM_SETFOCUS is called, only if the button is clicked. Not if focus is changed using tab key or arrow key.
Can you tell me, which message should I handle for this?
regards,
Ashok
|
|
|
|
|
In my application i am using MS access database to enter records. Now, the records are not getting entered sequentially. i have a date field. so i expect that the record corresponding to today's date should be at the end of the database. they get added nywhere in between. y does this happen. how do i change it? I want sequential entry into the database and not random entry. please suggest
|
|
|
|
|
Anonymous wrote:
i have a date field. so i expect that the record corresponding to today's date should be at the end of the database.
Why?, there is no law telling in which order a DBMS should return rows of a selection if there is no 'ORDER BY' clause. And there is certainly no single way for a DBMS to store its data.
The only way you can be sure to get your data back in chronological order, and this seems to be sequential for you, is to insert an 'ORDER BY' clause on your date field in your SQL statement.
Anonymous wrote:
they get added nywhere in between. y does this happen. how do i change it?
Are you sure, have you actually decoded the .mdb file or are you assuming it because of the order on rows returned from a selection without 'ORDER BY'?
A stated above, there is no way to specifically tell a DBMS how to store its data, and when you don't specify an 'ORDER BY', you will get data in the order they are retrieved which is typically by primary key or another index. This does not tell anything about the storage of the data itself.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
|
|
i want to get a ftp client written in "socket api" for c or c++ ,not mfc CSocket and not wininet.
|
|
|
|
|
http://www.freebsd.org/
http://www.openbsd.org/
http://www.netbsd.org/
All include a free ftp client writen in C, and all include source code. Check them all out. They all started from the same code at one time, so where you see differences see if you can figure out why. (Openbsd in particular tends to make changes to prevent problems that can't happen)
www.kde.org has a ftp client in C++, but it is perhaps too complex. (it intigrates into the rest of KDE nicely, but it is written to their ioslave spec so it may not be easy to under stand) GPL, which might be a problem for you.
I'm sure there are others. Have you searched sourceforge.net? Writing an ftp client used to be a common activity for students.
|
|
|
|
|
hi,
i need to insert bitmap into a button control.plz help me.
Thankyou.
|
|
|
|
|
If you are using MFC, use the MFC class CBitmapButton class
|
|
|
|
|
See if this article helps.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I am working on a project for adding new entries to the Outlook Express( not Microsoft Outlook ) contacts. I came across a sample in CodeProject that does that but I want to do it without displaying any dialog box. Any sample code or tutorial on this will be very useful.
Thanks in advance
|
|
|
|
|
1. Why is name mangling required ? (just to support overloaded functions only ? In that case will only overloaded function names are mangled ?)
2. If i use " __declspec( dllexport )", then do i still need .DEF file ?
3. If i have a dll with .DEF file, then should i distribute it with my dll so that client can use my dll?
|
|
|
|
|
1. I don't know
2. Simple answer: use both. Writing the DEF file is a simple task, and using both ensures that using GetProcAddress works at all times. As I recall, there are some problems related to using either the first or the latter, but these problems were remedied by using both at the same time. It was related to the exported symbol ordinals in some way..
3. No. It is enough to give a documentation that describes the exported functions/symbols/classes of your DLL. This can be a plain text file.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks and appreciation for your honest reply.
|
|
|
|
|
xcavin wrote:
1. Why is name mangling required ? (just to support overloaded functions only ? In that case will only overloaded function names are mangled ?)
By mangling, or decorating, the exported functions, C linkers can support class/namespace scope and function overloading, by turning what would be invalid redefinition of the same name into a new definition of a unique name. The C++ language allows function overloading where functions with the same name are only distinguished from one another by the data types of the arguments to the functions. Name decoration enables the linker to distinguish between different versions of overloaded functions because the names of the functions are decorated differently.
xcavin wrote:
2. If i use " __declspec( dllexport )", then do i still need .DEF file ?
With the proper .DEF file EXPORTS section, __declspec(dllexport) is not required. __declspec(dllexport) was added to provide an easy way to export functions from an .EXE or .DLL without using a .DEF file.
Per MSDN:
There are three methods for exporting a definition, listed in recommended order of use:
The __declspec(dllexport) keyword in the source code
An EXPORTS statement in a .DEF file
An /EXPORT specification in a LINK command
All three methods can be used in the same program.
xcavin wrote:
3. If i have a dll with .DEF file, then should i distribute it with my dll so that client can use my dll?
No, it is not required. The .DEF file is used solely by the linker.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i see it wrapped around strings all the time.
yet i cant determine what exactly it suposed to do.
|
|
|
|
|
It's a C macro that expands to: L"Some String" in a unicode build and "Some String" in a non-unicode build.
|
|
|
|
|
|
I drawed two rectangles in gdi and gdi+ respectively ,which I usded the same Points.However,rectangles showed on the screen were not in the same place.what cause that??
The codes I used were as followed:
(How to initialize the gdi+ in vc++6.0,please reference the articles "Macro to initialize GDI+ in VC6.0 MFC projects [^]"By PJ Arends )
=================================
CxxView::OnInitialUpdate()
{
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = 500000000;
//the mapping mode is MM_HIMETRIC
SetScrollSizes(MM_HIMETRIC, sizeTotal);
}
CxxView::OnDraw(CDC* pDC)
{
int nRadius = 1000;
CPoint ptCenter = CPoint(200000,0);
CxxDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//Set the map mode of MM_HIMETRIC
pDC->SetMapMode(MM_HIMETRIC);
//Set the original of window ,so we can see the graphics on the screen
pDC->SetWindowOrg(CPoint(ptCenter.x-2*nRadius,ptCenter.y+2*nRadius));
Graphics graphics(pDC->m_hDC);
// Create a Pen object.
Pen pen(Color(255,0 , 255, 0));
Rect rectgdiplus = Rect(ptCenter.x-nRadius,ptCenter.y-nRadius,2*nRadius,2*nRadius);
//draw rectangle using gdi+
graphics.DrawRectangle(&pen,rectgdiplus);
CRect rect(ptCenter.x-nRadius,ptCenter.y-nRadius
,ptCenter.x+nRadius,ptCenter.y+nRadius);
CPen penNew,*ppenOld;
penNew.CreatePen(PS_SOLID,1,RGB(255,0,0));
pDC->SelectStockObject(NULL_BRUSH);
ppenOld=pDC->SelectObject(&penNew);
//draw another rectangle using gdi
pDC->Rectangle(&rect);
pDC->SelectObject(ppenOld);
TRACE("%d,%d,%d,%d\n",rectgdiplus.GetTop(),rectgdiplus.GetLeft(),rectgdiplus.GetBottom(),rectgdiplus.GetRight());
TRACE("%d,%d,%d,%d\n",rect.top,rect.left,rect.bottom,rect.right);
}
Thanks.
|
|
|
|
|
Hello,
Does anyone know if it is possible for my application to monitor port 110 traffic? That is, is it possible to know when a resident mail client has sent a request to 110? I don't want a proxy but I need my program to take some actions if a user has requested a mail download.
It would be nice to know if messages are in fact coming in from such a request, but this is not absolutely necessary.
Thanks,
Murrah Boswell
|
|
|
|
|
In my MFC application (VC6 C++) I maintain multiple
view's. I have a split view and multiple
tabbed views (only one tab view visable at a time)
Two separate view classes derived from CScrollView
in a single document interface.
I have implimented scrolling that works very well in
both view classes. When I switch the focus from one
veiw to the other, the scroll bars snap to zero in the
view that has lost focus.
I have implimented a post problem workaround that repositions
the scroll slider. But the scroll bars flash as they
display the zero setting, then are repositioned back to the
users setting.
Hopefully someone will give me an idea where to look to
stop the zeroing of the scroll bars. (A pre rather
than post solution.)
WedgeSoft
|
|
|
|
|
One way to try to track this problem is to have one, and only one, function calling SetScrollPos in each view. Add some dummy code checking for a zero value, something like
...SetScrollbarPositions...
{
if( newpos == 0 )
{
int a = 0;
}
Run your application. Scroll one of the views. Switch to the debugger. Set a breakpoint at int a = 0 . Switch to the app. Do the stuff that resets the scrollbar. Check the callstack in the debugger to see where it was called from. Problem most likely solved
The slightly clumsy addition of extra code is to avoid (perhaps) a billion legal breaks before the problematic action.
|
|
|
|
|
I have a problem on how to link a CDialog with CLsitView in SDI application in mfc appwizard[exe] because I cannot use a DoModal function to link those pages.
|
|
|
|