Using the following
explorer.exe /select, "c:\path\to\file.txt"
I can open Windows Explorer and select the file. In Delphi I do this to select "Parm" file:
ShellExecute(Application.MainForm.Handle, 'OPEN', PChar('explorer.exe'), PChar('/select,"' + Parm + '"'), nil, SW_NORMAL);
And it works. My problem is this: if I select a different file in the recently opened Explorer (clicking in a different file) and then call the above code the "Parm" file is not selected again. Interestingly, there are some programs that select the file again. For instance, ITunes always selects the desired file.
Does anyone have a clue of how to make Explorer always select the specified file?
This is a known limitation of using the /select switch with explorer.exe, it will only select the specific file if the parent folder is not already open.
You'll have to use an API call like SHOpenFolderAndSelectItems in stead. This function also allows for multiselect.
Related
SSIS hangs and I am unable to open the solution. In the lower left corner there is a message "Testing Connectivity". SSIS does not respond to any command, it does not let me access the package or change any setting.
In Windows explorer, Go to the folder with the solution and package that you cannot open
Open the user preferences file , that is the file with the extension .user
Open the file in a text editor and find the setting for OfflineMode
Change the value to true, it should look like this: "OfflineMode > true< / OfflineMode>" (wihtout the spaces)
I am facing a problem with my visual studio 2013 ultimate. i would run a open cv project but iam getting a error message like this " opencv_core249d.lib" missing from ur computer. re install the program.
Solution : It works with eclipse Version: Mars.2 Release (4.5.2).
This is a missing .dll issue, not a missing lib issue. It usually occurs when the Environment Variables have not been correctly set in your Windows environment. To take care of this problem, there are 2 methods:
1) edit Environment variables
Go to ‘My Computer’ , right-click and select ‘Properties’. A window called ‘System’ will open, containing the Windows Logo on the right. On the left margin of this window, you will find a link named ‘Advance system
settings’. Click on it.
Another window called ’System Properties’ will open. On the bottom right corner of this window, click on the button named ’Environment Variables..’.
Under the ‘System variables’ column, look for a variable by the name ‘Path’. - Select ‘Path’ and click ‘Edit..’
In the ‘variable value’ row, add the following address:
\path to\opencv\build\x86\vc12\bin;
Please Note- Ensure that the new address added by you, and the address previously written in the ‘variable value’ row, are separated by a ; DO NOT REMOVE the previous environment variable addresses.
2) Manually copy the .dll files.
In case the first approach does not work for you, go to:
\path to\opencv\build\x86\vc12\bin;
You'll find all the dll files that you're looking for. Copy those files to directory where your source code is located.
I want to find Auto-Alignment Shortcut Key in Keil uVision. I tried some shortcut keys but I can not find. In Visual Studio I used to: CTRL + K + D , but in keil uVision I don't know how it is work.
For example :
When you type below ( usually copied from another text file which was not tabified correctly):
Use the shortcut key Auto Alignment with this block of code can auto formatting your code as below :
Stop searching. There is no such feature.
Was able to align in uVision5 with Astyle (http://astyle.sourceforge.net/).
File must be saved so that this tool can do its work.
Instructions :
Copy the Astyle.exe file to the Keil installation directory (e.g. D:/Keil_v5/)
Then open Keil and under the Tools menu, open the Customize Tools Menu option.
Create a new Menu Content, the name can be casual .
Command selects the Astyle.exe file in the keil installation directory.
Fill in Arguments !E
You can add a shortcut key for the operation in Edit.
Cheers to this https://www.programmersought.com/article/578892324/
This question already has answers here:
How to associate a program with a file type, but only for the current user?
(2 answers)
Closed 8 years ago.
How can i auto-open a custom extension in my Delphi app ? I'm trying to make application
that loads text files but with a different extension.
Example : Text.DZ | all i want is when i click the file with .DZ Extension it opens my app automatically and loads the text inside into the memo1.lines.text.
I know that i have to register my new custom extension but i have no idea how to do it and
load the text into my app.
Also if you can include a source-code example that would be awesome.
Any help will be much appreciated ! and
Sorry for my newbiness and bad English explanation but i hope you guys understand me (^-^)/.
There's a way to do it programmatically, although I don't recall how off the cuff.
That said, if you're just wanting to do it for your own personal use, not for a piece of software you'll be distributing to others, then the easiest way is to use Windows Explorer: click the data file you want, then right-click and select Open With -> ... you'll probably need to select the Other... option at the bottom. That will bring up a dialog box that lets you choose your app. There should also be a checkbox somewhere that says something like "Make Default" or "Always Open With This" or something along those lines. Make sure that box is checked. Then click OK a couple of times and you're off to the races.
But you'll also need to set up your app to read the filename from the command line. You use ParamStr and ParamCount for this.
for i := 0 to ParamCount do
ShowMessage('Parameter '+IntToStr(i)+' = '+ParamStr(i));
When you double-click on the data file, it will open your app and pass this filename as ParamStr(1). So when you get it, simply do something like this:
memo1.lines.LoadFromFile( ParamStr(1) );
Use this as a STARTING POINT (it won't compile if you just copy-and-paste!):
procedure TMyForm234:FormCreate( blah blah )
begin
if ParamCount > 0 then
theMemo.Lines.LoadFromFile( ParamStr(1) );
end;
So, I cannot associate my program with a specific file type without forcing the poor user to enter its admin password (it may be ok for home users, but it is a gigantic problem for users in a corporate env). In this case the only solution is to make the association only for the current user.
I have tried that but something is not working.
If i understand correctly I have to write a key like (let's say) '.mp3' in ctCurUserFileExt and write in it something like 'my_file'. Then in ctCurUserClases I add a key like this:
WriteReg_String(RootKey, ctCurUserClases+ 'my_file\shell\open\command', '', Application.ExeName+ ' "%L"', TRUE)
However, when I double click the file, Windows asks me with which application should it open it.
Here are the constant:
CONST
RootKey= 'HKEY_CURRENT_USER';
ctCurUserFileExt= '\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\';
ctCurUserClases = '\Software\Classes\';
If you want to register the association for every user, write your data to
HKEY_LOCAL_MACHINE\Software\Classes
If you want to register the association for the current user only, write your data to
HKEY_CURRENT_USER\Software\Classes
This is how to do the latter:
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('\Software\Classes\.myfile', true) then
WriteString('', 'MyAppDataFile');
if OpenKey('\Software\Classes\MyAppDataFile', true) then
WriteString('', 'My Very Own Text File Type');
if OpenKey('\Software\Classes\MyAppDataFile\DefaultIcon', true) then
WriteString('', 'C:\WINDOWS\notepad.exe');
if OpenKey('\Software\Classes\MyAppDataFile\shell\open\command', true) then
WriteString('', 'C:\WINDOWS\notepad.exe "%1"');
finally
Free;
end;
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
This will associate .myfile files, called "My Very Own Text File Type" so that they will have the icon of notepad.exe and will be opened by notepad.exe. The last line tells Explorer to 'reload' itself to reflect the changes made to the file associations. For instance, Explorer file list views will update. The WinAPI function SHChangeNotify is declared in ShlObj.pas, so you need to uses ShlObj.
Notice that the %1 in shell\open\command will expand to the current file. For instance, if you double-click on C:\some dir\test.myfile, then Explorer will execute the command
C:\WINDOWS\notepad.exe "C:\some dir\test.myfile"
Have you looked at setting it under HKEY_CURRENT_USER\Software\Classes as per http://support.microsoft.com/kb/257592