Current area: HOME ->

Zip File view

Multiple instance Prevention Routines


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: FINDAPP.PAS
Found in file: VBDEMO7.ZIP

Download: PHRACTASMAGORIA v1.0 A cool fractal program
library WNDFIND;

{These are the units used}
uses Strings, WinTypes;

{These are global variables to the DLL}
var
        VBhWnd:hWnd;
   ThWnd:Integer;
        Capt:Array[0..255] of Char;


{These are the API functions used}
procedure GetWindowText (Wnd:hWnd; Buff:PChar; BufSize:word); far;
        External 'USER' index 36;
procedure SendMessage (Wnd, Msg, wParam:word;lParam:PChar); far;
        External 'USER' index 111;
procedure EnumWindows (Func:TFarProc; lParam:PChar);far;
        External 'USER' index 54;


{This is the call-back function that is sent the hWnd of every window}
function EnumFunc (hWnd:hWnd; Search:PChar):Bool;export;
        Begin
      {First retrieve the caption of the Window}
              GetWindowText (hWnd, @Capt, 256);
      {StrPos is identical to Instr. We cap both strings to be insensitive}
        if StrPos (StrUpper (@Capt), Search) <> Nil then
                    Begin
                {List1.AddLine Caption$}
              SendMessage (VBhWnd, LB_AddString, 0, @Capt);
            {ThWnd = ThWnd + 1}
                Inc (ThWnd);
         end;
                 EnumFunc := TRUE;
   End;

function FindCaptions (Wnd:hWnd; Search:PChar):Integer;export;
        Begin
        {Set the global variable so EnumFunc can find it}
        VBhWnd := Wnd;
      {Set counter to zero}
      ThWnd := 0;
      {Clear the list box}
      SendMessage (Wnd, LB_ResetContent, 0, StrUpper(Search));
      {Tell Windows to start sending hWnds to EnumFunc}
      EnumWindows (@EnumFunc, Search);
      {When all windows have been examined, return total to VB}
      FindCaptions := ThWnd;
   end;



Exports
   EnumFunc,
   {The resident keyword makes access from VB quicker}
        FindCaptions resident;


{No startup code but we need the empty routine anyway}
Begin
End.


Example of forcing a Window to always remain on top

DemoNews 005

PHRACTASMAGORIA v1.0
A cool fractal program
Download Example of forcing a Window to always remain on top Download DemoNews 005 Download PHRACTASMAGORIA v1.0 A cool fractal program







Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Delphi Localization Tool Sisulizer (WYSIWYG)
Create multilingual Delphi apps in three simple steps. Localize XML, HTML Help ... Try Sisulizer now
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.