Jump to content

RTollison

Members
  • Content Count

    44
  • Joined

  • Last visited

Everything posted by RTollison

  1. RTollison

    converting string to date time

    I have a string in an odd format and am needing to change to datetime format. <DateTime>2021-06-25 08:04:09</DateTime> strtodatetime wants the date to be dd/mm/yyyy time is there a strtodatetime that uses a formatdatetime option?
  2. RTollison

    converting string to date time

    thank you, i really appreciate the help.
  3. i have this routine to get the active window, that may have multiple buttons at various places on the parent window. when they user click on a button then i am calling a dll that currently tries to center itself on the parentwindow BUT i am needing to know if it is possible to get the rectangle coordinates of the button that actually got pushed. here is my current lines for gathering the window rectangle. ParentWindowHandle := GetActiveWindow; GetClientRect(ParentWindowHandle, Rect); is there a way to determine the button that was pushed and it location relative to screen so i can popup my control where the button is located and not in the center?
  4. Yeah the screen center seems ok for our clients and they can see the calendar popup pretty easy. when calling the dll we pass in a date that it will move the calendar to that date and when the user selects a date and clicks an OK button it sends the value back to the cobol program. pretty simple stuff. as for a mouse click not always used some users just use keyboard and are very adapt at using it. the buttons do not have a tab stop. the date field is the tab stop. like i said center of screen is fine, mgmt just asked if possible to put by button without a lot of effort and verification that it works in all situations. So thank you all very much.
  5. the GetFocus actually worked great but after i started testing the cobol programs and where it would pop up, it won't work out to well. some of our report type programs have these push-buttons at the bottom of the screen but the focus is at the top field on the screen. so as a user i could not want to change anything other than a date or multiple dates and just push the button at the bottom of the screen but the popup calendar is at the top. i checked if there was a way to force the focus to the button when pushed and there is not an option for down only that the button was clicked after the fact event. So i will do more thinking on this but in the mean time leave it as center of activewindow.
  6. i haven't tried it yet but i will do so today.
  7. i apologize for the lack of details. no excuses. i have been down this road to many times. was just wishing for a quick command like the getactivewindow but for a window control. even did a search for getactivewindow hoping some article would mention any info related to getting the control. Thats when i posted here doing the wish stuff for another command from people that would know. FYI my current dev language is COBOL and i have to tie into it for anything outside of it, such as this calendar dll. the original one was hokie and dated, so i created a new one that followed the parameters and decided that centering on the form was better than the main screen. that is when i was asked if we could popup at the button that was pushed. now we are here and i am going with not possible with 100% results.
  8. anything about the button is not available to me. the button click (not delphi) basically says call dll that will popup on the screen and allow user to select a date from a calendar. so my dll is only thing i have available to change. the original dev just created the popup calendar to be in center of the main screen which was ok since multi-screens weren't widely available. but then i got tasked with updating it and at the time the best i could do was the center of the active window. now i was asked IF i could change it and i said i would see what i could do. And so far it is not looking good.
  9. unfortunately no not in control of the source window. it used popup in the middle of the screen and i changed it to get the active window and put it in center of it, which is kind of odd since the button sometimes is near the bottom of the window.
  10. RTollison

    null terminated string array

    i am needing to update a null terminated string array. currently i have it in a string like this: one#0two#0three#0four#0#0#0#0#0#0#0#0#0#0.... i am needing to add five and six into the string but str := str + 'five' + #0 + 'six' + #0; doesn't actually work. what would i need to do to get the string from one#0two#0three#0four#0#0#0#0#0#0#0#0#0#0 to one#0two#0three#0four#0five#0six#0#0#0#0#0#0
  11. RTollison

    null terminated string array

    i am on 10.2 and i used Remy's suggestion for cleaning of the string/stringlist then now when i set the registry value it and check it with regedit it doesn't warn me about the empty values. So everything seems to working at this point and will be getting sent over to some QA people to try and break it.
  12. RTollison

    null terminated string array

    i got it all separated out into the stringlist and what looks to be a clean string with null separated values when I am trying to write to the registry (RegSetValueEx) but its after that and i run regedit and open the functions value to look at the info that it throws a warning about empty strings.
  13. RTollison

    null terminated string array

    haha i wouldn't take any bets on that. but thank you.
  14. RTollison

    null terminated string array

    here is what i currently have in place it all seems to run without errors/issues BUT when i run the regedit to verify the updated values I get a warning from the registry Data of type REG_MULTI_SZ cannot contain empty strings. Registry Editor will remove all empty strings found. I don't see any extra lines but it pops the first time around and after it saves it then reopen it looks the same but no warning message. reading of the registry and evaluating if two other values are needed or not. iType := REG_MULTI_SZ; // Type of data that is going to be read if RegQueryValueEx(hOpenKey, 'Functions', nil, @iType, PByte(sha_str), @iSize) = ERROR_SUCCESS then begin Edit11.Text := stringreplace(copy(sha_str,0,Pos(#0#0,sha_str) + 1),#0,',',[rfReplaceAll]); strlist.DelimitedText := Edit11.Text; for i := strList.Count - 1 downto 0 do if strList = '' then strList.Delete(i); if Pos('RSA/SHA512',sha_str) = 0 then begin cxCheckBox6.Checked := True; strList.Append('RSA/SHA512'); end; if Pos('ECDSA/SHA512',sha_str) = 0 then begin cxCheckBox6.Checked := True; strList.Append('ECDSA/SHA512'); end; sha_str := ''; sha_str := StringReplace(strList.DelimitedText,',',#0,[rfReplaceAll])+#0; end else cxCheckBox6.Checked := True; RegCloseKey(hOpenKey); end then writing of updated value if needed begin SetLength(sha_str, Length(sha_str) - 1); tname := dir + 'SHA512_Default' + _dt + '.reg'; RegistryExport(tname,'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010003'); CleanUpExport(tname,'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010003', 'Functions'); if RegCreateKeyEx(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010003', 0, nil, REG_OPTION_NON_VOLATILE, KEY_WRITE, nil, hOpenKey, pdI) = ERROR_SUCCESS then begin RegSetValueEx(hOpenKey, 'Functions', 0, REG_MULTI_SZ, Pointer(sha_str), Length(sha_str)*sizeof(Char)); end; end;
  15. RTollison

    null terminated string array

    i am stumbling along on this one. i have the same thing in place for updating numbers and string but when i got to this one i am flying blind and just winging it. so after googling around i came across this example for reading but the writing was just as simple by setting the string manually to 'one'#0'two'#0'three'#0'four'#0'five'#0'six'#0; so i am trying figure out how to take what is there and if necessary to add to the string/whatever and then write it back to the registry.
  16. RTollison

    null terminated string array

    sha_str : string; sha_str := ''; if RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010003', 0, KEY_READ, hOpenKey) = ERROR_SUCCESS then begin iSize := 0; if RegQueryValueEx(hOpenKey, 'Functions', nil, @iType, nil, @iSize) = ERROR_SUCCESS then begin SetLength(sha_str, iSize - 1); strSize := iSize; end; iType := REG_MULTI_SZ; // Type of data that is going to be read if RegQueryValueEx(hOpenKey, 'Functions', nil, @iType, PByte(sha_str), @iSize) = ERROR_SUCCESS then begin that is how i got to this point...
  17. RTollison

    null terminated string array

    yeah its a windows string i am getting it from the registry REG_MULTI_SZ and i read it into the string in question then i need to update it and write it back to the registry. i was hoping that i didn't have to manually manipulate the string or anything like that. was hoping for as simple of a way to get the string updated and pushed back. Thanks.
  18. function CopyFileIFileOperationForceDirectories(const srcFile, destFile : string) : boolean; //works on Windows >= Vista and 2008 server var r : HRESULT; fileOp: IFileOperation; siSrcFile: IShellItem; siDestFolder: IShellItem; destFileFolder, destFileName : string; pbc : IBindCtx; w32fd : TWin32FindData; ifs : TFileSystemBindData; begin result := false; destFileFolder := ExtractFileDir(destFile); destFileName := ExtractFileName(destFile); //init com r := CoInitializeEx(nil, COINIT_APARTMENTTHREADED or COINIT_DISABLE_OLE1DDE); if Succeeded(r) then begin //create IFileOperation interface r := CoCreateInstance(CLSID_FileOperation, nil, CLSCTX_ALL, IFileOperation, fileOp); if Succeeded(r) then begin //set operations flags r := fileOp.SetOperationFlags(FOF_FILESONLY OR FOF_NORECURSION OR FOF_NOCONFIRMATION OR FOFX_NOMINIMIZEBOX); if Succeeded(r) then begin //get source shell item r := SHCreateItemFromParsingName(PChar(srcFile), nil, IShellItem, siSrcFile); if Succeeded(r) then begin //create binding context to pretend there is a folder there if NOT DirectoryExists(destFileFolder) then begin ZeroMemory(@w32fd, Sizeof(TWin32FindData)); w32fd.dwFileAttributes := FILE_ATTRIBUTE_DIRECTORY; ifs := TFileSystemBindData.Create; ifs.SetFindData(w32fd); r := CreateBindCtx(0, pbc); r := pbc.RegisterObjectParam(STR_FILE_SYS_BIND_DATA, ifs); end else pbc := nil; //get destination folder shell item r := SHCreateItemFromParsingName(PChar(destFileFolder), pbc, IShellItem, siDestFolder); //add copy operation if Succeeded(r) then r := fileOp.CopyItem(siSrcFile, siDestFolder, PChar(destFileName), nil); end; //execute if Succeeded(r) then r := fileOp.PerformOperations; result := Succeeded(r); OleCheck(r); end; end; CoUninitialize; end; end; when i issue the command to copy, it copies all of the subfolders when all i want it the specified folder only. CopyFileIFileOperationForceDirectories('c:\dir1', 'd:\dir1') it shows the copying of c:\dir1 to d:\dir1 but then when that is done it shows to be copying c:\dir1\subdir1 and all of its files. i only wish to copy the directory and none of the subfolders
  19. Is there a way to load up the email and user name fields after it is open or do i need to push it all at once. current opening up a chat with web url using the users default web browser that looks like this http://chat.company.com/WebChat/Main.aspx?QueueName=Que_001 when it opens up the user then enter the email and user name box and clicks on a submit button. the Que_### changes depending on the app the user has open and that part i have but now i am asked to see about autofilling the email/name fields. as for clicking the submit button or not that is for a later phase of project.
  20. with my registry edit program in place and working, a user ask if i could set the default one that is not "OPEN" here is the structure of the registry entries abc_auto_file shell option 1 command option 2 command option 3 command Is there a way to have option 3 be the default and not option 1. is there a way to have the option NOT be sorted. like have option 3 as the top one. I have done searches and found default for file type but nothing for my situation. i would like to allow users to decide the order and which one is default to when just double clicking a file type.
  21. RTollison

    Delphi Registry entries default...

    That worked but with a caveat the "option #" registry name cannot have spaces in them. you name them without spaces but in there default you show the name you want to display. abc_auto_file shell (Default) "option_3" option_1 (Default) "Option 1" command option_2 (Default) "Option 2" command option_3 (Default) "Option 3" command Remy, I see your posts all over the place and just wanted to say thanks for all you do.
  22. I am writing up a program to allow users to update/add to registry entries. the registry is for ABC_Auto_File and has different options not just open... I have it up and working but am curious of a better way to parse the info in the registry string. examples of the string in question are: "c:\my folder\myapp.exe" -c "c:\my folder2\myconfigfile" "%1" c:\folder\myapp -c c:\folder2\myconfigfile %1 c:\folder\myapp %1 the -C is there 99.99% of the time but sometimes users have it working without it. but i will be add it in when updating the registry. like wipe and rewrite. myapp is consistent but may include the .exe. current i am removing all the " and %1 the look for the -c anything prior is a string value i want and anything to the right is a sting value i want. i am currently using the copy/pos commands to get that info but am ALWAYS curious if someone has better option for parsing.
  23. i have a function that i am unable to solve. Tried array of ansichar but still no luck and i am at a loss on how to resolve. If I need to rewrite it then so be it but i cant find any examples of delphi and devicecapabiliesA. getting errors on the DeviceCapabilitesA function. [dcc32 Error] uiDevMode.pas(64): E2010 Incompatible types: 'PAnsiChar' and 'array[0..255] of Char' [dcc32 Error] uiDevMode.pas(72): E2010 Incompatible types: 'PAnsiChar' and 'array[0..255] of Char' function PrinterFormExists(FormName: string): boolean; var Device: array [0..255] of char; Driver: array [0..255] of char; Port: array [0..255] of char; DeviceHandle: THandle; PaperNames: Pointer; i: integer; PaperTypes: TStrings; PaperCount: integer; begin {$R-}// Range checking off. Result := False; PaperTypes := TStringList.Create; try // First get the number of paper names available. Printer.PrinterIndex := Printer.PrinterIndex; Printer.GetPrinter(Device, Driver, Port, DeviceHandle); PaperCount := DeviceCapabilitiesA((Device), Port, DC_PAPERNAMES, nil, nil); if PaperCount > 0 then begin { Now allocate the array of paper names. Each paper name is 64 bytes. Therefore, allocate PaperCount*64 of memory. } GetMem(PaperNames, PaperCount * 64); try // Retrieve the list of names into the allocated memory block. if DeviceCapabilitiesA((Device), Port, DC_PAPERNAMES, PaperNames, nil) = -1 then raise Exception.Create('DevCap Error'); // Add the paper names to the appropriate list box. for i := 0 to PaperCount - 1 do PaperTypes.Add(Uppercase(Trim(StrPas(TPNames(PaperNames^))))); finally FreeMem(PaperNames, PaperCount * 64); end; if PaperTypes.IndexOf(UpperCase(FormName)) > -1 then Result := True; end finally PaperTypes.Free; end; {$R+}// Range checking back on. end;
  24. i am writing a dll the returns a pansichar value but on the sql table it is a varbinary of the hex value 0x3030313230303631303000 i need to return that thru the dll as a hex string of 3030313230303631303000 then in my calling program i can convert it from hex to ascii string if it is possible to convert it to ascii string in the dll that is fine but i am not sure how to convert it in the dll from varbinary to anything usable at this point.
×