I'm building a DLL which contains whatever might be needed to prepare a delphi 7 app for Windows 7's special effects, such as drawing glass, minimizing forms properly to the taskbar, bringing modal forms to front (as they tend to get hidden quite often), and placing a green progress indicator in the form's taskbar icon. I'm putting this into a DLL to keep for future redistributable support to keep delphi 7 applications compatible with windows 7 (and vista for that matter). I want other coders to be able to use it without seeing how everything works, as well as keep the host app's file size to a minimal, because all this functionality can be shared.
The problem is I haven't touched a DLL in forever, and I'm still not that comfortable with them. I need to make sure I'm doing this right...
Now the first issue I have is whether I will need the ShareMem. I want to avoid it as much as possible, but I need to make sure my exported functions are compatible. Obviously I can't pass objects if I'm not using ShareMem, so I pass handles (HWND) instead. But should I publish it as HWND or another type? And should it be a const, var, or neither, or does that matter?
Another problem is that it's using ComObj, which requires me to use CoInitialize. But, no matter where I put CoInitialize, it keeps giving me an error that CoInitialize hasn't been called (which I clearly do call it). I wound up moving it to the initialization and finalization sections. Still doesn't work there either, but in a DLL, is this a safe place to put any code?
Next, I have a clash between two functionalities here: The swapping of the application's 'hidden' form messes up the progress indicator in the taskbar icon. Both of them relate to the taskbar icon, but if the app's secret form gets swapped, then the progress indicator doesn't work.
Another thing, there was no help at the source where I got the taskbar/progressbar code. This code won't allow using it on multiple forms - it presumes it's always going to be Application.Handle. I tried to convert it, but got lost. It works only when you don't swap out the app's secret form with the main form.
And finally, I'd like to be able to change a form's color from within the DLL - using only the form's handle (or the form's canvas handle?). I presume I will need to create a TCanvas within the DLL and fill it with the desired color (for glass transparency). I need to make sure this is safe.
(Will be posting the code in next couple posts)
JD Solutions
The problem is I haven't touched a DLL in forever, and I'm still not that comfortable with them. I need to make sure I'm doing this right...
Now the first issue I have is whether I will need the ShareMem. I want to avoid it as much as possible, but I need to make sure my exported functions are compatible. Obviously I can't pass objects if I'm not using ShareMem, so I pass handles (HWND) instead. But should I publish it as HWND or another type? And should it be a const, var, or neither, or does that matter?
Another problem is that it's using ComObj, which requires me to use CoInitialize. But, no matter where I put CoInitialize, it keeps giving me an error that CoInitialize hasn't been called (which I clearly do call it). I wound up moving it to the initialization and finalization sections. Still doesn't work there either, but in a DLL, is this a safe place to put any code?
Next, I have a clash between two functionalities here: The swapping of the application's 'hidden' form messes up the progress indicator in the taskbar icon. Both of them relate to the taskbar icon, but if the app's secret form gets swapped, then the progress indicator doesn't work.
Another thing, there was no help at the source where I got the taskbar/progressbar code. This code won't allow using it on multiple forms - it presumes it's always going to be Application.Handle. I tried to convert it, but got lost. It works only when you don't swap out the app's secret form with the main form.
And finally, I'd like to be able to change a form's color from within the DLL - using only the form's handle (or the form's canvas handle?). I presume I will need to create a TCanvas within the DLL and fill it with the desired color (for glass transparency). I need to make sure this is safe.
(Will be posting the code in next couple posts)
JD Solutions