|
This code snip from MSDN about CWnd::PreCreateWindow explains this quite well.
// alter the styles of the main frame window
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// Create a window without min/max buttons or sizable border
cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER;
// Size the window to 1/3 screen size and center it
cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 3;
cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 3;
cs.y = ((cs.cy * 3) - cs.cy) / 2;
cs.x = ((cs.cx * 3) - cs.cx) / 2;
return CFrameWnd::PreCreateWindow(cs);
}
If you want to keep the old styles try this
cs.style &= ~WS_MAXIMIZEBOX;
cs.style &= ~WS_MINIMIZEBOX;
greets,
Fredrik Sigbjörn
|
|
|
|
|
Hello,
I want to write / find a program which dials to a given number wait till the anwering machine to answer, wait to the "beep" (online voice recognition) and play a recorded msg.
I'm searching for a week now for an already existing prog but all my searchings failed.
pls help me soon.
10x, tal.
|
|
|
|
|
I don't think any such program exists. CLosest to this is a program that comes with the MediaPhonics Phoneraider telephony card. Don't know the name on the product right now, but it's pretty versatile, however I don't think it can do what you want. And I think it only works with the PhoneRaider card.
http://www.mediaphonics.com
The other way is to program itself, then you need to use TAPI, and from my experience with them I can say that they are not the esiest APIs to use. Another way, that I used at my old company, is to let someone else wrap them for you. I bought the ExceleTel TeleTools classes, they are excellent to code all kinds of diffrent telephone solutions.
http://www.exceletel.com/
One more thing to note. Modem sucks when using them as phones, the quality are realy lousy. The MediaPhonics card is a better solution, the USB version is kewl, costs about $400 though
greets,
Fredrik Sigbjörn
|
|
|
|
|
<<first of="" all="" 10x="" for="" the="" fast="" response.
what="" is="" tapi="" ?="" (what="" t'="" stends="" ?),="" and="" whats="" difference="" from=""
regulay="" apis?
with="" which="" porogramming="" language="" it="" work="" on="" platform="" ?
where="" do="" i="" find="" help="" tutorial="" about="" ?
10x="" all,="" tal.="">>
TAPI is telephony API, and they are microsofts APIs for communicating with modems and telephone cards. They work only for Windows. You can probably use these in all languages on Windows.
Check MSDN for omre information on TAPI.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapiovr1_4zxw.asp
greets,
Fredrik Sigbjörn
|
|
|
|
|
How can I get my machine's physical Address using Visual C++?
Just like Using "IpConfig /all" in command mode.
Give me some advice.Thanks a lot.
|
|
|
|
|
Look at this function
DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
typedef struct _IP_ADAPTER_INFO {
struct _IP_ADAPTER_INFO* Next;
DWORD ComboIndex;
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
UINT AddressLength;
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
DWORD Index;
UINT Type;
UINT DhcpEnabled;
PIP_ADDR_STRING CurrentIpAddress;
IP_ADDR_STRING IpAddressList;
IP_ADDR_STRING GatewayList;
IP_ADDR_STRING DhcpServer;
BOOL HaveWins;
IP_ADDR_STRING PrimaryWinsServer;
IP_ADDR_STRING SecondaryWinsServer;
time_t LeaseObtained;
time_t LeaseExpires;
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
|
|
|
|
|
I have a graph that I am displaying in a CScrollView derived window. I have circles representing the nodes and arrows representing the edges. When I move my cursor over a node, a tooltip appears showing the contents of the node. Sometimes the graph displayed is much bigger than the current view so one has to scroll to see the rest. And now finally for my problem ... After I have scrolled the view and then place my cursor over a node, no tooltip appears. It only appears when I scroll back to the original position the graph was displayed in. I have tried overriding OnVScroll() and OnHScroll(), but then the graph doesn't get drawn properly.
Any help with finding a solution or any ideas will be greatly appreciated.
|
|
|
|
|
I've just started to learn and write distributed application and i want to know what kind of apps work on winNT and not work on win98...
If you can point me to some documentation on the subject please let me know.
|
|
|
|
|
Apps that call methods only NT supports. MSDN alwyas tells you what Windows version is required for a function, if you don't have it on CD, you can go to msdn.microsoft.com
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I need to check whether the URL is valid or is exist,and return its status code,such as 404 means file not found,and so on. how can I?
thank you for advanced!
|
|
|
|
|
Do you want to write your own webbrowser?
You could handle the "NavigateError" event and browse to your own 404 site.
This works only if IE6 is installed
regards
|
|
|
|
|
I'm writing an SDI application which uses a dialog box to prompt the user. In this dialogbox I have a 2 ComboBoxes which need to be populated with different data every time the dialog is called. I have two problems:
1. This is the major one. Although I get no errors, and I've stepped through the code, the ComboBoxes always remain empty. I've included code at the bottom to show what I'm doing at the moment.
2. This is more a coding design question. Where is the best place to put this code? I can't put it in the Class Constructor because that causes an assertion error (No hWnd?). At the moment I'm trapping the ShowWindow Message and setting a flag to say whether or not I've already added stuff to the ComboBoxes
Any Help would be appreciated,
- X
// Populate Combo Boxes
CComboBox* temp1;
CComboBox* temp2;
int i;
temp1 = (CComboBox *)GetDlgItem(IDC_MEM1); // IDC_MEM1 and 2 are the ID's
temp2 = (CComboBox *)GetDlgItem(IDC_MEM2); // Of the combo boxes
for (i = 0; i < 32; i++) {
temp1->AddString((LPCTSTR)m_pDoc->MemoryLocations[i]);
temp2->AddString((LPCTSTR)m_pDoc->MemoryLocations[i]);
}
|
|
|
|
|
hi..
* the right place to initalise a dialog box would be "WM_INITDIALOG" / "OnInitDialog"... but this function is just called once (like a constructor.. but the HWND is already defined)
(btw.. for deconstruction "WM_DESTROY" / "OnDestry" would be the right place.. there the HWND is still defined)
* to your coding question.. i don't know why this doesn't work.. i use pretty the same code.. i am just using membervars of the type "control".. and this works absolutely fine for me.. the first thing i would look at is, if adding works if you put constant strings in it (like temp->AddString("Hello");)
if this works your m_pDoc->MemoryLocations[i] will not work.
hope i could help you a little bit..
Bernhard
"After twelve years of therapy my psychiatrist said something that brought tears to my eyes. He said, 'No hablo ingles.'" Ronnie Shakes
|
|
|
|
|
First remark: read essay of Joseph Newcomer on this web site under C++/MFC/STL>>General about the use of GetDlgItem. Using MFC the right way doesn't require GetDlgItem calls.
Give a control variable names to your controls:
c_cbxMem1 to IDC_MEM1
c_cbxMem2 to IDC_MEM2
Adding strings to comboboxes is done by:
c_cbxMem1.AddString(sMyString)
But this is not the reason why your code doesn't work. Perhaps you didn't initialize the m_pDoc pointer the right way.
Put the handler to invoke your dialog in the application Document and initialize the member m_pDoc as follows:
...OnMyDialog()
{
CDialog myDlg;
myDlg.m_pDoc = this;
myDlg.DoModal();
...
}
and if your strings in the application document are intialized correctly the AddString() function in the comboboxes should work fine.
I hope this will help.
|
|
|
|
|
Just a wild stab-in-the dark, but when i first used combo boxes, they always appeared empty to me.
Then I finally twigged that you have to drag out the size of the dropped down list in the dialog editor. i hadn't done this, and my dropped down list was so small it appeared empty.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hello All,
Forgive me if this isn't the right place to post this, but I'm new to this community.
As the subject reads, I would like to pass a ponter to a function as an argument to another function. I'm pretty comfortable with that, but here's the catch: the function is a an method of an object.
Is this possible?
Any suggestions pointning me in the right direction would be apreciated.
Thanks in advance,
mark
|
|
|
|
|
Unless its a static function , you will get errors as there is no this pointer . Therefore you either pass an object , or pass a pointer to a static function.
|
|
|
|
|
The syntax for at typedef of a pointer to a member is:
(a member of CMyClass returning an int and taking a long and a void* as arguments, just an example)
typedef int (CMyClass::* LPFNMYCLASSMEMBER)(long, void*);
...
bool YourFunction(LPFNMYCLASSMEMBER pfnMember)
{
...
CMyClass* pClass = something;
int iRetVal = pClass->*pfnMember(aLongParam, aVoidPtrParam);
...
}
As I have shown you will have to have a valid object on which you can call the member function (unless it's a static member function which has no this pointer). So you cannot use non-static member functions as callbacks, for instance.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thank you Steen (and Andrew).
I'll let you know how it works out when I try to implement it.
However, could you pleas explain what you mean about "...non-static member functions as callbacks?"
thx,
mark
|
|
|
|
|
A good example is for timers (this is not what you want to do, but it illustrates the problem).
class CTestClass
{
public:
int ANonStaticMember(void* pData);
static int AStaticMember(void* pData);
CString m_csNonStaticData;
static CString m_csStaticData;
}
CString CTestClass::m_csStaticData = "";
int CTestClass::ANonStaticMember (void* pData)
{
m_csNonStaticData = *(CString*)pData;
m_csStaticData = *(CString*)pData;
}
int CTestClass::AStaticMember (void* pData)
{
m_csStaticData = *(CString*)pData;
}
void Foo()
{
SetTimer(NULL, 1000, &CTestClass::AStaticMember);
SetTimer(NULL, 1000, &CTetsClass::ANonStaticMember);
}
The above code will probably not compile, but I hope you get the idea. The key issue here is that a non-static member function is passed a pointer to the object on which it should act (the this pointer) as it first (and hidden) parameter. The function using the callback function will have to know what object to call the function on to be useful.
But I guess, if you pass a pointer to a non-static member function as a callback to a function you write yourself, and if you in that function calls the callback function on a valid object, it could be OK. Didn't think of that.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks for the example-that makes sense.
"...and if you in that function calls the callback function on a valid object, it could be OK. Didn't think of that."
This is probably what I will do for what I'm working on, but it is very good to know that non-static calback wouldn't otherwise work.
--mark
|
|
|
|
|
Might you know why I'm getting an error message like:"term does not evaluate to a function?"
typedef void (BinarySearchTree::*BSTmemptr) (const &int);
main()
{
BinarySearchTree<int,string> t(error); //intitializes a BST
BSTmemptr fnc; //declare pointer to member funct
fnc=BinarySearchTree::remove; //assign funct to pointer
t.*fnc(9); //attempt to call funct--error is for this line
//....
//....
}
thanx again.
|
|
|
|
|
Operator preceedence. Evaluation of the function operator "()" goes before evaluation of ".*". Put t.*fnc in paranthesis and everything works:
fnc=BinarySearchTree::remove;
(t*.fnc)();
For reference, search VC++ docs at MSDN Lib for "pointer to member", see the article "Expressions with Pointer-to-Member Operators".
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Once again, you're right.
Thank you for your patience--it's is sincerely appreciated. I'll also refer to the article.
How long have you been coding for?
|
|
|
|
|
Around 15 years. If interested you can see check my profile (just click on the little head next to my name).
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|