|
Hi im writing a dialog based program in mfc ive made a large icon for it and it displays fine for the exe however if i add the program to my quick launch or go to it in a file dialog it shows the default mfc small icon how do i set the small icon for the exe? the regular icon works fine within the program on the system menu so whats the deal why isnt the exe's small icon being set?
Thanks
|
|
|
|
|
In the VC++6 ide, bring up your icon in the resource editor then click on the combo box next to where it says "Device:" above the icon you have open.
Now select Small (16X16) and edit it to your liking.
|
|
|
|
|
Hi
Anyone knows a fn that shut down the pc?!
thanks in advance
|
|
|
|
|
ExitWindowsEx() is the way to go
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks but i tried it, but it only causes the pc to log off, i'm trying it with win XP...
|
|
|
|
|
ExitWindowsEx(EWX_POWEROFF,0)
Here are some notes about using it:
Shuts down the system and turns off the power. The system must support the power-off feature.
Windows NT/2000/XP: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.
Windows NT/2000/XP: To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.
John
|
|
|
|
|
There is a framework in MFC where you dont create an SDI or MDI . What I mean is you start off the project with as an MDI but remove the view classes .
This is the MSDN article
HOWTO: Add Multiple Window Types to a Non-Document/View MDI App
ID: Q201045
From within a ChildView how can one manipulate the Toolbar buttons ?
|
|
|
|
|
I think my last post wasn't understandable.
I am trying to create a function that can accept any type of an array as a paramater.
char[] or double[] or int[] etc.
wouldn't it be myFunction(void *data){ do stuff }
char tmp[100];
myFunction(tmp);
I hope this makes sense.
Steven
|
|
|
|
|
Yes that would work, but once inside your function, you have to know what type of array has been passed. You could do something like this:
<code>
enum TYPES
{
CHAR,
DOUBLE,
INT,
...other types...
};
void myFunc(void* data, int data_type)
{
switch (data_type)
{
case CHAR: char* carray = (char*)data;
.... do stuff
break;
case DOUBLE: double* darray = (double*)data;
...etc.
}
...
}
</CODE>
You will probably also want to add a size parameter to myFunc as well, unless all your arrays will be a fixed size.
--Dean
|
|
|
|
|
|
Not being funny, or mean to be offensive, but that's about the worst solution I could imagine in C++.
* it requires massive amounts of work if you wish to add a new type.
* it's still not typesafe - you can't validate what's passed in
* and there are far far better approaches in C++ (eg, templates)
--
Ian Darling
If I was any more loopy, I'd be infinite.
|
|
|
|
|
Yes, I agree -- it's quick, dirty, ugly... I get the feeling though that going into something like templates would not have been understood if the above could not have been done without help from this board (no offense meant to anyone).
I try to approach these things from the standpoint that a less elegant but easier to understand solution might better serve beginners. Then, at a later time, the better way to do something can be learned when the supporting knowledge is available. A fine line has to be drawn however, as the easy code might be a terrible way to do things. I suppose I should have added a disclaimer saying that there are better ways of doing things. With that said, I hadn't even thought about templates at the time
--Dean
|
|
|
|
|
|
What's wrong with templates?
template<class T> void MyFunction(T* start, T* end)
{
for(T* iter=start; iter <= end; iter++)
{
cout << *iter;
}
}
char temp [100];
MyFunction(temp, &temp[99]);
The beauty of this approach is that it works with things that provide iterators such as std::vector, as well as standard arrays. Untested code, so YMMV.
--
Ian Darling
If I was any more loopy, I'd be infinite.
|
|
|
|
|
template <typename ForwardIter> void MyFunction(ForwardIter start, ForwardIter end)
{
while(start != end) {
doSomething(*start);
++start;
}
}
char temp[100];
MyFunction(temp, temp + 100); Would be a cleaner solution, as your will only work with std::vector . This'll work with any iterator.
--
Gnnnnmmmpppppppfffffhhh!
|
|
|
|
|
Like I said, untested code, and I'm a little rusty on C++ templates, but I figured it was essentially ok, and certainly illustrated what I wanted to suggest.
--
Ian Darling
If I was any more loopy, I'd be infinite.
|
|
|
|
|
[EDIT]
Sorry did not read all the posts, but this problem screams for a template approach...
[/EDIT]
template<class T>myFunction(T* data)
{
}
int main()
{
char tmp[100];
float fTmp[1000];
myFunction<char>(tmp);
myFunction<float>(fTmp);
}
John
|
|
|
|
|
Hi,
I use the function ShellExecute to open a PDF-file from my c++-programm (ActiveXControl). I want to highlight one word on the pdf-file. Can I do this with ShellExecute or have you another idea how I can realize that.
Julia
|
|
|
|
|
In my SDI application , I have a ToolBar with 10 buttons .
I am unable to Change the text displayed in this Button .
I named the button ID_NEWBUTTON and have a event handler in CMainFrame.
I tried to change the text in the Toolbar button using
m_wndToolBar.SetButtonText(m_wndToolBar.CommandToIndex(ID_NEWBUTTON),"Please change text");
Still nothing seems to be happenning ?
|
|
|
|
|
How can I programatically change the Color of a ToolBar ?
|
|
|
|
|
Hi,
try this
<br />
SetClassLong(m_wndToolBar.m_hWnd, GCL_HBRBACKGROUND, (LONG)::GetStockObject(WHITE_BRUSH));<br />
Regards
|
|
|
|
|
I have an SDI framework where my Chidlview creates many Dialogs within itself .
I want to trap a keyboard entry in one of the dialogs . For this I went to ClassView and added the event Handler with a dummy AfxMessageBox
This event is not getting fired ? Suggestions are needed .
|
|
|
|
|
Hello,
Where did you add the event handler? The OnChar() handler should be added to the dialog in which you want to trap a keyboard entry!
hope this helps a bit...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Sorry the subject was hard to summerize.
I have created a function that I thought was type independent, meaning that it didn't matter what type of an array was passed to the function. It would just write the data with a comma seperation.
I have 2 structure in a class called RFMAccess:
struct TSimHeader
{
char Name[47][21];
char Unit[47][21];
double Min[47];
double Max[47];
int SignalCount;
int SimStatus;
}static TSimHeader_arr[10];
struct TSimSignal
{
double Value[47];
double TimeStamp;
}static TSimSignal_arr[10];
The data in these structures gets updated 2x a second.
I also want to write the data to a file 2x a second so, I created a function that I thought would do this without having to declare the array type. I want to be able to use this later in other projects.
Here is my function.
I am doing something incorrect here, but just not sure what it is.
ofstream fout ("test.txt");
bool firstTime = true;
int passes = 1;
void LogData::writeData(void *data){
int count;
if(firstTime){
fout<<"flight_data,";
for(int i=0; i<RFMAccess::TSimHeader_arr[0].SignalCount; i++){
if(i == 0){
fout<<data[i]<<endl;
passes++;
if(passes == 2)
writeData(RFMAccess::TSimHeader_arr[0].Unit);
else if(passes == 3)
writeData(RFMAccess::TSimHeader_arr[0].Min);
else if(passes == 4)
writeData(RFMAccess::TSimHeader_arr[0].Max);
else if(passes == 5){
firstTime = false;
writeData(RFMAccess::TSimSignal_arr[0].Value);
}
}
else
fout<<data[i]<<",";
}
}
if(!firstTime &&(flight_data->log == true)){
if(i == 0){
fout<<data[i]<<endl;
writeData(RFMAccess::TSimSignal_arr[0].Value);
}
else
fout<<data[i]<<",";
}
}
Thnaks for the help,
Steven
|
|
|
|
|
What is the actual problem your getting?
Regards,
Brian Dela
|
|
|
|