|
may be solve your problem
CString sortfile="Add Path";
TCHAR szPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_SYSTEM|CSIDL_FLAG_CREATE,
NULL,
0,
szPath)))
{
PathAppend(szPath, sortfile);
}
TCHAR szPathDesk[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_DESKTOP|CSIDL_FLAG_CREATE,
NULL,
0,
szPathDesk)))
{
PathAppend(szPathDesk, sortfile);
}
|
|
|
|
|
You should make sure if they work on win98 before you post your lovely code.
|
|
|
|
|
It's not up to him to test his suggestion on every version of the OS you might be interested in using. That's your job.
You might have told him thanks instead of being a wiseass. I doubt many more will be lining up to help.
|
|
|
|
|
first you test then give response.
|
|
|
|
|
I've looked at the docs for SHGetSpecialFolderPath (just google "msdn SHGetSpecialFolderPath").
I found this near the bottom:
With Microsoft Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll.
So, if you're right, then maybe you could use that redistributable file.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi,
I'm wading trough code dealing with UNC Names and Mapped Drives. It suddenly occurred to me that a DriveSpec of say 'C:\' limits the number of drives to 26. It also occurred to me that Microsoft may not have set anarbitrary maximum of 26 Drives (included Mapped Drives).
What is the limit (if any), and what would be the syntax for drives beyond 26.
I just want to proof things against some future Idiot who's going to phone me in time to come about software failing in obscure ways and who, as it might transpire has say 32 Disks on his system.
Regards
Bram van Kampen
|
|
|
|
|
You can only have 26 drive letters because it is limited by the english language.
But you can have more than 26 volumes using something called as Reparse points .
Reparse point s allows you to create NTFS junction folders where a folder points to a different volume.
So when you're accessing the folder, you're actually accessing the root of another volume.
Sysinternals has a tool to manipulate junctions - Junction v1.05[^]
Read more about NTFS junction points - How to create and manipulate NTFS junction points[^]
|
|
|
|
|
In addition to <superman>'s response, you can attach a drive to an empty NTFS directory on another drive with standard tools.
In Vista... control panel, admin tools, computer management, disk management, right click on a partition and choose drive letters and paths.
I assume something similar in 7, and XP.
Besides, "26 is enough letters for anyone!"
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks to Both,
Iain Clarke, Warrior Programmer wrote: Besides, "26 is enough letters for anyone!"
I wholehartedly Agree. It is not that I am looking for more Drive Letters, I just am trying to anticipate what customers in the field 'might' do. In a nutshell, my Software fishes a 'Path' out of the Registry, and must decide whether this path refers to a file on a Local Drive, or to a file somewhere on the Network.
This is all in aid of a larger design which retrieves timestamps from a designated machine on the network.
My initial approach was that if it is a UNC Name, e.g. '//Server1/Data/MyData.Dat', it refers to a File on the Network, UNLESS the Name of this computer is 'Server1'. and, Alternatively, that if it is of the form 'P:\Application Data\...\MyData.Dat' that it refers to a Local File, UNLESS 'P:\' is a Mapped Drive, which we can determine with GetDriveType.
Now, this 'Junction' stuff seems to throw sand in the above machinery. I had never heard of it, cannot imagine I will ever need it, but, Some future customer somewhere someday just might!
And THEN we have suddenly an obscure bug which causes the time stamp to be incorrect on certain machines (Actually it would retrieve the timestamp successfully from but from the wrong machine, and would give 'Time Server Errors' if this machine were switched of, but that might not be clear at the time! So, I want to trap these situations, both during Setup and at Startup.
Now I'm Stuck!
Maybe I should re-phrase the question as Follows:-
'How do I determine whether a path points to a Local File, or a File on the Network'
Thanks,
Bram van Kampen
modified on Saturday, December 5, 2009 8:13 PM
|
|
|
|
|
Bram van Kampen wrote: 'How do I determine whether a path points to a Local File, or a File on the Network'
How about GetDriveType() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I'm going to make your life harder still:
Taxes: Hierarchical Storage Management[^]
This is not something I've ever come across myself - but you're actively looking for edge cases, which I approve of 100%.
But a little easier also. I didn't trust explorer to show every possibility with the Tools | Map Network Drive command, so I looked at "net use /help" at a command prompt, and saw this following bit:
The syntax of this command is:
NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
....
devicename Assigns a name to connect to the resource or specifies
the device to be disconnected. There are two kinds of
devicenames: disk drives (D: through Z:) and printers
(LPT1: through LPT3:). Type an asterisk instead of a
specific devicename to assign the next available
devicename.
....
So, that implies strongly that volume reparse stuff is only for actual partitions, not network drives.
So GetDriveType will work for you if the path starts with a drive letter.
Hope that helps!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Bram van Kampen wrote: I just want to proof things against some future Idiot who's going to phone me in time to come about software failing in obscure ways and who, as it might transpire has say 32 Disks on his system.
If they managed to successfully label 32 disks on their system (with only 26 letters), why would your code care? Now if it was your code's job to do that labeling, that's a whole other issue.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: If they managed to successfully label 32 disks on their system (with only 26 letters), why would your code care? Now if it was your code's job to do that labeling, that's a whole other issue.
Because I need to determine if something like 'C:\Drive32' refers to a Dir on the Current Computer, or to a File located on a Share on another computer. GetDiskId() tells me it is on thisone, the Name suggests otherwise!
Thanks,
Bram van Kampen
|
|
|
|
|
I tryed to use
AddAceToObjectsSecurityDescriptor()
http://msdn.microsoft.com/en-us/library/aa379283%28VS.85%29.aspx[^]
to give certain rights to some generic users on files, directories, etc.
All worked OK until I tryed to use the acronyms
Everyone
Guest
etc.
on system that are localized (German, Finnish, etc.). Is there any alternate solution to
AddAceToObjectsSecurityDescriptor()
on giving rights?
I think that this "names" are aliases for system values (numbers).
Any solution?
...In VC++6 please. I'm an old fashion boy.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Greetings!
I am developing in C++ using MS Visual Studio 2008.
Code for our main application is contained in about 25 separate projects in our main workspace. In addition, we have a few other projects in that workspace because they use some of the same DLLs. I am working on a couple of DLLs that will provide data access services for a major upgrade to the application expected in a few months. I have a small test application for my new DLLs.
The test application and the new DLLs are not in the dependency list for our major application.
I just downloaded code for the major application from source control, set the major application to be the startup project, and rebuilt it. The test application and the new DLLs got built along with everything else!
If VS 2008 does not listen to a project's dependency list, how does it decide which files to compile? Or does the startup project not control what gets built when a user presses F6?
Thank you very much.
RobR
|
|
|
|
|
Any files was modified will be rebuilt. Other files will not be compiled
There is one thing (happened to me before) you need to check the computer date and time setting is current or not. If not, the VS will build everything in the project every time you try to compile it.
modified on Friday, December 4, 2009 1:44 PM
|
|
|
|
|
My problem is not that everything in the project gets rebuilt. My problem is that everything in the WORKSPACE is being rebuilt. My main application does not depend on my two new DLLs or my test project. Nonetheless, the three new projects are being built, and I don't know why. Is it because I am using the F6 key to trigger the build, rather than right-clicking on my main project and clicking "Build"?
RobR
|
|
|
|
|
Are you modifying header files that are included in many files? Then the files that include the header must also be recompiled. You would get memory errors otherwise with MSVC++...
|
|
|
|
|
Interrobang wrote: I just downloaded code for the major application from source control, set the major application to be the startup project, and rebuilt it. The test application and the new DLLs got built along with everything else!
When you downloaded the files from source control, did any of the OBJ, EXE, or DLL files exist? If not, a rebuild would have been needed.
Consider:
CPP --[compile]--> OBJ --[link]--> DLL
or
CPP --[compile]--> OBJ --[link]--> EXE
If any file is newer than the file to its right, a rebuild will occur. The first time you pulled everything from source control, a rebuild would have been expected.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Allow me to emphasize: My problem is related to the WORKSPACE, not to the project. When a project is built, all projects it depends on will be checked first, according to the logic given in the last post. And any projects those projects depend on will be built before them. I understand all of that.
What I am seeing is files being compiled (and throwing errors) when those files are not included in the project I am building, or any projects that project depends on in any way, directly or indirectly. The files are included in the workspace that contains my target project, but they are not included in the target project. I do not understand why files not in or related to the project file are being built.
RobR
|
|
|
|
|
I have had problems like that after inconsistent timestamps. From my experience the whole process has many subtleties. For instance, if an Obj File gets Rebuilt successfully, it will not nescessarily replace the existing Obj File, if the Existing one has a later Date Stamp, and is the same, but 'May' do so, if it is different. The whole system tends to become totally confused when it finds that time mooved back.
I have seen this type of behaviour where the Source Control Time Stamps are effectively generated by the Local User's Computer.
The Good News is, that if left to it'sw own device, and, if ALL computers are synchronised, it normally resolves within a couple of weeks, all by itself.
Success.
Bram van Kampen
|
|
|
|
|
I what to draw a XOR box on a memory DIB,so:
HDC hdc = CreateCompatibleDC(0);// create a DC
HBITMAP hmap=CreateDIBSection(hdc,(BITMAPINFO*)(&bmih),DIB_RGB_COLORS,(void**)(&pBits),NULL,NULL);// create a DIB
SelectObject(hdc,hmap);// select DIB to DC
TextOut(hdc,l,t,"Test String",12);// Draw something
SetROP2(hdc,R2_XORPEN);// set mix mode
Rectangle(hdc,l,t,r,b);// draw box with xor pen,but it not work
and I also test this:
PatBlt(hdc,b,t,w,h,DSTINVERT);// it not work too
Can somebody tell me why?
|
|
|
|
|
How are you validating that it doesn't work?
|
|
|
|
|
Thank you for reply!
But I can't see result by the function SetROP2() with XOR mix mode.
I think it must not work well on a memory DC or DIB Section.
The color box I draw, covered rectangle with the pen color.
Thanks again
modified on Friday, December 4, 2009 11:42 AM
|
|
|
|
|
While it's not a complete answer for you, when debugging this sort of stuff, I cannot exagerate the usefulness of:
Image Viewer Utility[^]
It's an oldie but goldie article, regularly kept up to date by PJ Arends, an elder god of CP.
I would also look at R2_NOT for a real answer.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|