ShellExecute.zip

How to run shell command by MFC ?

434

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.

How to launch the external application in Delphi ?

1,060

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...

Delphi Program can command level execution program with hidden mode

693

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 ...

Run PowerShell Command as Administrator in Delphi

651

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

668

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.

URL Encode, Decode function for MFC

601

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...

How to load HTML resource on MFC ?

838

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...

Makefile to automate the build process for C++

275

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...

How to search file on certain directory ?

625

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...

How to Get Filenames from Clipboard ?

1,500

"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: .

Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL

1,819

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).

Disable Mouse and Keyboard from Delphi Code

787

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...

Detecting Drive Types

466

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...

Detecting and preventing Windows shut down

432

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...

How to Close Another Application by Windows Caption

384

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 ...

How to Change the Windows Start button bitmap

421

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...

How to Activate/Deactivate the Screen Saver

855

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.

Binary Search Sample Code

403

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.