Jump to content

PawelPepe

Members
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

1 Neutral

Technical Information

  • Delphi-Version
    Delphi Community Edition

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. PawelPepe

    Access to Dropbox/Google Drive/One Drive

    @David Schwartz Thank you for your comment. I have to say I don't know what you wanna tell me... Are you working for TMS Team? I almost bought it reading your post 😛 But no - I am not gonna spend so much money for it. I was looking for freee stuff not because I think paying for code is bad - but because I don't have money! Simple. I am sure TMS did great job and it works fine. @Harry Bego Yup, but that will only upload the file onto server... with no direct link to download. @Angus Robertson Good to know! Will check ICS stuff. To sum up, I think you are right. The best way is to use some commercial product (option not for me right now). Thanks.
  2. PawelPepe

    Access to Dropbox/Google Drive/One Drive

    Is it possible to use original client installed on user machine to uplad a file and get download link? For example call OneDrive.exe with some magic parameters?
  3. PawelPepe

    Access to Dropbox/Google Drive/One Drive

    Uh, it seems it is not easy issue. Thanks. Commercial solutions costs a lot! Thanks for tips... maybe there is some simple open source solution? -Pawel
  4. PawelPepe

    Access to Dropbox/Google Drive/One Drive

    Hi, I would like to ask you about some help with accessing Cloud Services like Dropbox / Google Drive / Microsoft One Drive. As far as I know, every Cloud gives access by some API. I want to be able to send a file (text file or Image file) into one of this services. Is that possible? I mean: 1. User launches my application 2. Loads an Image (for example bitmap.bmp) 3. Chooses Cloud service provider 4. Uploads file into cloud and generates download link I assume that user has full access to cloud service (has an account, password and all needed authorization data). Have any of you dealt with such an issue? Where can I find some help? Maybe some example code? Where to start? -Pawel
  5. PawelPepe

    Delphi Clipboard - WM_CLIPBOARDUPDATE (sent, but no changes)

    @Remy Lebeau It works! Thank you! @Brian Evans, @Kas Ob. Thanks for help!
  6. PawelPepe

    Delphi Clipboard - WM_CLIPBOARDUPDATE (sent, but no changes)

    @Remy Lebeau Yes, I will change it and create virtual CreateWnd() and DestroyWnd() methods (I read about it somwhere in StackOverFlow, I think). @Remy Lebeau @Kas Ob. I checked GetClipboardSequenceNumber(). Indeed, it is incremeneted when Clipboard change - but not in our situation, as Clipboard contents is not changing, only message is sent. EDIT: I see your answer, Remy - I think you may have right. Will have to test it more. If not, then will do some comparison. I will have to find some good way to compare last Clipboard Content and every next one. If it differs - make action - if not, ignore. Hmm, maybe I will write it into disk and calculate hash. -Pawel
  7. PawelPepe

    Delphi Clipboard - WM_CLIPBOARDUPDATE (sent, but no changes)

    @Brian Evans @Kas Ob. Thanks, good to know. Yes, I think I will have to think about some compare data system, to check if clipboard data really changed. @Attila Kovacs OK Captain! Here is a simple code that demonstrate the problem: unit Main_Form; interface uses ...; type TMainFrm = class(TForm) ... private procedure MESSAGE_WM_CLIPBOARDUPDATE(var Msg: TMessage); message WM_CLIPBOARDUPDATE; { Private declarations } public { Public declarations } end; implementation {$R *.dfm} uses ...; procedure TMainFrm.MESSAGE_WM_CLIPBOARDUPDATE(var Msg: TMessage); var Success : boolean; RetryCount : integer; begin Inherited; if ALLOW_WM_CLIPBOARDUPDATE = True then begin RetryCount := 0; Success := False; while Success = False do begin try Success := True; if (Clipboard.HasFormat(CF_PICTURE) OR Clipboard.HasFormat(CF_TEXT)) then begin // ACTION!!!! // Unfortunatelly, this is fired even when clipboard content not change - but message is received end; except on E: EClipboardException do begin Inc(RetryCount); if RetryCount < 3 then begin Sleep(RetryCount * 100); end else begin //raise Exception.Create('Cannot set clipboard after three attempts'); end end else begin //raise; // if not a clipboard problem then re-raise end; end; end; end; end; procedure TMainFrm.FormCreate(Sender: TObject); begin AddClipboardFormatListener(Handle); end; procedure TMainFrm.FormDestroy(Sender: TObject); begin RemoveClipboardFormatListener(Handle); end; -Pawel
  8. Hey, I have got a serious problem with detecting Windows Clipboard changes. I am trying to write simple application that detects clipboard changes and offers to user some actions. To make it work I capture the WM_CLIPBOARDUPDATE message (Of course, I first add listening options -> AddClipboardFormatListener(Handle); which I release when exiting the program -> RemoveClipboardFormatListener(Handle);). And it works. I respond when the clipboard has an image (Clipboard.HasFormat(CF_PICTURE)) or text (Clipboard.HasFormat(CF_TEXT)). BUT - apparently this message is sent when I run system services (even though the clipboard contents DO NOT CHANGE), e.g. Computer Management (compmgmt.msc) Event Viewer (eventvwr.msc) Performance Monitor (perfmon.msc) and probably other programs I don't know about. Why!!!!? That is, it only happens when the clipboard has some content (if it is empty, nothing happens). If it has text or an image or anything else - my application receives a message about changing the contents of the clipboard (which is in fact the same - nothing changes). Why do these services send WM_CLIPBOARDUPDATE? Or in other words - what to do to ignore this specific situation (i.e. I receive the message, but I don't want to react - because nothing has changed in the clipboard). Somehow I don't see anything in the Clipboard implementation in Delphi that would help me... Thanks for any help, -Pawel
  9. PawelPepe

    TTrayIcon (Hidden main window and second form)

    Thanks for help. I think I got it working now. I decided to create form and destroy it each time clipboard is updated. Relying on onShow and onActivate events was not good idea. -Pawel
  10. PawelPepe

    TTrayIcon (Hidden main window and second form)

    I am hiding and reshowing Form2 on each message. You are right! Again, you are right (I use default - Application.MainFormOnTaskbar := True). So, now it looks like this. Hiding: MainFrm.Hide; Showing: MainFrm.Show; Application.BringToFront(); Unfortunatelly, nothing has changed. Maybe I will prepare example test app to show what I have and what I want to achieve? I also tried to dynamically create Form2 and destroy it on each message (but I failed with my "animation" and modal window). -Pawel
  11. Hey, I am trying to write simple application that works with Windows Clipboard (capture Clipboard changes (WM_CLIPBOARDUPDATE) and do some actions. Application uses TTrayIcon component. So, I can hide main window in notification area. If user press Print Screen button or copy text into Clipboard my application do some actions. One of the features is to show user a message (with some description text, icon etc) when application is hidden in tray. I do not use TTrayIcon Balloon hint (it is not good for me). Instead, I created second form and display it when clipboard change its content. It works fine, when application main window is visible (on screen). I set some options in form OnShow event and do some animation (to slide from right screen corner) in OnActivate event. It is OK. When application main window is hidded there is a big problem! What I do: Form2.Show; -> OnShow And OnActivate events are fired. BUT, if I show form2 again (second, third time), only OnShow event is fired - OnActivate event is not working! WHY? I hide mainform to Tray: Application.ShowMainForm := False; MainFrm.Hide; ShowWindow(Application.Handle, SW_HIDE); And I show it using: MainFrm.Show; Application.ShowMainForm := True; ShowWindow(Application.Handle, SW_SHOW); Application.BringToFront(); -Pawel
  12. PawelPepe

    How to free TListView Objects (String)

    Remy Lebeau Thank you!!! It is working (first method) I will also try the second one. Thank you for very fast response and your knowledge. Best regards, -Pawel
  13. PawelPepe

    How to free TListView Objects (String)

    Hi, I got a problem with TListView and Data. It seems that I got memory leaks, because Data pointers are not released (if I understand it well). Let me show you what I do: Here is a simple TListView (LV_Data). I add few items to the list (Report Style) into 3 Columns. var i : Integer; ListItem : TListItem; PObject : PChar; for i := 0 to 3 do begin // Caption ListItem := AList.Items.Add; ListItem.Caption := 'My Caption' + '_' + Inttostr(i+1); // Language Name ListItem.SubItems.Add('Language' + '_' + Inttostr(i+1)); // User Name ListItem.SubItems.Add('User Name' + '_' + Inttostr(i+1)); // User Data Path PObject := StrAlloc(250); StrPCopy(PObject, 'PATH_TO_USER_DIRECTORY' + '_' + Inttostr(i+1)); ListItem.Data := PObject; end; As you can see, I also add "hidden" data (in this example a path to directory, as string). I can use it in program, without displaying it to user in listview. I can read it in simple way (for examle, in ListView OnClick event:) var sPath : string; if (LV_Data.Items.Count > 0) AND (LV_Data.ItemIndex <> -1) then begin sPath := StrPas(PChar(LV_Data.Items[LV_Data.ItemIndex].Data)); end; Everything works very nice... but, when I close program, I see there are some memory leaks. --------------------------- Unexpected Memory Leak --------------------------- An unexpected memory leak has occurred. The unexpected small block leaks are: 473 - 520 bytes: Unknown x 3 --------------------------- OK --------------------------- As far as I know, I have to free those List View Data bymyself. How to do this? procedure TMainFrm.LV_DataDeletion(Sender: TObject; Item: TListItem); begin if Item.Data <> nil then begin FreeMem(Item.Data); Item.Data := nil; end; end; Above code not working (why!?), got Invalid Pointer Operation. Could you please tell me how to free this data to avoid memory leak? Thank you in advance, -Pawel
  14. @FredS Thanks... Will try that magic. Many paremeters...
  15. Yup, I am sure there are many different methods. I can not use any that need to pass login data (user name,password). It seems the one I have (unfortunatelly in c) is the simplest. Ps: There is a simple way to do this without complication, just run explorer: ShellExecuteW(0, 'open', 'explorer.exe', PWideChar(AFileNameToRun), '', SW_SHOW); But, this can not send mail with default client... so the best is to run any app with normal user privileges.
×