Taking a screenshot of the screen lazarus / 39-Graphics ---------------------------------------------------------------------- fabienwang · 2010-08-18 11:59 Hello I have followed the: http://wiki.lazarus.freepascal.org/Developing_with_Graphics example to take a screenshot but i have an error: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   MyBitmap: TBitmap;   ScreenDC: HDC; begin   MyBitmap := TBitmap.Create;   ScreenDC := GetDC(0);   MyBitmap.LoadFromDevice(ScreenDC);   ReleaseDC(ScreenDC); end; I have the following errors while i have the uses LCLIntf and LCLType: Quoteunit1.pas(88,23) Error: Unknown record field identifier "CREATE" unit1.pas(90,12) Error: Unknown record field identifier "LOADFROMDEVICE" unit1.pas(91,21) Error: Wrong number of parameters specified for call to "ReleaseDC" What did i do wrong? My version of lazarus is: Lazarus 0.9.28.2 r22279 FPC 2.2.4 i386-win32-win32/win64 on Windows XP SP3 v5512 CPU: Intel Core 2 Duo Thanks for your help ---------------------------------------------------------------------- felipemdc · 2010-08-18 12:07 Please read here: http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way _to_ask_questions_in_the_forum_.3F ---------------------------------------------------------------------- fabienwang · 2010-08-18 12:19 Thanks felipemdc i didn't know. ---------------------------------------------------------------------- felipemdc · 2010-08-18 12:56 No problem =) Your application has the unit "Windows" in the uses clause, so it is catching Windows.TBitmap, try like this: var   MyBitmap: Graphics.TBitmap;   ScreenDC: LCLType.HDC; begin   MyBitmap := Graphics.TBitmap.Create;   ScreenDC := LCLIntf.GetDC(0);   MyBitmap.LoadFromDevice(ScreenDC);   LCLIntf.ReleaseDC(ScreenDC); end; This code doesn't require the Windows unit, so if you aren't using it for anything else you can remove it and then the extra information as from which unit you are catching each type will no longer be necessary. ---------------------------------------------------------------------- fabienwang · 2010-08-18 13:10 ohh i got it. Actually i'm using it with shellapi to start the browser i'll be happy with the next openURL() thanks it's working great now. Except that the wiki suggest: ReleaseDC(ScreenDC); while it is: ReleaseDC(0 , ScreenDC); Thanks Best Regards, Fabien Wang aka Dr4x