Jump to content

alank2

Members
  • Content Count

    176
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by alank2

  1. alank2

    ProcessMessages doesn't seem to update controls

    The Sleep(x) is just a replacement for some other process that will keep execution in a method. The workflow is something like this: User clicks a button. I want to disable all buttons while this process runs so they are unable to click any of them, so I change them to disabled. Then I want to make sure that the screen is updated before I call whatever it is that may take seconds to run. Previously I could just set them to enabled=false and call ProcessMessages() once and it would update properly. I realize that putting the "seconds to run" is more ideal in a thread, but that adds creating and managing a thread which I don't want to have to do for every process that takes a few seconds. Essentially I am looking for a function that will make sure the UI is fully updated before a period of time where it won't be updated. I tried using calling Repaint for all 3 buttons before a ProcessMessages, but it didn't work. Whatever is different between versions, perhaps changing a property from true to false takes a number of things to occur in sequence that rely on each other?
  2. alank2

    ProcessMessages doesn't seem to update controls

    Thanks Remy; sometimes I have a synchronous process and I want to make sure some VCL elements are updated beforehand. This always worked fine in bcb6. What could cause the Enabled change to _not_ create an immediate pending message?
  3. I have them set to (left, top, width, height) 45, 80, 500, 320 in the form designer. I also have borderstyle=none, position=designed, but at runtime if I evaluate them they are 45, 80, 516, 358 so the width and height were altered by something. I remember a thing called scale for VCL, but I don't see it present in the FMX form. Any ideas why the width/height changed? Can I prevent it without forcing the width/height in the form constructor (which does work)?
  4. This is a very strange issue so I thought I'd see if anyone here has experienced anything similar: I have had a release of software at multiple locations, multiple systems, and never saw the error before 6/8 at any site including the site now having the problem (it was running fine there for months). 2023-06-08 02:02:16.879 ERROR: Unsupported media file myvideo.wmv (e020212) (ignore the e020212, this is my error code to locate where the error is) Then on 6/8 and after, at only one specific location, all of the computers at this location, are giving this error only when they restart their software at 2am. It will fail with the above exception. If you then restart it manually later on, it will load fine, only to repeat the same problem the next day.= at 2am. //prompt animation try { FScalePrompt->MediaPlayer1->FileName="c:\\programdata\\myprog\\myvideo.wmv"; } catch(Exception &exception) { swprintf(ws1, L"ERROR: %ls (e020212)", exception.Message.c_str()); DialogMessageBox(ws1); goto fail1; } Any ideas on why this exception would be thrown only at 2am when the software restarts itself and then not at other times of the day? The software is launched by another process and it is closing itself down fine according to the log: 2023-06-08 02:01:46.942 Exiting 2023-06-08 02:02:13.473 Starting 2023-06-08 02:02:16.879 ERROR: Unsupported media file scaleitem.wmv (e020212)
  5. If I create a new DLL, it prompts me with a dialog that allows me to set these things: Can you change these settings/target framework on an existing project? If so, where?
  6. That is what I wondered; thanks for posting - I too use Beyond Compare, it is great!
  7. So as a test I tried to set a TEdit to a UTF-8 sequence and it ended up as a series of characters and not the smile face I was testing. If I convert it first to a wide string and then assign the wide string it works: MultiByteToWideChar(CP_UTF8, 0, "\xf0\x9f\x98\x82", -1, ws1, 1024); Is there a way to make it recognizing a narrow string assignment as UTF-8 - some sort of code page setting in the application maybe? or will it not do that?
  8. alank2

    Assigning UTF-8 to a control

    Thank you; I'll check it out!
  9. alank2

    Assigning UTF-8 to a control

    Thanks for the advice. On Friday I discovered an unexpected thing with sprintf/swprintf that string conversion from narrow to wide and vice versa uses a buffer that is limited to 512 bytes. I traced this down to the source code (in vprinter.c) to see that that is what it is doing. I typically think of sprintf/swprintf as commands as being designed to emit data directly as to not be limited by a buffer size, but clearly that isn't the case. Trying to convert a larger string will corrupt a program from a buffer overrun. Why they didn't just code it to do a simple bufferless conversion in place does not make sense to me, especially since they aren't really properly converting between UTF-8 and UTF-16 anyway, but it is what it is. I found the WIN32 API functions MultiByteToWideChar and WideCharToMultiByte, but at the same time I've been thinking about how I can better handle string conversion and variable width strings in general to support UTF-8/UTF-16 better.
  10. alank2

    Assigning UTF-8 to a control

    C++ Builder
  11. alank2

    Assigning UTF-8 to a control

    I suppose anywhere; I just wondered if you could assign a char* string that is UTF-8 and have it recognize it that way.Insert other media
  12. I've been using: unsigned char data[]={ 255,216,255,225,7,132,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,12,1,0,0,3,0,0,0,1,1,144,0,0,1,1,0,3,0,0,0,1,1,11,0,0,1,2,0,3,0,0,0,3,0,0,0,158,1,6,0,3,0,0,0,1,0,2,0,0,1,18,0,3,0,0,0,1,0,1,0,0,1,21,0,3,0,0,0,1,0,3,0,0,1,26,0,5,0,0,0,1,0,0,0,164,1,27, 0,5,0,0,0,1,0,0,0,172,1,40,0,3,0,0,0,1,0,2,0,0,1,49,0,2,0,0,0,31,0,0,0,180,1,50,0,2,0,0,0,20,0,0,0,211,135,105,0,4,0,0,0,1,0,0,0,232,0,0,1,32,0,8,0,8,0,8,0,10,252,128,0,0,39,16,0,10,252,128,0,0,39,16,65,100,111,98,101,32,80,104,111,116,111,115,104, ... }; But it is a large amount of data and I wonder if there is a better way?
  13. Thanks everyone; I'll give the RCDATA thing a try and see how well it works for me.
  14. I am trying to get the programdata folder. I've been using: cppbuilder 10.3.3 LPITEMIDLIST pidl SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_APPDATA, &pidl) SHGetPathFromIDListW(pidl, APath) This works fine in a VCL application, but a FireMonkey application, none of it is recognized. I tried to include <shlobj_core.h>, but this gives 1500+ warnings about the below and then fails. [bcc32 Warning] shobjidl_core.h(26477): W8026 Functions with exception specifications are not expanded inline Full parser context mycode.cpp(33): #include c:\program files (x86)\embarcadero\studio\20.0\include\windows\sdk\shlobj_core.h shlobj_core.h(86): #include c:\program files (x86)\embarcadero\studio\20.0\include\windows\sdk\shobjidl_core.h shobjidl_core.h(26477): decision to instantiate: ACTIVATEOPTIONS |(ACTIVATEOPTIONS,ACTIVATEOPTIONS) throw() --- Resetting parser context for instantiation... I was using this function because this code has to run on some older compilers, but if I can't get it to work I can use something else.
  15. alank2

    SHGetSpecialFolderLocation in FireMonkey

    Thank you - I disabled the warnings and that did solve the problem: #pragma warn -8026 #pragma warn -8027 #include <shlobj_core.h> #pragma warn .8027 #pragma warn .8026 I like that better than my other approach.
  16. alank2

    SHGetSpecialFolderLocation in FireMonkey

    I found this page: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Standard_RTL_Path_Functions_across_the_Supported_Target_Platforms And then found this: UnicodeString us; us=System::Ioutils::TPath::GetPublicPath();
  17. I have a project that builds a DLL and I have two different .DEF files (one for WIN32, and for WIN64). I want to avoid making two projects and so I've been removing/adding the correct .DEF file before I build that platform, is there a better way?
  18. Interesting - I was reading the differences page and this came up: Clang-enhanced C++ compilers do not allow the use of sizeof in a preprocessor directive, such as #if sizeof(ATypeName) > 20. How can one then test for sizes if this is not an option - is there a workaround/alternative method?
  19. Three? clang classic What else?
  20. Yes, that is exactly what I am trying to do. >Can you confirm that you are using the clang32 compiler for your 32bit code (if not then first thing to try is to use the clang32 compiler - maybe it's name mangling will be the same as the clang64 (I haven't checked this)). I am using the classic compiler, I just have more experience with it so I stick with it. I would think the clang compiler would still mangle/underscore the names for 32-bit code.
  21. I still have some projects in the old bcb6 that I need to compile sometimes. One thing I noticed is that if I create a new win32 console mode application, it doesn't let me replace main; int main(int argc, char* argv[]) With wmain: int wmain(int argc, wchar_t* argv[]) In cppb10 there is an option _TCHAR maps to where you can select char or wchar_t and this seems to clue the linker in to look for main or wmain. Is there an equivalent option for bcb6? (for anyone who remembers this old compiler!) I tried looking in the compiler/linker settings, but I am missing it or it doesn't exist.
  22. alank2

    old BCB6 question about wmain

    Thanks for checking! I found the option -WU mentioned in the help and it works at the command line, but putting it in CFLAG1 in the BPR file did not accomplish anything.
  23. Sorry Remy; I saw the "General Help", but didn't look at its parent folder. I appreciate the help.
  24. No, it comes up with an error: [ilink32 Warning] Warning: Attempt to export non-public symbol 'CCfgClassNew' The problem is that 32-bit mangles the name with an underscore and 64-bit does not, which is why I am using the DEF file to unmangle the 32-bit version of the DLL so it and the 64-bit version have consistent names. ALSO, one more odd thing. if the DEF file changes in any way, this error is produced when trying to build: [ilink32 Error] Invalid command line switch for "ilink32". Parameter "ItemSpec" cannot be null. The way to fix it is to remove the DEF file and add the DEF file back again, then it will build without the error.
  25. Everyone, maybe I should have specified C++Builder. The DEF files are for compiling two different versions, 32-bit and 64-bit DLL's. 32-bit version top two lines: EXPORTS CCfgClassNew=_CCfgClassNew 64-bit version top two lines: EXPORTS CCfgClassNew=CCfgClassNew The 64-bit lacks the underscore, my goal here being to produce a DLL that uses the same name for the function no matter whether it is 32-bit or 64-bit. I want to access it as CCfgClassNew either way. Maybe there is no way to do this in a DEF file and I have to do different projects.
×