Programmer » Lucian Wischik

Here are some components, programs and documentation I have written. Most are for C++/Win32.

Utilities

Screen savers

Internet code-samples

Graphics code-samples

    https://www.wischik.com
  • AVI utils - source code for creating AVI files, both audio and video.
  • 1bpp - convert a bitmap to 1bpp monochrome in C#, fast. The source code illustrates how to program gdi32, the windows graphics library, from C#.
  • GetImageSize - routines in C++/stdio and in PHP to get the dimensions of GIF/JPEG/PNG image files.
  • PNG Bounding Box https://www.wischik.comischik.com/lu/programmer/pngbb.zip">pngbb.zip, 68k) - earlier versions of Photoshop failed to export the real size (inches/cm) of the image and only stored raster size (pxiels). This program adds real size information, which allows the PNGs to be used in latex. The code shows how to read PNG headers.
  • GLenum (glenum4.zip, 277k) - lists all the drivers, all details, all pixel formats on your system.
  • Palette Animation https://www.wischik.comischik.com/lu/programmer/palanim.zip">palanim.zip, 39k) - this is the best example code I've seen for palette animation. It comes from the old Microsoft WinG development kit, and I've tidied it up a little to make it compile cleanly under Win32.
  • Playres (playres.zip, 54k) - plays an AVI that's embedded as a resource.
  • WMP vizs (wmp_viz.zip, 67k) - example visualizations for Windows Media Player. I created these because the new-viz wizard supplied by Microsoft only works in VisualC++6 (not in BCB or VS.NET). And also because that wizard generates a lot of unnecessary COM-junk.
  • TRealMetafile (wmf2tex.zip, 190k) - a class which gives low-level control over the contents of a metafile. You can play it record by record. Supports and distinguishes between WMF and EMF. Shows how you might generate EPS from it. Or, you could look at the metafile example code from Microsoft which is more straightforward...
  • MS metafile examples (ms-emf.zip, 295k) - microsoft's metafile example code and documentation.

Win32 code-samples

    https://www.wischik.com
  • ShellExecute (shellex.zip, 19k) - how to use ShellExecute and CreateProcess.
  • Autoplay (autoplay.zip, 20k, for BCB3) - an autoplay program for a CD
  • Shell links (shelllink.zip, 157k) - how to create shortcuts on the start menu
  • GetModhttps://www.wischik.comA href="http://www.wischik.com/lu/programmer/modname.zip">modname.zip, 20k) - retrieves the application that owns a given HWND window.
  • SetDlgItemUrl - this routine turn a static text in a dialog, into a blue underlined hyperlink. It does it all with subclassing, and is very easy to use.
  • Crlf - for translating unix LF text files into windows CRLF. It was designed to integrate seamlessly into windows, but stopped working as of XP.
  • MailNotify (mailnotify.zip, 39k) - an icon in the system tray which periodically makes an SSH connection to a unix machine, remotely executes a console command there (in this case a command to check for mail), and captures the output of that console command.

Debugging

    https://www.wischik.comhttps://www.wischik.com
  • Ms-dbg (ms-dbg.zip, 133k) - This brings microsoft-compatible debugging information to Borland. With "map2dbg" you can convert from a borland MAP file to a microsoft DBG file. This lets you use standard debugging tools like DrWatson and imagehelp.dll. For instance, in "calldemo" we use it to generate a callstack of the current program. I'm sorry but I don't have BCB6 and haven't updated ms-dbg to work with it. If you've updated it, please email me and I'll put it up on this website.
  • PE files (pe.zip, 312k) - the PE file format. PE files are win32 executables (DLLs and EXEs). I've collected here some documentation and source code written by other people. Also I've added my own program resupdate to update the resources in an executable. It even works on unix/linux! so you could write a webserver which serves up custom-modified executables.
  • Watch2 (watch2.zip, 144k) - a simplistic bit of source code that overrides new/delete/malloc/free to check that all memory is freed. There are better alternatives out there...

