|
You need the latest SDK provided on the MSDN CD's or downloaded from the MSDN web site. The article is the best real world sample I've come across. Just cut and paste the xml manifest and rename to match your exe name. Add CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest" into your .rc2 file and compile.
>Is there a way to force a non-XP app to use the XP look, without including special headers?
Not that I'm aware of. You need to use the manifest file to tell XP to draw your application using the XP theme.
Michael
|
|
|
|
|
You can take one of your old programs, and get it to use XP styles...
Make a textfile with the following text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="CompanyName.ProductName.YourApp" type="win32"/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
</assembly><
If the program is calles test.exe, you call the textfile test.exe.manifest, and places it in the same folder as you application.
If you application don't use any ownerdraw stuff, it should now use the XP styles...
I actually tried it with VC 6.0, and almost all of the controls got XP styles. (the owner draw controls didn't)...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
I have two different situations where I have comboboxes that are part of a
view. I can't seem to get all the combobox messages.
A. I have a member variable that is part of a listview class. I make a
handler for ON_CBN_SELCHANGE and I get that just fine, but I make a handler
for ON_CBN_KILLFOCUS and I don't get that message??? I can get a
ON_EN_KILLFOCUS for a CEdit member of the same view. Is there something
special about ON_CBN_KILLFOCUS?
B. I have, also in this view, a combobox, added to a toolbar. Both are
members of the view. I do all the positioning myself.
The toolbar's parent is the listview (this) and the comboboxes parent is the
toolbar (m_tbrColumns). How can I get the messages for the combobox in the
view?? I don't get any messages for this combobox in the view.
thanks
mike
|
|
|
|
|
Answer to (b):
If you want MFC message maps to work, you'll have to override toolbar's OnCmdMsg. You should call the view's OnCmdMsg first:
BOOL CYourToolbar::OnCmdMsg(...)
{
if (m_pParent->OnCmdMsg(...))
{
return TRUE;
}
return CToolBar::OnCmdMsg(...);
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all
I want to know if there is a faster way to fill a CComboBox with a large number of elements(8000-12000)
|
|
|
|
|
Here are some tricks:
1) call CComboBox::InitStorage before adding the items. This will reduce the number of memory reallocations during the sequence of AddStrings.
2) You can try to use CComboBoxEx instead and use 'callback items'. In this case you do not pass the string to the combo - instead, the combo will ask your app (using WM_NOTIFY) each time it needs a string. This will work when you have the strings stored somewhere else - in the dynamically allocated array filled with data loaded from database, for example.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Can you give source code for the second way.I'm loading items from a database
|
|
|
|
|
Disable redraw during update. Short of that, no. Though I fail to see why you'd like 8k-12k entries in a freakin' combobox. Perhaps something else in the interface could be fixed?
|
|
|
|
|
Im trying to get a small bitmap I have to appear on my toolbar, not to be pushed like a button or anything, just a picture. I have created a "dummy" button on my toolbar and called it ID_STATIC_DUMMY. This is the code I have:
CToolBar m_wndToolBar;
CStatic m_static;
CRect rect;
int nIndex = m_wndToolBar.GetToolBarCtrl().CommandToIndex(ID_STATIC_DUMMY);
m_wndToolBar.SetButtonInfo(nIndex, ID_STATIC_DUMMY, TBBS_SEPARATOR, 25);
m_wndToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect);
if(!m_static.Create(NULL,WS_DLGFRAME | SS_CENTERIMAGE | SS_BITMAP | WS_VISIBLE, rect,
&m_wndToolBar, ID_STATIC_DUMMY))
{
TRACE(_T("Failed to create static\n"));
return FALSE;
}
CBitmap myBitmap;
myBitmap.LoadBitmap(IDB_BITMAP_STAR);
m_static.SetBitmap(myBitmap);
It works correctly except that it doesnt display the correct bitmap. I cant even make out what it puts there but it does put something there. Whats the problem???
<marquee>Raffi
|
|
|
|
|
It seems that your bitmap gets destroyed when myBitmap goes out of scope. Make it a member or call myBitmap.Detach().
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
It worked. Thank you very much
<marquee>Raffi
|
|
|
|
|
this is a really old answer to a really old question ; but I had the same problem and this recomendation solved it for me too!
so thanks!
marcela bovio
|
|
|
|
|
I have a CString. It contains multiple #'s that break it up. Now i want to get each piece of text seperately between the #'s. For example:
Jake#Caroline#Mark#Anthony#Sid#
The string ends with # but doesn't start with # (although you can presume otherwise because it can be changed).
Hows the easy way to do this? (preferably the MFC CString way )
Thanks
P.S.: i'll stop hasssling u ppl now lolz, i'm working on a program thats why i was asking so many questions hehe.
Kuniva
|
|
|
|
|
The C way would be with strtok, but otherwise, you'd use CString::Find, which allows you to find the first instance of a substring starting from a specified position, and CString::Mid which allows you to pull a substring out of the middle.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
try this:
CString text = "Jake#Caroline#Mark#Anthony#Sid#";
CString name;
int index=0;
while (AfxExtractSubString(name, text, index++, '#') {
if (name != "") {
// do something
}
}
|
|
|
|
|
One way to do is to copy the CString to a char buffer and strtok() your way through the buffer.
(Btw, if you're using the CP forums to get canned answers to your schoolwork, you're only hurting yourself.)
/ravi
"There is always one more bug..."
http://www.ravib.com
raviv@ravib.com
|
|
|
|
|
lolz dont worry, its not for school, i'm only 16 we dont get any computer studies in my school, lolz we dont even have computers at my school haha
Kuniva
|
|
|
|
|
Can you tell me how I copy a string to a char buffer? Sorry if this question is a bit stupid...
|
|
|
|
|
Stevieslu wrote:
Sorry if this question is a bit stupid...
The only stupid question is the one not asked! Here's how:
char szBuffer [LARGE_ENOUGH_TO_HOLD_STRING];
CString strMyString = "Whatever";
szBuffer [0] = '\0';
if (strMyString.GetLength() < LARGE_ENOUGH_TO_HOLD_STRING) {
strcpy (szBuffer, strMyString.GetBuffer (0));
strMyString.ReleaseBuffer();
} /ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi All,
I was just wondering about something that has been bugging me ever since I saw something like this in Java. In practice, which type of statement would be more preferable if you were to call a class function inside the same class in C++?
class Object {
void func1() { this->func2() }
void func2() {}
};
or
class Object {
void func1() { func2() }
void func2() {}
};
Is there any performance differences between the two?
Also, I apologize if this code might look wrong. I just wanted a conceptual opinion.
Frank
|
|
|
|
|
No direrences....
Best Regards...
Carlos Antollini.
|
|
|
|
|
There's no performance difference. IMHO, you only need 'this->' when one of the method parameters has name colliding with name of another data member. In the example below, the parameter 'foo' hides the member 'foo', so you need to explicitly qualify it with 'this'. Of course, you can rename the SetFoo parameter 'foo' to 'theFoo', in such case there's no need for explicit 'this'.
class obj
{
public:
void SetFoo(int foo) { this->foo = foo; }
int GetFoo() const { return foo; }
private:
int foo;
};
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm new to c++ and wanted to implement a few api calls into a test project. Unfortunately, every call fails w/ the unresolved external symbol error. Why? I include windows.h and give the functions all required parameters. Here's a sample-->
#include <windows.h>
int main()
{
HWND hwnd=NULL;
ShellExecute(hwnd, "open","http:\\www.google.com",NULL,NULL,SW_SHOWDEFAULT);
return 0;
}
and i receive these errors-->
main.obj : error LNK2001: unresolved external symbol __imp__ShellExecuteA@24
Debug/load.exe : fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
from MSDN:
Header: Declared in Shellapi.h.
Import Library: Shell32.lib.
You've obviously got the header, try adding shell32.lib to your libraries list in the options for your project.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|