|
|
I want to have a button with an icon and text. I used Visual Studio to create a dialog based MFC app and added this to OnInitDialog and made the OK button bigger:
// TODO: Add extra initialization here
HICON voipIcon = (HICON)::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE( IDR_MAINFRAME ),
IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR);
::SendMessage(::GetDlgItem(m_hWnd, IDOK), BM_SETIMAGE, IMAGE_ICON, (LPARAM)voipIcon);
The icon and text appear correctly on Vista, but on XP only the text appears. Also, it only appears under Vista if the manifest has a dependency on Common Controls v6.
If I set the BS_ICON style on the button the icon appears with no text. This is expected behavior based on the MS documentation: http://msdn2.microsoft.com/en-us/library/ms673567.aspx.
Any ideas why the icon and text only appears on Vista? Why does it require Common Controls v6?
Thanks,
Ken
|
|
|
|
|
Maybe if you derived CButton you can solve this problem.
|
|
|
|
|
I'm calling some c++ functions stored in a DLL by using the matlab function calllib.
The complete set of functions is correctly loaded (I checked them by using libfunctionview) but matlab produces segmental error when I use doublePtrPtr (declared by using libpointer) as input...
error message refers to this function
void __stdcall transpose(double **x,int n){<br />
for(int i=0; i<n;i++){<br />
for(int j=0; j<i; j++){swap(x[i][j],x[j][i]) <br />
}}}
I have done many examples by using type* or type[] without have any problem..
No example about **type input are supported in the matlab calllib function reference, and this is very strange ... is there someone that can help me ?
|
|
|
|
|
Hello
Is there a way to hide a parent window of a win32 application from the windows taskbar (as in hide the little box with the window name and icon in the taskbar) and also the alt+tab window (as in the window which appears when you press alt+tab)?
Thanks for your help!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Add the WS_EX_TOOLWINDOW extended style to your top-level window.
|
|
|
|
|
Thanks, Mike
Although I would like a window without a caption or border.. Is there any way to do it like that?
Thanks for your help!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Just remove the corresponding styles - WS_CAPTION and WS_BORDER
|
|
|
|
|
Thanks again :p
You mean with SetWindowLong()? How do you remove multiple styles?
Thanks for your help!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Perspx wrote: How do you remove multiple styles?
Bit twiddling. For example, to remove the caption and border, use:
style &= ~(WS_BORDER | WS_CAPTION);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for all of your help, guys
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Do you still have to explicitly remove the WS_EX_APPWINDOW style?
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Perspx wrote: Is there a way to hide a parent window...
How about creating it as a child of a hidden window?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The child window will appear in the alt+tab window :p
Thanks anyway
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
You still have to add in the WS_POPUP style for that to work (IIRC).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Greetings,
I am very new to C++ and after many searches I am unable to figure out how to set the values of my array containing a character string.
class DataStruct
{
public:
char *mName;
char mInitial;
int mId;
int mAge;
int mDay;
DataStruct(char *Def_mName = "Paddy", char Def_mInitial = 'A' , int Def_mId = 1, int Def_mAge = 1, int Def_mDay = 1)
{
cout << endl << "Constructor Called ";
mName = new char [ strlen(Def_mName) + 1 ];
strcpy_s (mName, strlen(Def_mName) + 1, Def_mName);
mInitial = Def_mInitial;
mId = Def_mId;
mAge = Def_mAge;
mDay = Def_mDay;
}
When trying to use:
DataStruct data1[2] = { ("Andy",'A',1,20,30), ("Andy",'A',1,20,30 )};
I get the error:
error C2440: 'initializing' : cannot convert from 'int' to 'DataStruct'
Clearly I am not understanding somthing correctly either about strings or pointers, I am trying not to use specific string lengths if possible in this scenario.
Please can someone tell me what command I should be using to create this array, also if possible I would like to dynamicaly create the array data1 using new if anyone would be kind enough to show that example too.
Kind regards,
BS
|
|
|
|
|
Two problems:
1) You're using the wrong brackets in your initializer list:
DataStruct data1[2] = { ("Andy",'A',1,20,30), ("Andy",'A',1,20,30 )};
should be
DataStruct data1[2] = { {"Andy",'A',1,20,30}, {"Andy",'A',1,20,30 }};
2) You can't use an initializer list like this unless you remove the constructor from the struct.
See Compiler Error C2552[^] for details.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Many thanks Mark,
It did indeed work as you suggested, I am presuming that the compiler error was raised because the character array was not a fixed length.
I am plagued with a habbit of throwing myself off the deep end, anyway, thanks again for your very fast response.
|
|
|
|
|
bsharp52 wrote: I am presuming that the compiler error was raised because the character array was not a fixed length.
Actually it was the constructor...
From the docs:
"The following represent the reasons C2552 may fire when an aggregate initialization is attempted
on a type:
The type has one or more user-defined constructors."
where agregate is defined as:
"An aggregate type is an array, class, or structure type which:
Has no constructors
Has no nonpublic members
Has no base classes
Has no virtual functions "
Cheers!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
bsharp52 wrote: I am plagued with a habbit of throwing myself off the deep end
If you never threw yourself off the deep end you would learn a lot less - keep diving.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
You can keep the ctor if you initialize the array like this:
DataStruct data1[2] = { DataStruct("Andy",'A',1,20,30), DataStruct("Andy",'A',1,20,30) };
|
|
|
|
|
Cool! Thanks Mike!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
How to handle click event on icon which is placed on status bar?
Answers are appreciated.
|
|
|
|
|
You can respond to the message you indicated in NOTIFYICONDATA.uCallbackMessage when you
added the icon with Shell_NotifyIcon().
NOTIFYICONDATA.hWnd needs to be valid and NOTIFYICONDATA.uFlags needs to have the NIF_MESSAGE
flag as well.
Or were you referring to a status bar in an application window...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
yes i am referring to a status bar in an application window.
|
|
|
|