Components for Borland C++Builder

    https://www.wischik.comhttps://www.wischik.comhttps://www.wischik.com
  • Audio-sampling (for BCB3, BCB4 and BCB5) - lets you sample sound from line-in and displays it. Components include TRecorder and TFFT (non-visual) to gt the data in and fourier-transform it, and TWaveView, TSpectralView and TFingerprintView (visual) to display it. Comes with full source code.
  • Animation-timer (for BCB3, BCB4 and BCB5) - fast, responsive multi-threaded replacement for TTimer. It's drop-in compatible with the regular TTimer. But it is much faster. And also uses a special design so that, no matter how fast you set it, it doesn't interferes with user-responsiveness. Comes with full source code.
  • Flame-panel (for BCB4). Displays an animated flame. Just for fun. Comes with full source code.
  • Lucianhttps://www.wischik.comref="http://www.wischik.com/lu/programmer/lsetup.zip">BCB4). An installer program. Useful for distributing components. Doesn't work under Win2000/XP/Vista alas. Comes with full source code.
  • NotifyEdit - a validating edit control for BCB. Comes with full source code.
  • GetRight Monitor (for BCB5, 719k) - to integratehttps://www.wischik.comager GetRight. With this component you can displahttps://www.wischik.com status.
  • Open Tools API Browser (https://www.wischik.comw.wischik.com/lu/programmer/tsbrowse35.zip">BCB3, BCB4, BCB5) - The Open Tools API (formerly known as "Tools Services Browser") lets you add experts, menus &c. to the Borland IDE. It's poorly documented and hard to use: this code lets you experiment with the API visually before you start coding.
  • IDEScript (for BCB3/4, 35k) - as well as using the Open Tools API, you can also get hold of the TTabControl and TEdit and other components that make up the IDE. This code lets you browse through the components and spoof clicks on menu items.
  • Multiline Editor (mult.zip, for BCB3/4, 27k) - an example of IDEScript. This one makes it so the tabs at the top of the editor get split over multiple lines, by setting the TTabControl::MultiLine property.
  • PlainWin32 (plainwin32.zip, 42k, BCB5) - a small toy expert built using the Open Tools API. This adds a File>NewApplication>PlainWin32 expert, one that does further customization on the code after it's been generated.
  • Code https://www.wischik.comttp://www.wischik.com/lu/programmer/codeexp.ziphttps://www.wischik.comk) - a system I developed to help when you write a code-generating expert. It has a sort of script/macro language that your expert can execute, with commands like --CreateComponent and --CreateForm and PropertyName=Value, so that the expert can create forms and components.

Gracias, la unica luz para poder tocar archivos OGG
Un abrazo
Guadalupe
rosario1906_28@hotmail.com
1111
it's great that you have the utility for creating avi. how about exporting the frames? do you have those?
 
thanks
 
edmondwee@hotmail.com
Nice Code :D
ni tai niu le ( in chinese pinyin ) . accesine
thank you for your DBX Utils
Hello,
do you have any version of oyur Audio Samplig Comp for DELPHI?? have any component to display an audio file waveform?
THANKS IN ADVANCE
Montxo Garcia
email to: montxo@zio-audio.com
 
Hello,
Audio Sampling compo can`t recompiled in bcb6 ? why ?
I have changed to <designintf.hpp>, still dont work?
Can u help, thank u first.~
Hi. This site has extremely informative contents. Thank you for that.
 
I was looking at your BHO code. Do you know how to intercept/get all URLS that are in a website using the BHO? Could you let me know if you know it? My email is Nicholas.G5@gmail.com
 
Thanks.
Any plans to update zip_utils to the latest zlib version 1.2.3?
hi,
 
this is extremely good that u have a helping hand
towards beginners.
 
but i have some suggestion, if u could add graphs and diagrams
to the contents then i guess u might be helping more to us.
 
thanx for the DBX util part. its amazing
and very well explained.
Thanks for map2dbg - helping us with some tricky windbg debugging involving a D2007 produced app!
Zip utils is great. Easy, clean and fast enough... Thank you
1. What is the most difficult aspect of the analog design process?
 
2. The most enjoyable?
 
3. If you could have any one tool to make your job easier, what would it be?
 
4. Are analog engineers truly different from digital engineers?
 
5. What made you choose analog design?
 
6. What applications are you working on; consumer electronics, wireless communication, networking, power management, etc., etc.?
 
7. What process technology are you working in?
 
8. If you have been doing analog for a while, do you think thetools have gotten better or stayed the same?
 
9. Do shrinking processes make analog design more difficult?
 
10. What part of your job do you wish you could hand off to someone else to do?
 
11. How does it feel to get working silicon back for a new design? Is that the buzz that keeps you doing this, or if not, what is?
 
12. Do you worry about digital taking over?
 
13. Do your designs represent just one (critical) part of a mostly digital chip?
 
14. How do you interface to the digital engineers?
 
15. Do you work in digital as well; use programming or modeling languages: Verilog, Verilog-AMS, etc.?
 
Subscribe for daily updates. href="http://techdockets.com"
 
June - 15 - 2009
Thank you for sharing your HZIP source with the world. I am using the Unzip part in Windows CE 6.0 R2 and it works real fine.
Keep up the good work!
Thanks and Best regards,
Dirk van Boxel
www.boxel.nl
very nice..............
hello, please help me
how to export data(String,int,...) to microsoft excel with c++ builder and with password to open that file
November 16, 2009
I need to add a GPS Coordinate to the capture of a video. I need to place it in somewhat like the Date/Time stamp is entered. This needs to be done real time and not post production.
thanks for any suggestions.
Michael
aclv@comcast.net
Genious.... thanks.
 
Eugene
Minor enhancements to the ZIP utilities.
Listed above as 'Internet code-samples'
 
I did this mainly to do a per-file-progress bar, however
to see this progress bar, you need to call the progress
function in a loop in the main app thread, while the
zipping function is taking place in a separate thread.
 
1.Added
void ZipSetCompression(HZIP hz, int level)
{
 TZipHandleData *han = (TZipHandleData*)hz;
 han->zip->compressionlevel=level;
}
 
2. Added
unsigned int ZipProgress(HZIP hz)
{
 TZipHandleData *han = (TZipHandleData*)hz;
 return han->zip->readsofar;
}
 
3. Added these in class TZip
  unsigned readsofar;
  unsigned compressionlevel;
 
4. I added readsofar here.....
  hfout = CreateFile(fn,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
  readsofar=0;
  if (hfout==INVALID_HANDLE_VALUE) {hfout=0; return ZR_NOFILE;}
  ....
  in TZip::Create
 
5. I added readsofar here....
  HANDLE hf = CreateFile(fn,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
  readsofar=0;
  if (hf==INVALID_HANDLE_VALUE)
  ....
  in TZip::open_file
 
6. I added readsofar here...
  ......
  BOOL ok = ReadFile(hfin,buf,size,&red,NULL);
  if (!ok) return 0;
  ired += red;
  readsofar+=red;
  crc = crc32(crc, (uch*)buf, red);
  ......
  in unsigned TZip::read(char *buf, unsigned size)
 
I did this because I had an app zipping large files but the tech though it locked up. Apparently there were 2 issues 1. The compression was set to high - i.e. it was taking very long 2. There was no progress bar in the application - so no apparent response for a long time. Now I have a GUI that shows a per-file progress and an all-file progress.
 
Colin B Maharaj
 

 

Great man, your code help me a lot!!!!!!!!!!!!!!!
https://www.wischik.com
http://www.wischik.com/lu/programmer/
Hi,
 
First of all thank you verymuch for these code examples.
I am executed CreatAVI example.
 
Here it works fine for 2 channel audio. I am trying to modify it for multichannel. but the final avi is not having any audio.
Can you please help me what's the wrong.
 

I Modified the WAV structure as
typedef struct
{ char id[4]; //="fmt "
  unsigned long size; //=16
  short wFormatTag; //=WAVE_FORMAT_PCM=1
  unsigned short wChannels; //=1 or 2 for mono or stereo
  unsigned long dwSamplesPerSec; //=11025 or 22050 or 44100
  unsigned long dwAvgBytesPerSec; //=wBlockAlign * dwSamplesPerSec
  unsigned short wBlockAlign; //=wChannels * (wBitsPerSample==8?1:2)
  unsigned short wBitsPerSample; //=8 or 16, for bits per sample
  unsigned short cbSize;
  unsigned short wValidBitsPerSample;
  unsigned short dwChannelMask;
  unsigned short SubFormat;
} FmtChunk;
 
Remaining structure are same.
 
and ADDWAV function as
 
HRESULT AddAviWav(HAVI avi, LPCWSTR src, DWORD flags)
{ if (avi==NULL) return AVIERR_BADHANDLE;
  if (flags!=SND_MEMORY && flags!=SND_FILENAME)
return AVIERR_BADFLAGS;
  if (src==0)
return AVIERR_BADPARAM;
  TAviUtil *au = (TAviUtil*)avi;
  if (au->iserr)
return AVIERR_ERROR;
  // MessageBox(src);
  char *buf=0; WavChunk *wav = (WavChunk*)src;
  if (flags==SND_FILENAME)
  {
HANDLE hf=CreateFile(src,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
  if (hf==INVALID_HANDLE_VALUE)
{au->iserr=true; return AVIERR_FILEOPEN;}
  DWORD size = GetFileSize(hf,NULL);
  buf = new char[size];
  DWORD red; ReadFile(hf,buf,size,&red,NULL);
  CloseHandle(hf);
  wav = (WavChunk*)buf;
  }
  //
  // check that format doesn't clash
  bool badformat=false;
  if (au->wfx.Format.nChannels==0)
  { au->wfx.Format.wFormatTag=WAVE_FORMAT_EXTENSIBLE;;//wav->fmt.wFormatTag;
au->wfx.Format.cbSize=0;
  au->wfx.Format.nAvgBytesPerSec=wav->fmt.dwAvgBytesPerSec;
  au->wfx.Format.nBlockAlign=wav->fmt.wBlockAlign;
  au->wfx.Format.nChannels=wav->fmt.wChannels;
  au->wfx.Format.nSamplesPerSec=wav->fmt.dwSamplesPerSec;;//48000L;//wav->fmt.dwSamplesPerSec;
  au->wfx.Format.wBitsPerSample=wav->fmt.wBitsPerSample;;//24;//wav->fmt.wBitsPerSample;
au->wfx.dwChannelMask=SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
 
au->wfx.SubFormat=KSDATAFORMAT_SUBTYPE_PCM;;
au->wfx.Format.nAvgBytesPerSec=864000L;
au->wfx.Format.wBitsPerSample=(8*wav->fmt.wBlockAlign/wav->fmt.wChannels);
  }
  else
  { if (au->wfx.Format.wFormatTag!=wav->fmt.wFormatTag) badformat=true;
  if (au->wfx.Format.nAvgBytesPerSec!=wav->fmt.dwAvgBytesPerSec) badformat=true;
  if (au->wfx.Format.nBlockAlign!=wav->fmt.wBlockAlign) badformat=true;
  if (au->wfx.Format.nChannels!=wav->fmt.wChannels) badformat=true;
  if (au->wfx.Format.nSamplesPerSec!=wav->fmt.dwSamplesPerSec) badformat=true;
  if (au->wfx.Format.wBitsPerSample!=wav->fmt.wBitsPerSample) badformat=true;
  }
  if (badformat)
  {
if (buf!=0)
delete[] buf;
return AVIERR_BADFORMAT;
  }
  //
 
  if (au->as==0) // create the stream if necessary
  { AVISTREAMINFO ahdr; ZeroMemory(&ahdr,sizeof(ahdr));
  ahdr.fccType=streamtypeAUDIO;
  ahdr.dwScale=au->wfx.Format.nBlockAlign;
  ahdr.dwRate=au->wfx.Format.nSamplesPerSec*au->wfx.Format.nBlockAlign;
  ahdr.dwSampleSize=au->wfx.Format.nBlockAlign;
  ahdr.dwQuality=(DWORD)-1;
  HRESULT hr = AVIFileCreateStream(au->pfile, &au->as, &ahdr);
  if (hr!=AVIERR_OK) {if (buf!=0) delete[] buf; au->iserr=true; return hr;}
  hr = AVIStreamSetFormat(au->as,0,&au->wfx,sizeof(WAVEFORMATPCMEX));
  if (hr!=AVIERR_OK) {if (buf!=0) delete[] buf; au->iserr=true; return hr;}
  }
  //
  // now we can write the data
  unsigned long numbytes = wav->dat.size;
  unsigned long numsamps = numbytes*8 / au->wfx.Format.wBitsPerSample;
  HRESULT hr = AVIStreamWrite(au->as,au->nsamp,numsamps,wav->dat.data,numbytes,0,NULL,NULL);
  if (buf!=0) delete[] buf;
  if (hr!=AVIERR_OK) {au->iserr=true; return hr;}
  au->nsamp+=numsamps; return S_OK;
}
 
Can you please help me where is the mistake.
 
Thanks in advance
ANKIREDDY.
Hi,
 
Thanks for the zip utils code. Really helpful !!!
have a small query in the program. If i have a zip file within a zip file with password enabled, it corrupts d zip file.
eg: in Main.zip, if we have a.zip and b.xml.Main.zip is password protected.
If we unzip Main.zip giving d password , the extracted a.zip is corrupted whereas b.xml is fine.
 
BUT, if we have Main.zip with no password, it works fine.
 
Is this unzipping possible with the present code.
 
Any help is appreciated.
 
Thanks...
I am interesting in BHO, your code help me a lot,thx!
add comment  edit commentPlease add comments here