How to run shell command by MFC ?
Followings are the useful example can run shell command. If you want to launch browser for specific URL,simple run as below:* Note: The above code must be included in the same source.
Followings are the useful example can run shell command. If you want to launch browser for specific URL,simple run as below:* Note: The above code must be included in the same source.
In Delphi, you can execute commands with administrator privileges by using the ShellExecute function with the 'runas' verb. However, if you want to execute a specific command with administrator privileges, you can use the CreateProcess function from the Wi...
Without complex programming,you can print document by ShellExecute function.
You can launch application on windows by ShellExecute function.Following is the simple example to launch application. In case of running DOS command application such as batch file and you want not to display user,put SW_HIDE in the function option as follo...
Below is the example of running command with hidden mode. Actually there lots of command type in Windows like SW_NORMAL, SW_HIDE, ...What I am going to implement is running windows command with hidden mode.Below is the example of windows command execution ...
If you need to install an "inf" file using Delphi,you could use the next code:
Use this function to open your browser with a given URL.
To capture the output of the PowerShell command and store it in a string variable, you can modify the RunPowerShellCommandAsAdmin procedure to redirect the output of the PowerShell process and read it into a string. In this modified code:We create a T...
KMP String Matching Algorithm is well-known algorithm for faster string search.KMP is,as you know,Knuth,Morris,and Pratt.It's complexity is O(n).n is the length of target string and O is big-O notation.Here's the implemented algorithm.
Here's the good example for URL Encoding & Decoding. Above sample code use CString, so if you want to use it on another type of development environment such as gcc or something like that, you need to add some more stuffs because it may not suppo...
I tried to load HTML resource that stored in the application for MFC based application programming. The resource name is IDR_KURAPA_COM_HTML_ROOT.Actually this is very convenient to reduce files for application package.You can load HTML resource as followi...
Makefiles are used in C++ projects to automate the build process,especially when the project has multiple source files and dependencies.They define rules specifying how to compile individual source files into object files and then link those object files i...
Hi,problem with MFC Dialog based app: In OnInitDialog: .In OnTimer: .But OnTimer never reached.Why? When i call SendMessage( WM_TIMER,0,0); OnTimer calls succesfully.
In case of finding files on certain directory, you need to use FindFirstFileEx function.Following example shows the example,bool KFindFile(void *findname){ WIN32_FIND_DATA FindFileData; HANDLE hFind; CString strSearch...
Put a TMemo (Memo1) and a TButton (Button1) in your form.Put this code into OnClick of Button1: .
"If I use the Windows Explorer to copy a file,how can I use the paste function in my application?" .This code retrieves the filenames from the clipboard to a memo component.Drop a memo and a button on a form and set the OnClick of a button to: .
Here's how to get the Windows version from Delphi code: .
thePath holds the Windows Temp directory: .
If you wish to disable those key combinations while your application is running call SystemKeys.When you call SystemKeys,if Disable is True,the keys will be disabled,False otherwise.Note: the code does NOT work under Win NT systems (XP,2000).
Here's the code that will display the standard Windows Properties dialog for a specified file (object) name.Usage:Here's the function source.
The BlockInput API function blocks keyboard and mouse input events from reaching applications.Place a Button (name: "Button1") on a form (name: "Form1") and use this code for the button's OnClick event handler.Once you click the button your mouse and keybo...
Here's how to get the types of drives on your computer: / / Note: you will need one button and / / one memo on your form, for this tip... procedure TForm1.Button1Click(Sender: TObject) ; var Drive: Char; DriveLetter: String[4]; begin &nbs...
When Windows is about to shut down,it sends a WM_QueryEndSession to all open applications.To detect (and prevent shutdown) ,we must define a message handler to this message.Put this definition on the private section of the main form:Also,to prevent Windows...
The following example demonstrates using the SHFileOperation function to copy a group of files and display a progress dialog.You can also use the following flags to delete,move and rename a group of files:FO_COPY,FO_DELETE,FO_MOVE,FO_RENAME.Note: The buffe...
Here's an example of controling the sound volume from Delphi: .
To programmatically close another application, send to the application a WM_QUIT message. "Window caption" is the caption of the window that you are sending the message to. Usage: if not KillApp('Window caption') then ShowMessage('App not closed') ;Here's ...
Here's how to chane the bitmap on the Windows Start button:{We'll need several global variables}var Form1: TForm1; StartButton : hWnd; OldBitmap : THandle; NewImage : TPicture;...{Now, we put this code in...
The example runs 'chkdsk.exe c:' and displays the output to Memo1.Put a TMemo (Memo1) and a TButton (Button1) on your form.Put this code in the OnCLick event procedure for Button1: .
Sometimes you want to deactivate the current screensaver when performing some very long process.You can use this function to activate or deactivate the screensaver.Pass True to activate it,or False to deactivate it.
This is Binary search that returns a negative one if the number is not found.This code does a bubble sort and then proforms the binary search.