Jump to content

RTollison

Members
  • Content Count

    103
  • Joined

  • Last visited

Everything posted by RTollison

  1. 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.
  2. 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
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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;
  8. 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.
  9. RTollison

    Need to convert varbinary to hex string in a dll

    by the way thanks this has solved my problem and i am continuing on with my dll. i used the mybintohex solution.
  10. RTollison

    Need to convert varbinary to hex string in a dll

    this is from another partys file. (micro focus acucobol) they have a lock file that will let me know what record id is in use already. via a sample program that is using said lock table as a vision file (non sql which we do not do because we wanted all tables to sql if possible) they have an example program that uses this to convert the data to hex format for display purposes. if i could get the raw varbinary data thru the dll i am writing then i could do the same thing. perform varying idx from 1 by 2 until idx > 244 call "ascii2hex" using lockfile-keyvalue(idx:2), list_keyval(2 * idx - 1:4) end-perform the library routine ascii2hex ASCII2HEX converts binary data to its hexadecimal format. This routine is the inverse of the HEX2ASCII routine. Usage CALL "" USING ASCII-VALUE, HEX-VALUE Parameters ASCII-VALUE PIC X(2) The input data area containing the ASCII representation of a unit of data. HEX-VALUE PIC X(4) The output data area to contain the hexadecimal value. When you define the parameters, use the exact field sizes specified in the calling conventions above, otherwise the runtime may terminate abnormally.
  11. RTollison

    Need to convert varbinary to hex string in a dll

    this is what i did to get the odd ball 2nd row but i am concerned that i might be overlooking something that could cause it to not be correct... function bintoAscii(const bin: array of byte): AnsiString; var i: integer; begin SetLength(Result, Length(bin)); for i := 0 to Length(bin)-1 do Result[1+i] := AnsiChar(bin); end; function bintostr(const bin: array of byte): string; const HexSymbols = '0123456789ABCDEF'; var i: integer; begin SetLength(Result, 2*Length(bin)); for i := 0 to Length(bin)-1 do begin Result[1 + 2*i + 0] := HexSymbols[1 + bin shr 4]; Result[1 + 2*i + 1] := HexSymbols[1 + bin and $0F]; end; end; ..... _KeyValue := bintoAscii(dmspCreate.adsAcuLocks1.FieldbyName('KeyValue').AsBytes); if (_keyValue[1] = #0) then _keyValue := bintoStr(dmspCreate.adsAcuLocks1.FieldbyName('KeyValue').AsBytes);
  12. RTollison

    Need to convert varbinary to hex string in a dll

    the sql column has this info 0x303031323030363130300000000000 0x000000036100000000000000000000 0x303031323030363130303031000000 by using the bintohex it works on the first and third row but the 2nd row is coming back blank. the info after 0x is exactly what i want to get back in my cobol program. as long as it looks like the string shown.
  13. RTollison

    Need to convert varbinary to hex string in a dll

    My dll is being called by a cobol program(acucobol) if i try to pass back the binary (stdcall) it thinks i am null terminated for 0x0000000361000000000000 the 00 comes back null and my string is blank in my cobol program
  14. I have an ADOQuery that gets changed based upon user selection. when it changes to a distinct option i get an error saying adoquery.field.app not found. But if i take the command text and paste it into sql query and run it i get the results that i need. In my form, comparing to a very old version of the form i see these lines added ADOQuery1id: TStringField; ADOQuery1app: TStringField; ADOQuery1version: TStringField; ADOQuery1Patch_Version: TStringField; ADOQuery1Patch_Level: TStringField; when i remove those lines from the form and try to compile i get an error 'Class TStringfield not found' but in my uses i have the Data.DB added. The query is tied to a datasource that is tied to a smdbgrid. I know the query is correct, but i suspect that since those fields were added to the form it is wanting to reference them or something.
  15. Never mind found a solution. use the view as text and saw the fields defined in there and removed them all and now it compiles and runs correctly.
  16. I have a listview on a form that is sizable. i hard coded 5 columns to it but when different users with different monitors, laptops the columns overlap the text. is there a way to detect when text overlaps and then i could reduce the number of columns and refresh the listview. the text that is displayed is file names but depending on the users that info could be longer than the others. i would rather not hard code the # of columns but i don't know when to trigger the increase/decrease the number of columns.
  17. RTollison

    ListView Multiple Columns overlapping text

    Never mind i just went with a specific width for columns of 150. livstview.width div 150 = number of columns. so far everyone seems to be happy with it.
  18. RTollison

    jvmail, outlook 365, delphi 10.2

    i have an app I built a while back that i used to test whether a workstation with outlook installed could send and email using the JvMail from JEDI. back in November 2019 I know it worked on my workstation with Outlook 365. Now when i try to send a test email i get in my outlook an email from system administrator saying None of your email accounts could send to this recipient . Now it doesnt try to send the email directly it will open up an outlook message window which has all the info on it and all i do is click the send button. So i am not bypassing outlook to send the message. currently when the outlook message window opens up i see my recipient name all spelled out 'roy.tollison@....' but if i delete that and retype it then it changes to the way my recipient name is normally 'Roy Tollison' and i can send it and it works. any ideas as to why it won't send it when it is showing my recipient name all spelled out versus deleting it and re-typing it?
  19. RTollison

    jvmail, outlook 365, delphi 10.2

    Found the issue from an old post. pre-fix the recipient with SMTP:
  20. RTollison

    Creating ActiveX

    I am needing to create an activex component. the example that i have found just is very basic to the point of not getting an understanding of how to add more features/options. basically i purchased an activex component back around 2004, the company that sold it no longer sells the activex component. however, i have purchased their vcl component set. its an activex grid. i can use the BDS wizard for creating an activex component starting with the grid but it doesn't have any bands, columns or any exposed functions/procedures that i can access. would like to add a memory dataset for it to have available to use and anything else that i might think is useful. any ideas as a good example about creating an activex component and exposing some functions/procedures/whatever? (DEVEXPRESS Quantum Grid)
  21. RTollison

    Creating ActiveX

    1) We are not changing cobol vendors as we have over 5K cobol programs and over 1200 clients. 2) We already changing over to C# development 3) This changeover process takes time. 4) Windows is updating/changing version 10 5) ACTIVEX controls that we use in our cobol programs are from 2000 era a) We have already ran into some minor issues related to the ACTIVEX controls and Windows 10 and we got a workaround going 6) I would like to reproduce the ACTIVEX control using Delphi 10.2 in hopes of it not having the same issues as the current ACTIVEX does (the control was invisible until we turned DEP off, workaround) 7) We have purchased all of the devexpress vcl library with hopes of it helping to create a new ACTIVEX to replace the old one. (A BIGGER job than it first seemed) 8 ) I have imported the old REGISTERED ACTIVEX library and created a unit *_TLB.pas and was hoping i could use it in the creation of a new ACTIVEX control with ALL the same names/features. (NO REWRITING of cobol programs) 9) Apparently no easy way to create new ACTIVEX ridl from the *_TLB.pas unit created from the import.
  22. RTollison

    Creating ActiveX

    by using the "Import Component" i can get the *_tlb.pas file and was wondering if i can use that in ANY way to help with the creation of an updated activex project?
  23. RTollison

    Creating ActiveX

    i have purchased the activex of the devexpress quantum grid. when needing to get an updated version of the activex grid control, i found out they no longer support activex components. so i purchased the dev express component suit for everything VCL. We use the activex grid inside of acucorp acucobol. we have looked at other activex grid components on the market but that would mean we would have to change all our cobol programs to use the new activex grid component. at this point i am having some issues with registering/using the activex grid with windows 10. i get it to work correctly with use of an admin registering the component. i am concerned about it with regards to any new updates to win 10 that might cause it to not work. i was hoping ("wishing") it would be an easy process to use something/anything from the old activex to create a new activex component with the updated vcl components. after doing some reading of an old book "Delphi Programming with COM and ACTIVEX" i finally got it thru my thick skull that skipping to the part about creating activex controls chapter is not the way to go. I am finally understanding that you have to learn how to create the vcl component with all the whistle and bells before trying to create the activex component. so now i am reading from the beginning (how to create vcl components) and maybe i can get a better understanding of creating and activex component.
  24. i have a project that i am in the beginning stages of. I have a dll that can do Merge Fields for RTF documents (devexpress). now i am working on getting data to the dll in question. My calling program will have to send the merge data in an XML format, format not determined just yet. in my dll what would be a good simple way to load the data up into whatever so i can run the merge function of the richeditcontroller. needs a datasource and a dataset. how to get the xml information into a dataset/datasource object? Just looking for ideas/pitfalls/whatever in getting xml data into dataset, anything is on the table since i haven't started yet.
×