|
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.
|
|
|
|
|
There is no immediate support for what you want. The FindFirstFile API takes a single API, much like Windows Explorer lets you search for one thing at a time. The filter may contain wildcards, but does not support alternatives.
The obvious solution to such limitation is to have a loop, that iterates over your alternatives; so it would search all *.wav, then all *.wma, then... However it is up to you to add such loop.
There is one alternative that may or may not suit your app: you could relax the filter so all required files match, possibly yielding false positives, which you then have to skip by adding some tests. That could boil down to searching for *.*, then checking the extension is one of some. The disadvantage is you get a lot of matches; the advantage is the filesystem is searched only once.
|
|
|
|
|
I have used *.* but when I call FindFirstFile() for the first time, it returns the character '.', when it is called the second time, it returns '..', then subsequent calls return the files in the directory. Is there a way to prevent what the function returns for the first two calls? Then I will use a loop to check the file extensions.
|
|
|
|
|
AFAIK . and .. represent the current folder and the parent folder; if you get them (even when they don't really match your filter), AFAIK there is nothing you can do except test for them afterwards. The behavior of FindFirstFile may depend on your operating system and your file system. I tend to code defensively, and not to rely on observed behavior.
|
|
|
|
|
In a way to get rid of the '.' and "..", I have added the following code:
while (findData.cFileName[0] == '.' || findData.cFileName == "..")
{
FindNextFile(handle, &findData);
}
Although it's working, I don't know if it is efficient to do it like this. The loop is executed after FindFirstFile() has been called and its return value checked not to be INVALID_HANDLE_VALUE. When the loop breaks, the &findData has its member cFileName pointing to one of the files in the directory.
|
|
|
|
|
That sounds OK. You could create your own MyFindFirst() function that contains the original FindFirst call and your skip-loop, hiding all of it from the user.
|
|
|
|
|
Thanks very much for your guidance. I really appreciate your contributions.
|
|
|
|
|
You could also just check the attributes of the returned item in your findData structure and ignore entries with FILE_ATTRIBUTE_DIRECTORY set.
Also
while (findData.cFileName[0] == '.' || findData.cFileName == "..")
The second test will never pass, you cannot do a string compare in this way.
It's time for a new signature.
|
|
|
|
|
It is also redundant since the first test catches that condition also.
|
|
|
|
|
And catches any file or directory whose name starts with '.'.
It's time for a new signature.
|
|
|
|
|
What you have so far looks good enough.
There is an API called SHFileOperation that can take multiple wild cards.
But you cannot use this to find files.
You have to either copy or move or rename or delete the files.
I'm not sure what exactly your application does but if you can copy the files to a another folder or temp folder, this API may be helpful.
|
|
|
|
|
How to move windows titlebar (included buttons: Close & Minimize & Hide) to the left side ?
What I want to do is to move buttons to the DockablePane left side. I've created a derived class of CDockablePane.
Thanks,
|
|
|
|
|
One way could be to handle WM_NCPAINT[^] and WM_NCHITTEST[^] and draw and handle hit testing yourself (possibly using the themed drawing methods like DrawThemeEdge[^] and such for the drawing).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|