|
I've tried this way. the second parameter is meaning of hasEditBox? not the droplist type.I followed the code and founded that there is a member(m_bDropDownListMode) in the CMFCPopupMenuBar class, and its default value is FALSE.How can I use it? when we use the toolbox in VS2010, we can modify the property to droplist type directly, How can I do it by code?
|
|
|
|
|
// not the droplist type.
Why not ?.. It would be a combobox with a choice list only...
What do you desire exactly for, please ?
virtual void BeHappy() = 0;
|
|
|
|
|
In CMFCToolBarMenuButton::OnCalculateSize Funcation:
...
if (pParentMenu->IsDropDownListMode())
{
CMFCDropDownListBox* pList = DYNAMIC_DOWNCAST(CMFCDropDownListBox, pParentMenu->GetParent());
if (pList != NULL)
{
return pList->OnGetItemSize(pDC, this, size);
}
}
...
so I desire to set RibbonCombobox dowmlistmode to respand the OnGetItemSize message, to execute the overload fun (OnGetDropListItemSize) which adjust the dropdownlist's width.
|
|
|
|
|
Try it :
class CMenuBarProxy : public CMFCPopupMenuBar
{
public:
void SetDropDown(BOOL bOnOff) { m_bDropDownListMode = bOnOff; };
};
void CYourComboBox::Redraw()
{
CMFCDropDownListBox* pcList = DYNAMIC_DOWNCAST(CMFCDropDownListBox, m_pPopupMenu);
if (pcList) {
CMenuBarProxy* pcBar = (CMenuBarProxy*) pcList->GetMenuBar();
if (pcBar && !pcBar->IsDropDownListMode()) {
pcBar->SetDropDown(TRUE);
}
}
CMFCRibbonComboBox::Redraw();
}
virtual void BeHappy() = 0;
|
|
|
|
|
make it! your code works well.. thanks!
|
|
|
|
|
Hi,
I have an application built on VS2005 which uses a static library built using VS6.0.
I have noticed an issue of incorrect function getting called from a static library linked at compiled time. Note that this static library was built using Visual Studio 6.0. Whereas my application which is using the static library for linking at compile time is built using VS2005.
At run time, I see that incorrect/different functions are getting called rather than the ones which are supposed to get called.
To solve this issue:
I rebuilt the static library (.lib) using VS2005. Then this newly built static library was used for compilation along with my application on VS2005. Then the functions are getting called correctly.
I have 2 questions here:
1) This means that if there is any static library built with older version of VS6.0, then it will not work correctly with an application built with VS2005. We need to rebuild it with the same compiler as the application is built with. Is this true? why this happens in case of static libraries?
2) If above point-1 is true, then isn't it necessary to rebuild DDLs also with VS2005? If no, then why it is ok that a DLL built with older version of compiler works fine with application built with newer compiler version?
|
|
|
|
|
Many things have undergone changes from older versions of the compiler.
It is not a matter of a static library or dynamic library.
If you're using any of the components that have undergone a change it would become incompatible.
For example, in ATL there have been many changes from ATL version 3.0 to 7.0.
Many classes have been split up into many different classes.
In MFC, the CString class has been changed to a template class.
These are a few changes that can make older libraries incompatible with newer compilers.
So when ever code for the library is available it is always better to compile them with the latest compilers.
You will also be able to catch many unknown bugs this way since newer compilers do much better than older ones.
|
|
|
|
|
funwithdolphin wrote: We need to rebuild it with the same compiler as the application is built with. Is this true? why this happens in case of static libraries?
yes. static libraries are almost never compatible between different versions of MS compilers. things like STL and MFC change between versions, interfaces break, members move around, etc..
funwithdolphin wrote: If above point-1 is true, then isn't it necessary to rebuild DDLs also with VS2005?
that depends on what kinds of things your DLL uses in its exported interfaces.
|
|
|
|
|
As a really crass generalisation:
- if your library or DLL has a C interface and your programming language can use libraries or DLLs with a C interface then you can probably get away with mixing compiler versions. This is especially true for DLLs that you load manually.
- If your library or DLL are written in C++ make sure you compile your application with the same version of the compiler. Name mangling, object layout and loads of other things change from compiler version to compiler version. As well make sure you compile with as many identical compiler switches to avoid anything a bit weird sneaking in knackering your build.
So this means that I can use a VC 6 C library from a VC2010 C++ application (I had to generate a new import library from the DEF file) but there's no way I could use static libraries from even VC++2008.
Cheers,
Ash
|
|
|
|
|
Aescleal wrote: Name mangling, object layout
For DLLs, both have remained remarkably consistent since VC++ 6.0. (Had to use VC++ 6.0, VS 2005 and VS 2008 simultaneously for a while for legacy reasons.)
|
|
|
|
|
we build our imaging libraries for
VC6
VS03
VS05
VS08
VS10
debug and release for each. which would be 10 .LIBs, but...
static and dynamic CRT for each. which makes 20 .LIBs, also...
x64 for 05,08,10. which adds another 12 libs.
so 32 static libs. plus two DLLs.
for each product, each release.
|
|
|
|
|
I can't say I share your experience - as soon as you have DLLs that return something like an auto_ptr or even pass something as innocuous as std::string you find that the various runtime libraries you link with start interfering with each other.
|
|
|
|
|
With STL, yes, because it's changed without worrying about backward compatibility. I merely pointed out that name mangling and object layout has changed very little. To their credit, Microsoft made a real effort to keep name mangling the same from at least VC++ 6.0 to present day--there are some differences, but relatively few, and the object layout hasn't changed. Even the memory manager figures out how to cope with a VS 2008 application running a DLL compiled with VC++ 6.0 and running the CRT DLL.
STL, on the other hand, radically changed from VC++ 6.0 to VS 2005. If you had a third party STL that was entirely under your control, however, you'd be able to get away with it with only a few exceptions (assuming you followed the rules, such as ensuring virtual tables are in the DLL and you keep the optimize flags the same.)
And, when you get to static linking, all bets are off.
|
|
|
|
|
Hi,
In my application I have a window in which there are few buttons below the window and on clicking each of the buttons Activex controls from a list with certain conditions are shown in the same window above these buttons .This is done using painting logic.The Problem I am having here is there are prev screen left overs when I swiitch between button clicks.
This bug appears only once when I open the window and do the button clicks.If at all I Minimize and Maximize my window atleast once this bug doesn't appear and every works fine.
I face the issue only when I use DeviceindependentBitmap to Bitblt.I assume the problem is with clipregions.
Please suggest me on the same.
Below is the snippets of code
case WM_PAINT:{
RECT rc;
HDC hdcMem, hdcOld;
HBRUSH hbrBkGnd;
HFONT hfntOld;
PAINTSTRUCT ps;
DWORD dwConnectState;
if(! bViewClosing )
{
region.
if(hClipRgn == NULL)
{
hClipRgn = CreateRectRgn(0,0,0,0);
GetUpdateRgn(hWnd, hClipRgn, FALSE);
}
ws = (WIN_STRUCTPTR) GetWindowLong( hWnd, 0 );
BeginPaint(hWnd, (LPPAINTSTRUCT)&ps);
GetClientRect(hWnd, &rc);
hdcMem = CreateCompatibleDC(ps.hdc);
bool createFailed = false;
long width = rc.right-rc.left;
long height = rc.bottom-rc.top;
HWND dDeskWnd = GetDesktopWindow();
HDC hdc= GetDC(dDeskWnd);
int nBitCount = GetDeviceCaps(hdc,BITSPIXEL);
if (hbmDIBSection == NULL || dibSectionWidth < width || dibSectionHeight < height)
{
if (hbmDIBSection != NULL)
DeleteObject(hbmDIBSection);
BITMAPINFO bmi = {0};
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = width;
bmi.bmiHeader.biHeight = height;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = nBitCount;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight * 4;
LPVOID pBitmapBits = NULL;
hbmDIBSection = CreateDIBSection(NULL, &bmi, (nBitCount > 8)?
DIB_RGB_COLORS:DIB_PAL_COLORS , &pBitmapBits, NULL, 0);
if (hbmDIBSection == NULL)
createFailed = true;
dibSectionWidth = width;
dibSectionHeight = height;
}
if (createFailed == false)
{
HBITMAP hbmOld = (HBITMAP) SelectObject(hdcMem, hbmDIBSection);
ps.rcPaint.bottom);
HRGN hOldRgn = (HRGN) SelectClipRgn(hdcMem, hClipRgn);
hbrBkGnd = CreateSolidBrush(ws->wBkgColor);
FillRect(hdcMem, &rc, hbrBkGnd);
DeleteObject(hbrBkGnd);
hdcOld = ps.hdc;
ps.hdc = hdcMem;
ws->wHDC = hdcMem;
------
-------
ViewPuPaint(hWnd, &ps);
ps.hdc = hdcOld;
ws->wHDC = hdcOld;
paintstruct...
BitBlt(ps.hdc,
ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top,
hdcMem,
ps.rcPaint.left, ps.rcPaint.top,
SRCCOPY);
SelectClipRgn(hdcMem, hOldRgn);
SelectObject(hdcMem, hbmOld);
}
else
{
ViewPuPaint(hWnd, &ps);
}
DeleteDC(hdcMem);
RedrawTransparentUserControls(hWnd, hClipRgn, TRUE);
if(hClipRgn != NULL)
{
DeleteObject( hClipRgn );
hClipRgn = NULL;
}
EndPaint(hWnd, (LPPAINTSTRUCT)&ps);
}
}break;
Thanks
Satya
Today is a gift, that's why it is called the present.
|
|
|
|
|
You could try to call InvalidateRect[^] when switching control. It will invalidate the background and force a repaint if the bErase parameter is TRUE .
|
|
|
|
|
Hello all,
I have an application which access files on network share, Now the requirement is that instead of application a service should access the files on network share and the service must be running on "LOCAL SYSTEM ACCOUNT", I guess it's pretty easy when make service as NetworkService Account to access files on network, But the requirement is to make service on "LOCAL SYSTEM ACCOUNT" only.
Further research tells me that i need to setup a "null session share" if LSA needs to access network, So i did that with some help from This Page, But It always gives me access denied.
Any help will be appreciated..
Thanks..
|
|
|
|
|
The trick to allowing the LocalSystem account access to network resources like file shares is that both machines must be part of the same domain, the computer account for the machine the service is running on must be given explicit rights to the file share and the folder, and you must use a resolvable name instead of the IP address in the path.
Other Useful Information[^]
|
|
|
|
|
Hi bob,
Thanks for the reply,
Yes both the computers on same domain, How do i make sure that that machine which is running service is given explicit rights to the file share and the folder? And do you mean the computer name by resolvable name?
|
|
|
|
|
Yes the computer name is what I meant. I just wasn't sure if an alias is allowed so I worded it carefully.
In regards to setting up rights, on the machine that is sharing the resource, you would normally right click on the folder you are sharing and on the "Sharing" and "Security" property pages, you would give the "Computer" that the service will be running on appropriate rights to the resource.
Local System acts as the computer on the network.
Be advised...there are some security implications to consider here but I'm guessing you've already weighed the risks.
|
|
|
|
|
Hello bob,
Yes i gave all the rights to computer but still access denied is coming, Let me explain the scenario again, The service is running on windows XP, The file is in windows server 2003, both are on same domain, By right clicking and sharing security of shared folder i gave all the possible rights to XP machine, But whenever the service(on XP) tries to copy it gives me access denied.. Am i missing any more setting here?
Thanks
|
|
|
|
|
You might try rebooting both machines, just to make sure but I don't recall anything else being necessary.
|
|
|
|
|
hello,
i have excel from which i need to read the data.
Excel having groued columns so iam not able to read those columns.
can any one tell me how to un group excel column and save tht changed excel.
thnaks in advance.
|
|
|
|
|
What code did you try that failed?
|
|
|
|
|
private void UnGroupRowsAndColumns(Workbook workbook)
{
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells.UngroupRows(0, 9);
worksheet.Cells.UngroupColumns(0, 1);
}
|
|
|
|
|
Hi all. I have a console application, running under Windows, that asks for a folder or directory and includes those files it supports and leave the rest. The following code is part of the definition of the function that does it:
....
....
char filePath[280] = {0};
....
....
strcat(filePath, "*.mp3");
....
....
The application searches the folder for files to add. The above code works when FindFirstFile() is called. But I want a way through which other file extensions (e.g. .wav., .wma, etc) can be included so that files with these other file extensions will be returned. I did something as follows, which I only guessed as I did not know how to do it, and it did not work:
strcat(filePath, "*.mp3;*.wav;*.wma");
When FindFirstFile() is called, it returns INVALID_HANDLE_VALUE;
I need help on how to solve this problem. Thanks.
|
|
|
|
|