|
How can I temporary disable the minimize button in my MFC dialog application?
|
|
|
|
|
Try
ModifyStyle(WS_MINIMIZEBOX, 0);
RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE
| RDW_UPDATENOW | RDW_ERASE);
rechi
|
|
|
|
|
Thanks, it works great, but is there a way just to disable the minimize button, not to hide it?
|
|
|
|
|
Yes, it's possible but not so easy. You have to intercept WM_NCPAINT and use DrawFrameControl to show the minimize picture as you wish.
rechi
|
|
|
|
|
Hello,
I have an application which have a file format use for its files.
In the explorer, then I display the "Properties" of a file of my application, I didn't see any information of my file. I want to put some informations in my file (version, user, description, bitmap, etc) which can be view in the explorer when the user display the properties of my files.
How I can do ? I have search in the msdn without success...
And, if someone know, how I can associate a bitmap to a file (like bmp, jpg, MAX file, etc...)
|
|
|
|
|
A good start for your problem could be reading Michael Dunn's shell extensions tutorials here on CP.
Tutorials index[^]
|
|
|
|
|
If you're talking about the extra pages that Microsoft Office files show in the Explorer properties window (e.g. the Summary Page), that is achieved using a Property Set in an OLE Structured Storage file (otherwise known as a compound storage file) - it's a fairly complicated topic, so I suggest you read the following articles:
OLE Property Sets Exposed (MSDN)[^] to find out what Property Sets are...
And The Summary Information Property Set (MSDN)[^] to find out about the property set responsible for storing summary information.
Hope that helps.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hello everyone,
I was wondering if there was any way to create a program that can send e-mails straight to the outlook inbox residing on the same computer... that is send it directly there and not pass GO, where GO means no STMP protocol (since i just want to create an e-mail object and somehow save it into the local inbox). I haven't been able to find any documentation on weather this is even achievable... Any input would be appreciated. Thanks everyone!
Tom
|
|
|
|
|
I think it should be possible with the help of Office Automation. The input folder is nothing else than an ordinary folder, so it should be possible to place anything in it you want. But I'm not really sure. So you should search for Office Automation on MSDN or here on CP. When having some knowledge about that and having the class information of all interfaces supported by Outlook (you get that when creating classes based on libraries, there choosing msoutl.lib or similar -> described on MSDN), you'll be able to find all information you need.
|
|
|
|
|
can I add Buttons to a Window? it seems like i cant? I've been reading some msdn docs on gui, and it seems like I can only add buttons to a dialog? Must a dialog has a window parent? I couldn't create a dialog with NULL as the handle to its window parent. So I want to create a gui with bunch of buttons on it, I have to make an invisibile window, then initate a visible dialog? it seems a bit twisted. what's wrong? can someone elaborate?
thanks
-J
|
|
|
|
|
just create a "dialog app" from VC's App Wizard.
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
Hi,
I'm trying to figure out how to access my document from my main app?
Suppose I have my CMyDocument doc and I have a member varible m_MyDocVar
and let say I want to check the value of this m_MyDocVar from my main app,
how would I get a pointer to the doc and access my variable?
Anyhelp would be greatly appriciated.
|
|
|
|
|
CMainFrame *pMF = (CMainFrame *)AfxGetMainWnd();
CMyDOcType *pDoc = (CMyDOcType *)pMF->GetActiveDocument();
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
Works! Thank you!
|
|
|
|
|
hi,
i made a .chm help file.. i've create a command for it in the menu already.. i was wondering how do i load it? do i use shellexecute or is there another command in vc++ 7 that's create for loading .chm file? also, will this .chm file work in win95/98/nt/2000?
thanx in advance.
|
|
|
|
|
The fucntion
HWND HtmlHelp(
HWND hwndCaller,
LPCSTR pszFile,
UINT uCommand,
DWORD dwData) ;
can be used to display .chm files. It's declared in htmlhlp.h. I think it should work on all OS you mentioned (even if I don't really know if you need a IE > 4.0 or anything further)
|
|
|
|
|
hi,
i delcared htmlhelp.h and attempt to run HtmlHelp off one of the event handler, but i kept on getting error message saying that HtmlHelpA doesn't take 4 argument.. i've checked out the documentation on HtmlHelp, but it's not very helpful.. not much information given.. do you know where that i can find a example on hooking up .chm using HtmlHelp function? thx.
|
|
|
|
|
The problem is that both CWinApp and CWnd delcare a HtmlHelp function, too. And this function takes only 2 parameters. So I think you've to call the function as a global one, thus calling ::HtmlHelp.
If you need more information you should have a look at MSDN. There're many examples dealing with this topic.
|
|
|
|
|
Hi guys/gals,
I'm writing a class which has a pair of static ints. Pretty easy, I know...I've done this before, but it's not working right now. I'm getting the linker error for unresolved external symbols. Perhaps you'll have some ideas:
main.cpp
#include<iostream>
#include<fstream>
#include<vector>
#include"job.h"
int main(int argc, char** argv)
{
char *algor = "Recursive", *cacheFile = "testcase1.txt", *schedFile = "schedule.txt";
bool helpFlag = false;
int tempMachPerJob, tempNumOfMach, i;
Job tempJob;
vector<Job> jobs;
ifstream inFile(cacheFile);
if (inFile.fail())
{
cout << "Error opening input file!" << endl;
exit(1);
}
inFile >> tempMachPerJob >> tempNumOfMach;
Job::setMachPerJob(tempMachPerJob);
Job::setNumOfMach(tempNumOfMach);
inFile >> tempJob;
while (inFile)
{
jobs.push_back(tempJob);
inFile >> tempJob;
}
for(i = 0; i < jobs.size(); i++)
cout << jobs[i] << endl;
return 0;
}
job.h
#ifndef JOB_H
#define JOB_H
#include<iostream>
#include<vector>
using namespace std;
class Job
{
private:
static int machPerJob, numOfMach;
int startTime, endTime;
vector<char> machines;
char schedule;
public:
Job();
Job(int, int, vector<char>);
static void setMachPerJob(int);
static int getMachPerJob();
static void setNumOfMach(int);
void setSchedule(char sched);
friend ostream& operator<<(ostream& os, const Job& job);
friend istream& operator>>(istream& is, Job& job);
};
#endif
job.cpp
#include<vector>
#include"job.h"
using namespace std;
Job::Job()
{
startTime = endTime = -1;
schedule = '-';
}
Job::Job(int start, int end, vector<char> mach)
{
startTime = start;
endTime = end;
machines = mach;
schedule = '-';
}
void Job::setMachPerJob(int mpj)
{
machPerJob = mpj;
}
int Job::getMachPerJob()
{
return machPerJob;
}
void Job::setNumOfMach(int nom)
{
numOfMach = nom;
}
void Job::setSchedule(char sched)
{
schedule = sched;
}
ostream& operator << (ostream& os, const Job& job)
{
os << job.startTime << " " << job.endTime << " " << job.schedule;
return os;
}
istream& operator >> (istream& is, Job& job)
{
int start, end;
char tempMach;
is >> start >> end;
job.startTime = start;
job.endTime = end;
for (int i = 0; i < Job::getMachPerJob(); i++)
{
is >> tempMach;
job.machines.push_back(tempMach);
}
return is;
}
|
|
|
|
|
BigDaddyDrew wrote:
I'm getting the linker error for unresolved external symbols
which symbols??
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
The two static variables:
job.obj : error LNK2001: unresolved external symbol "private: static int Job::machPerJob" (?machPerJob@Job@@0HA)
job.obj : error LNK2001: unresolved external symbol "private: static int Job::numOfMach" (?numOfMach@Job@@0HA)
Andrew
|
|
|
|
|
Ooop, nevermind, I fixed it. Forgot to declard them outside of the class.
|
|
|
|
|
|
I think thats what its called. Anyway, I got the open file dialog working. Since I am a lazy bumb I have decided to make the program compatible with all files (that have text). However, I do not know how I would wright the text from the file into the edit box. Could someone help me here? I mainly want it so that it can open a .html or .htm, .c or .cpp, .h, .txt files. How would I do this I have no idea. So could some one either tell me how (prefereable with some example code) or tell me a URL that might help me.
Thanks,
orcblood
|
|
|
|
|
If I understand you right, you want to read text from file and load it into and Edit control.
If it is so then this is sample code for both reading both ANSI and UNICODE text files:
<code>
CFile f;
if(f.open("FILENAME.TXT, CFile::modeRead))
{
DWORD dwFLen = f.GetLength();
//this short will be used to get the file header
USHORT usHeader;
f.Read(&usHeader, sizeof(USHORT));
//UNICODE text files starts with value 0xFEFF
if(usHeader == 0xFEFF)
{
//we are going to load the text into a character array
wchar_t * filetxt;
//allocate a charaters array one for null terminator
filetxt = new wchar_t[dwFLen + 1];
//clear the filetxt array
memset(filetxt, 0, sizeof(wchar_t) * (dwFLen + 1));
f.Read(filetxt, dwFLen);
//use API function rather than MFC to be able
//to read UNICODE and ANSI at the same time
::SetDlgItemTextW(this->GetSafeHwnd(), IDC_EDIT1, filetxt);
}
else
{
//ANSI files does not contain any headers, so we should
//reset the file pointer
f.SeekToBegin();
//we are going to load the text into a character array
char * filetxt;
//allocate a charaters array one for null terminator
filetxt = new char[dwFLen + 1];
//clear the filetxt array
memset(filetxt, 0, sizeof(char) * (dwFLen + 1));
f.Read(filetxt, dwFLen);
//use API function rather than MFC to be able
//to read UNICODE and ANSI at the same time
::SetDlgItemTextA(this->GetSafeHwnd(), IDC_EDIT1, filetxt);
}
f.Close();
}
</code>
|
|
|
|