Windows API equivelant to Unix (Ubuntu) lazarus / 8-Other ---------------------------------------------------------------------- xqtr · 2009-04-26 12:57 I have made a simple front end for my CarPC in  windows/Delphi, but now i am trying to switch to  Ubuntu/Lazarus and i want to run my front end from Ubuntu. In my Windows/Delphi code i use many  windows API procedure like:       setremoveborder(extapparea.extapp,True);SetWindowLong(extapparea .extapp, GWL_STYLE, WS_VISIBLE );winnotopmost(extapparea.extapp);showw indow(extapparea.extapp,sw_show);ShowWindow(FindWindow('Shell_TrayWnd' ,Nil), SW_HIDE);GetDeviceGammaRamp(DC, form1.OldGammaramp);CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);ClientRgn := CreateRectRgn(right,top , right + Width, top + Height) ;CombineRgn(FullRgn,FullRgn ,ClientRgn, RGN_diff);SetWindowRgn(Handle, FullRgn, True) ;Windows.GetSystemPowerStatus(Stat);Windows.SendMessage(HWnd, Messages.WM_KEYDOWN, WParam, LParam); and many more.... In general the procedures i use have to do with: Form manipulation (Show, Hide, Transparent)External Application Manipulation (Show, Hide, Resize, Minimize)System Information (Drives, Battery, Screen resolution, CPU info  etc.)Keyboard (Virtually press keys) Does anyone knows where i can find a good resource (site, file, forum) with information about that for Lazarus programming in Ubuntu or Linux? I have searched the forum here but i haven't found anything helpful. ---------------------------------------------------------------------- Marc · 2009-04-26 16:58 Quotesetremoveborder(extapparea.extapp,True);SetWindowLong(extapparea. extapp, GWL_STYLE, WS_VISIBLE );winnotopmost(extapparea.extapp);showwi ndow(extapparea.extapp,sw_show); why are you using winapi functions here. the VCL/LCL have perfect replacements for them. QuoteWindows.SendMessage(HWnd, Messages.WM_KEYDOWN, WParam, LParam);You never should need to mimic some input by sending a keystroke. QuoteShowWindow(FindWindow('Shell_TrayWnd',Nil), SW_HIDE);This is windows specific and have no meaning on other widgetsets. QuoteGetDeviceGammaRamp(DC, form1.OldGammaramp);Never needed this, what does it do QuoteCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);Never needed this, what does it do QuoteClientRgn := CreateRectRgn(right,top , right + Width, top + Height) ;CombineRgn(FullRgn,FullRgn ,ClientRgn, RGN_diff);SetWindowRgn(Handle, FullRgn, True) ;Here you may have an issue, regions are not (yet?) supported. There isn't realy a LCL "component" for this. QuoteWindows.GetSystemPowerStatus(Stat);Doesn't exist, but imo it should be possible to add some os dependent code for this. QuoteForm manipulation (Show, Hide, Transparent)Form transparency isn't supported (yet) QuoteExternal Application Manipulation (Show, Hide, Resize, Minimize)unlike to windows, on other OSses you'r usually not allowed to touch other processes. QuoteSystem Information (Drives, Battery, Screen resolution, CPU info  etc.)You will need platform specific code for this. QuoteKeyboard (Virtually press keys)??? QuoteDoes anyone knows where i can find a good resource (site, file, forum) with information about that for Lazarus programming in Ubuntu or Linux? I have searched the forum here but i haven't found anything helpful. Use the wiki or this forum. ---------------------------------------------------------------------- xqtr · 2009-04-26 18:31 Quote from: Marc on April 26, 2009, 06:58:18 pmwhy are you using winapi functions here. the VCL/LCL have perfect replacements for them. I used theses functions for external applications. The VCL can handle only its own forms. These function are for other programs i used for my project, like media players or gps navigation software QuoteYou never should need to mimic some input by sending a keystroke. Also, i use the "mimic key stroke" method for external apps. For example i could pause the media player by sending to it a virtual SPACE BAR keystroke. QuoteThis is windows specific and have no meaning on other widgetsets. Same as above QuoteNever needed this, what does it do In windows its a way to manage the gamma of the screen. Its brightness in a general way. QuoteCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);Never needed this, what does it do Its a windows API function to make a list of all running process. QuoteHere you may have an issue, regions are not (yet?) supported. There isn't realy a LCL "component" for this. QuoteDoesn't exist, but imo it should be possible to add some os dependent code for this. can i use the /proc/acpi  directory structure to find info about the system? QuoteForm transparency isn't supported (yet) Transperancy is not a big matter for my project. I prefer to find a way, how to control external/other application through my app. Quoteunlike to windows, on other OSses you'r usually not allowed to touch other processes. hmm, that is not good for my project. QuoteYou will need platform specific code for this. any suggestions, source code, links? Quote??? You said it above, mimic keystrokes on other applications. Thanx for your reply. QuoteUse the wiki or this forum. i have. ---------------------------------------------------------------------- Ñuño_Martínez · 2009-04-27 14:58 Quote from: Marc on April 26, 2009, 06:58:18 pmQuoteExternal Application Manipulation (Show, Hide, Resize, Minimize)unlike to windows, on other OSses you'r usually not allowed to touch other processes. I never understand why people wants to manipulate other applications. By the way, most operating systems allows application communication (which is different) that allows to share information and make request using pipes, streams, loopback net and other safe and useful interfaces. For example, I'm using an MSX emulator that has a beautiful graphic interface. Both, the emulator and the graphic interface, are actually different applications but they are communicated and sends information between them. This way the GI can change emulator's speed or simulate events while the emulator is able to send debug information (i.e. microprocessor register status or memory dumps) to the GI so it can show it in useful ways. As I said I never understand... May be you should learn about all that stuff (streams, pipes, messages, net...). ---------------------------------------------------------------------- xqtr · 2009-04-27 17:06 Quote from: Ñuño_Martínez on April 27, 2009, 04:58:47 pm I never understand why people wants to manipulate other applications. By the way, most operating systems allows application communication (which is different) that allows to share information and make request using pipes, streams, loopback net and other safe and useful interfaces. For example, I'm using an MSX emulator that has a beautiful graphic interface. Both, the emulator and the graphic interface, are actually different applications but they are communicated and sends information between them. This way the GI can change emulator's speed or simulate events while the emulator is able to send debug information (i.e. microprocessor register status or memory dumps) to the GI so it can show it in useful ways. As I said I never understand... May be you should learn about all that stuff (streams, pipes, messages, net...). .... hmm i think that because it's the Windows way...  as i said i come from the windows enviroment and i am a newbie in linux/ubuntu. In windows it is easier to manipulate other applications (there are a lot of API functions for this) than finding or making applications that communicate each other... After a lot of searching i understand now that is difficult to "touch" other processes in linux/ubuntu, so i will approach your way. Any suggestions are welcome. I am searching for a media player (for video files) that could fully interact with my application (start, pause, resize, fullscreen etc.). Thanx. ---------------------------------------------------------------------- Paul Ishenin · 2009-04-28 03:13 Quote from: xqtr on April 26, 2009, 08:31:37 pmQuoteDoesn't exist, but imo it should be possible to add some os dependent code for this. can i use the /proc/acpi  directory structure to find info about the system? I know one lazarus project which gather different system information: http://betatester.by.ru/sysinfolinux.html But page is on russian and you will need google translate probably. Also I don't know whether you will find something useful there. ---------------------------------------------------------------------- LazaruX · 2009-04-28 11:38 This was my idea a while a go: http://forum.lazarus.freepascal.org/index.php/topic,5677.0.html P.S.:Thanks Nuno, I have edited the link ---------------------------------------------------------------------- Ñuño_Martínez · 2009-04-29 12:35 Quote from: BPsoftware on April 28, 2009, 01:38:15 pmhttp://forum.laza rus.freepascal.org/index.php/topic,6646.msg31045/topicseen.html#new I think there is something wrong with this link, isn't it? ---------------------------------------------------------------------- felipemdc · 2009-05-08 23:13 Some additions and corrections to Marc statements: QuoteShowWindow(FindWindow('Shell_TrayWnd',Nil), SW_HIDE); See TTrayIcon, we have platform independent support for tray icons Quote from: Marc on April 26, 2009, 06:58:18 pmQuoteClientRgn := CreateRectRgn(right,top , right + Width, top + Height) ;CombineRgn(FullRgn,FullRgn ,ClientRgn, RGN_diff);SetWindowRgn(Handle, FullRgn, True) ;Here you may have an issue, regions are not (yet?) supported. There isn't realy a LCL "component" for this. Regions and window transparency using them (SetWindowRgn) is supported at least in Win32 and Qt. Don't remember about gtk2 Just substitute the Windows unit with the LCLIntf unit. You need latest subversion for this QuoteQuoteForm manipulation (Show, Hide, Transparent)Form transparency isn't supported (yet) Form (I think it works with any other control too!) transparency is supported via TWinControl.SetShape(ABitmat: TBitmap) and also via SetWindowRgn in Lazarus 0.9.27 QuoteDoes anyone knows where i can find a good resource (site, file, forum) with information about that for Lazarus programming in Ubuntu or Linux? I have searched the forum here but i haven't found anything helpful. We are writing a book about Lazarus. It's in the final stages, but it will be in german. We are investigating if an english version will also be possible. ---------------------------------------------------------------------- Paul Ishenin · 2009-05-09 01:33 I think we are talking about different transparency. Shape can only clip control (form or any other) using mask. But semi-transparent windows are indeed not supported. ---------------------------------------------------------------------- xqtr · 2009-05-14 20:38 QuoteShowWindow(FindWindow('Shell_TrayWnd',Nil), SW_HIDE); See TTrayIcon, we have platform independent support for tray icons Actually the above command shows/hides the windows taskbar, it has nothing to do with the TTrayicon component. QuoteRegions and window transparency using them (SetWindowRgn) is supported at least in Win32 and Qt. Don't remember about gtk2 The problem is that in my (windows version) program i do not use these commands for the program it self, but for other windows programs. In windows you can make transparent every application you want via the WinAPI. But as i understand from a previous answer, this is not possible in linux.  QuoteForm (I think it works with any other control too!) transparency is supported via TWinControl.SetShape(ABitmat: TBitmap) and also via SetWindowRgn in Lazarus 0.9.27 Same as above. QuoteWe are writing a book about Lazarus. It's in the final stages, but it will be in german. We are investigating if an english version will also be possible. I think the biggest disadvantage of Lazarus is the lack of documentation, especially in linux. And i dont mean documentation about explaining the IDE or the pascal language (you can read a Delphi book for these), i mean that there are no good tutorials on how programing in linux. If anyone has material for this please let me know. Thanx.