|
I have researched all of the items that you suggested. The biggest problem is not being able to post the code so you can see exactly what is happening. In a nutshell, it was described to me is that what happens is that the bitmap is read in and when we need to place a button's bitmap on the toolbar, we pass in the resource id of the button and the position the image is in on the bitmap. Basically, we have one bitmap file that contains about 40 images. When adding a button, we pass in the position the image is in and there is some code that I do not have access to that handles applying it. So, I tried to implement most of your suggestions. I called ExtractIcon to get the handle to the icon from the .exe file the user might choose, I created the ImageList, I called the AddIcon to add it. Here is gets a little sticky. From here, I call GetImageInfo to get the bitmap handle, then I tried to use the bitmap handle to apply the bitmap to the button. It doesn't work when I do this. What happens is that there is a function that does a CreateCompatibleDC, then does a GetObject with the handle to the bitmap, then does a SelectObject, if the SelectObject returns good, it does a BitBlt. The problem I have discovered is that the SelectObject returns 0x00000000 every time. The bitmaps placed on the toolbar the old way use LoadImage to get the bitmap handle. I use the GetImageInfo. But, in the end, it doesn't work. My biggest handicaps are I don't have access to all the code and I am forced to leave the way the other buttons are placed on the toolbars, I was told not to change that code. Am I screwed or what?????
|
|
|
|
|
CarpeDiem wrote:
I was told not to change that code. Am I screwed or what?
No, but you're deprived of a clean and easy way to do it - some poor maintenance programmer is gonna be cursing you all when the time comes to bring this code into the 21st century (i've been that poor sap...).
In any case, this is what you'll have to do: every time you add an icon, you'll need to re-create your master bitmap, making it slightly larger and then draw the icon onto it. Then you'll need to re-associate it with the toolbar.
I'm sorry i can't be more specific, but i don't know what your situation is - there are many ways this could be done. You can post some relevant code here, or email it to me privately, and i can give you some more specific tips.
Shog9
------
I hope I die naive - Paul Watson, Partners and their dreams
|
|
|
|
|
Hello,
How can I permanently set the splitter size? For example: Instead of the Left / Right view I have a split from left to right so I have a top and a bottom. I want the bottom view to always stay the same height even when the window is being resized.
I'm a newbie with splitters and am unsure how I can keep my bottom view set to a permanent height. I assume I should handle MainFrame WM_SIZE and somehow set the splitter location..
Any ideas?
Thanks,
Rob
|
|
|
|
|
try this:
CRect rect;
GetClientRect(&rect);
int x = rect.Width()/2;
Then set the width of your pane = x
Regards
|
|
|
|
|
Sorry, this isn't a solution to your problem
|
|
|
|
|
CSplitterWnd has methods for getting and setting the dimensions of static splitters: GetRowInfo , SetRowInfo , GetColumnInfo , and SetColumnInfo . In your frame WM_SIZE handler you can compute the size of the splitter and call one or more of these methods to set it. After you have the splitter(s) set the way you want, you have to call RecalcLayout() to update the splitter layout.
Software Zen: delete this;
|
|
|
|
|
Can someone please tell me how I can read a DWORD value from the registry and display it as a decimal. I registry API function that I have looked at seem only to be able to read a string value. Help with this is most appreciated.
- SAK
|
|
|
|
|
There are countless registry articles on CP, but here is a function I use:
DWORD CGlobalUtility::GetRegDWORD(HKEY hKey, CString cstrSubKey, CString cstrVar)
{
DWORD dwRetVal = 0;
DWORD dwTemp, dwSize = sizeof(DWORD);
HKEY phkResult;
if (RegOpenKeyEx(hKey, cstrSubKey, 0, KEY_QUERY_VALUE, &phkResult) == ERROR_SUCCESS)
{
RegQueryValueEx(phkResult, cstrVar, NULL, &dwTemp, (LPBYTE)&dwRetVal, &dwSize);
RegCloseKey(phkResult);
}
return dwRetVal;
};
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
oops. take out that CGlobalUtility stuff.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
For your case reading the value as a string is the best thing. Then all you need is to convert it to a double using atof or _tcstod (for UNICODE).
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
What I want to do would seem simple but I cannot seem to find the answer to this anywhere. I want to save 2 integer variables and a string to a file from a dialog based application. I can find how to do the string but the integer, or other numeric variables is elusive. serialization is not what I need, what I want is every time int1, int2 and strComment are entered into edit boxes the user clicks a button and the info is saved. This is easily accomplished in vb, but I cannot seem to do it in Visual c++. I am using Visual studio 6.0
Michael Deming
mdeming@hotmail.com
|
|
|
|
|
Why not read the values of the edit boxes and then use standard ofstream .
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Hey Mike,
Alexandru is correct as using a ofstream object would be rather simple if that is all you need to do, something such as this should work:
ofstream outputfile;
outputfile.open("myFile.dat", ios::out);
if(outputfile.is_open())
{
outputfile << m_int1;
outputfile << m_int2;
outputfile << time;
outputfile.close();
}
Hope this helps..
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Some endl s are called for here if you want to read the info later.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You could just use Get/SetPrivateProfileInt() and Get/SetPrivateProfileString() to save the data to an .ini file.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks Nick, Alexandru and Ravi
I used the fstream and it does exactly what I needed. I guess the biggest hangup was I was not aware that fstream would work under windows. None of the books I have were clear on the subject. I am curious as to how I could accomplish the same task using Get/SetPrivateProfileInt() and Get/SetPrivateProfileString() for the same task. Also Is there one for GetSetPrivateProfileDouble()?
Mike Deming
|
|
|
|
|
MikeDeming wrote:
Also Is there one for GetSetPrivateProfileDouble()?
No. Just convert it to a CString using Format() and read/write it out as a string.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
My application uses a DLL that causes some trouble:
I can call LoadLibrary successfully (the returned HMODULE is not NULL).
Trying to call FreeLibrary immediatly hangs my application...
Any ideas? I also mention that the dll I am trying to load/free uses some thread variables (__declspec (thread)). Could this be the problem?
Thanks!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Alexandru Savescu wrote:
I also mention that the dll I am trying to load/free uses some thread variables (__declspec (thread)). Could this be the problem?
Yes. I did a quick browse of __declspec(thread) on MSDN and it mentions that it may cause problems with "delay loading of DLL imports".
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Thanks, but this is not the problem...
I removed the __declspec (thread) specifier from the DLL and it still hangs...
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
That's pretty strange.
How about just not calling FreeLibrary on it? Just let it be freed when your app is closed.
Sorry I can't be of more help.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hi!
I have written:
void JEdit::OnKeyUp(UINT ch, UINT count, UINT flags)
{
switch ( ch ) {
case VK_BACK_SPACE:
{
....
}
....
}
I wanted to detected backspace key, but the compiler says: "'VK_BACK_SPACE' : undeclared identifier" . What should I do?
Thanks,
Sovann.
Why waste time learning while ignorence is instantaneous ? [Hobbes]
|
|
|
|
|
Use VK_BACK instead.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
What should I do?
Don't use it if it isn't defined. Use VK_BACK it is defined. Or just define it as 8.
Thanks for the help,
Bill
|
|
|
|
|
I have written a DLL which contains a function that I have exported with the NONAME directive.
I have been trying to access this function within VC++6.0 but have had no luck.
I accept that this will not hide the exported function from anyone so this is more of a personal exercise. I was hoping to use this function for error and other internal checks.
If anyone can help. . . . .
If they tell you that I can program, don't believe 'em!
|
|
|
|