Menu

Always on top feature and build help

Help
timmy1029
2023-04-27
2023-10-07
  • timmy1029

    timmy1029 - 2023-04-27

    Hi,
    I managed to build the application from source but I had to comment out this function

    static void RegisterInMRU(LPCTSTR sRegMRUPath) {}
    

    in FileExtensionRegistry.cpp because of issues with CString on line 212

    CString nextMRUEntry = CString((mruList.GetAt(mruList.GetLength() - 1) + 1));
    

    I'm not really sure what exactly the error is but it might be something to do with my build, I changed the target to windows 10. There are two actual error codes

      E0309 more than one instance of constructor
    

    and

     Error  C2440   '<function-style-cast>': cannot convert from 'int' to 'ATL::CString'
    

    But I highly doubt these are the actual error. It does not help that I am not familiar with CString or this whole codebase and coding style. I would love to hear some idea on what might be wrong here. I am using VS 2017 community edition. I don't think missing that function is going to effect my use case but it feels wrong.

    The reason I tried building the code was because I wanted the application window to be able to be always on top so I can use JPEGView to open reference pictures and work on other apps with the picture on top. I was able to achieve this by changing a few parameters on SetWindowPos in MainDlg.cpp on line 317, from HWND_TOP to HWND_TOPMOST and removing SWP_NOZORDER.

    
    

    It seems to be working just fine but I have no idea if this broke anything else. I would love the opinion of someone who know their JPEGView code to share their opinion on this if possible (and maybe even make Always On Top a config toggle somehow?).

    Thank you for reading my rambling, would appreciate your help. Have a nice day regardless.

     
  • timmy1029

    timmy1029 - 2023-04-27

    for some reason the last code line did not show up
    here it is

    ::SetWindowPos(m_hWnd, HWND_TOPMOST, m_monitorRect.left, m_monitorRect.top, m_monitorRect.Width(), m_monitorRect.Height(),
    SWP_NOCOPYBITS | SWP_NOACTIVATE | SWP_NOREDRAW);

     
  • timmy1029

    timmy1029 - 2023-04-28

    Update:

    I was able to compile with the function uncommented out, it turned it was a casting issue after all. All I had to do was cast after the + 1

    CString nextMRUEntry = CString((wchar_t)(mruList.GetAt(mruList.GetLength() - 1) + 1));
    

    Still don't know if this breaks functionality, seems dangerous with it dealing with the registry.

     

Log in to post a comment.