|
And that indeed solved the problem. I get a warning about libcmt, but so what...
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Can I get a HWND to the listbox part of a combobox? 7 ComboBoxEx?
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi All
I am getting the below errors and could not found any reason. I a mtrying to do a simple screen saver with (unmanaged) c++ by using scrnsave.lib
ScreenSaver error LNK2019: unresolved external symbol _DefScreenSaverProc@16 referenced in function _ScreenSaverProc@16
ScreenSaver error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
ScreenSaver fatal error LNK1120: 2 unresolved externals
What could be the reason
karanba
|
|
|
|
|
I'd like to know what is the benefit that i get when i enable the socket keep-alive mechanism?
I know that it is transpanert to the application layer.
Now, suppose i use MFC socket whereupon i get OnClose event in case the client or the server is down.
Therefore, i don't undestand when shall i enable the keep-alive mechanism and what is the benefit??
Thanks,
Dudi
|
|
|
|
|
Almost never, keep alive default notify ~2 hours....
|
|
|
|
|
Yes i know that. However, what is the benefit when keep-alive is enabled?
|
|
|
|
|
What shall I do in order to slow down the implementation of OnEndSession() (or OnQueryEndSession) - I mean when the program or the system sends WM_QUERYENDSESSION (or WM_ENDSESSION) a dialog appears - I need 10-15 seconds for the user to read the message on this dialog and then continue with the implementation of OnQueryEndSession() and OnEndSession() functions.
I tried with a timer but something went wrong. Is there another way?
|
|
|
|
|
Hi, everyone!
I have often noticed that someone declares a friend
fucntion inside a class (in the .h file of the class)
and give the definition of the function in the .cpp file
of the same class. I want to know whether this
method is correct? Does it have some weak points? Where should
correct place which we give the definition (Note: not the declaration)
of the function?
Another question is, if I define the function like below, what is the
scope of the function? (i.e. where can compiler find the function?)
Here is the sample codes I noticed:
in A.h
--------
class A {
friend int functionA();
void memberfunction();
}
--------
A.cpp
--------
A::memberfunction()
{
//implemention
}
int functionA()
{
//implemention
}
--------
Thanks in advance,
George
|
|
|
|
|
Hello guys,
I am looking for a function that is similiar to MessageBox function, however, would have ability to include formatted variable in the pop-up windows box.
Best way to illustrate, is something in combination of printf and MessageBox
int number = 3;
printf("Number is : %d", number);
so, might mean doing that in forms of MessageBox
MessageBox("Number is : %d", number);
Is there funtion MFC that could server that purpose?
Thanks in advance for any help.
|
|
|
|
|
CString myMessage;
myMessage.Format("Number is : %d", number);
MessageBox(myMessage, ..., MB_OK);
Brian
|
|
|
|
|
There isn't an MFC function for this. I use code like the following in ED (see sig) for it's "Do not ask again" message boxs.
MsgBox( TCHAR* pStr, ... )
{
va_list marker;
va_start( marker, pStr );
const int nMaxMsgSize = 10 * 1024;
TCHAR substmsg[ nMaxMsgSize+1 ] = {0};
_vsnprintf( substmsg, nMaxMsgSize, pStr, marker );
MessageBox( hWnd, substmsg, Caption, uType );
va_end( marker );
}
You need to fill in the missing bits like hWnd etc,
Hope that helps.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hello,
The solution is to first format your string, then display the message box. The best way is probably to use a varlist and to implement your own function. Here is my own:
int AfxMessageBoxFormat (LPCTSTR lpszFormat, ...)<br />
{<br />
<br />
CString s;<br />
<br />
va_list args;<br />
va_start (args, lpszFormat);<br />
<br />
s.FormatV (lpszFormat, args);<br />
<br />
va_end (args);<br />
<br />
<br />
return AfxMessageBox (s);<br />
}
Hope that helps,
JM
Web: http://goa.ifrance.com
|
|
|
|
|
I don't think there is, but I'm working on just such a thing in C#.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hi, everyone!
Suppose I have a customer class defines a customer
time presentation structure. It has three int member
variables: year, month and day.
I have noticed someone who overloading time_t operator.
But I do not know how to do it, one of which can be reached
at,
--------
http://www.p2ptoolkit.com/classl2t_1_1base_1_1Date.html#a7
--------
Can anyone tell me how to overload time_t operator? Another
question is I do not know how to use a overloaded time_t
operator.
Here is the code I write myself. I do not know whether it is
correct. I still do not know how to use a overloaded time_t
operator of my class. I just write the operator overload function
from my thought that maybe it should be like this.
Can anyone help?
--------
Class MyTime {
int year;
int month;
int day;
MyTime::operator time_t() const
{
struct tm wn = {0};
wn.tm_mday = day;
wn.tm_mon = month;
wn.tm_year = year;
time_t output = mktime(&wn);
return output;
}
}
--------
Thanks in advance,
|
|
|
|
|
time_t isn't an operator, so you can't overload it. It's a standard C typedef for representing time. I guess what you really want is a type conversion operator between MyTime and time_t ? That overloads the operator () . Your code is correct for overloading the () operator, but don't use MyTime:: prefix when the function definition is inside the class, and the variable output is redundant.
|
|
|
|
|
Thanks, markkuk buddie!
Why do you say variable output is redundant? I think
my type conversion operator is used to convert MyTime
to time_t. So it must return a time_t type.
Can you give me the correct code of the type conversion
operator function in your opinion?
regards,
George
|
|
|
|
|
You can simply return mktime(&wn); without assigning the value in a temporary variable. The code would be:
class MyTime {
private:
int year;
int month;
int day;
public:
operator time_t() const
{
struct tm wn = {0};
wn.tm_mday = day;
wn.tm_mon = month;
wn.tm_year = year;
return mktime(&wn);
}
};
|
|
|
|
|
Thanks, markkuk buddie!
George
|
|
|
|
|
You use the time_t converter just as you do with built-in conversions:
MyTime mt;
time_t time;
mt.year = 1970;
mt.month = 8;
mt.day = 11;
time = mt;
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Thanks, Michael buddie!
George
|
|
|
|
|
Hello!
I write a program that based on Microsoft's walkall example. It runs good on my PC.
But, I find on some other PCs in our lab, it will not run
successfully, although it can be compiled correctly (I setup the
SDK and IE6's library properly, I believe).
The problem is, in the walk() call, I find on some PCs,
after the call:
if (SUCCEEDED(hr = pColl->get_length( &cElems )))
it will ALWAYS return cElemns=5,
and by getting the first element, and do a get_outerHTML,
I find the HTML seems to be an empty one, always is:
However, I traced the code line by line, there didn't seem to be any code failed (at least, the calls/functions does not return failure themselves).
To my idea, I doubt the MSHTML always generate an empty HTML like above and bound it to the pointer IHTMLDocument2* m_pMSHTML, no matter what URL I give. As to my knowledge, I can't figure out which call/function may fail during the process.
Does any one has any idea of it? Which may be the cause of the above phenomenon?
(And why this only happens to some PCs, not to all PCs I can acess in the lab (all with administrator priviledge)? Although I think all the PCs in my lab have the same MSVC and SDK installed.)
Thanks a lot in advance.
PS: I can email the zipped source code if anyone need. it is 56k after zip, compiles under MSVC6 (with MFC).
|
|
|
|
|
You didn't tell us how you set it up. What page
do you navigate the control to? If you don't
one possible cause might be that different machines
are set up to use different default home pages.
If, for example, when you pull up a browser on
machine 1, and the default page is www.codeproject.com
you will get different results with the same code
if on machine 2 the default page is about:blank.
When you start the page up, what page appears in the
control?
|
|
|
|
|
Hi,
I tried right clicking on the class name in Class View and choosing Add Member Function to add an operator= function to my class, but it won't add it to the .h file like it does with other functions. Is this a known bug? Is there a fix?
|
|
|
|
|
I'm trying to add a context menu to a tray icon that appears when a user right clicks on it. I'm not getting any of the "click" messages in the window that is passed in NOTIFYICONDATA. I did notice one thing. I was using SPY++ to see if the parent window existed (it's a 0,0,0,0 invisible window). I right clicked on the window and then clicked properties. As soon as I did the window started receiving messages like crazy.
Does anyone know what's going on and what I need to do to fix it?
Here's some code snippets
CTrayWindow trayWindow;
trayWindow.CreateEx(0, AfxRegisterWndClass(NULL), "Tray Window", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0); <br />
...<br />
m_iconData.hWnd = trayWindow.GetSafeHwnd();
m_iconData.uID = WM_MYMESSAGE;<br />
m_iconData.uCallbackMessage = WM_MYMESSAGE;<br />
m_iconData.uFlags = NIF_ICON | NIF_MESSAGE;<br />
Shell_NotifyIcon(NIM_ADD, &m_iconData);
CTrayWindow is instantiated in my CWinApp::InitInstance()
Thanks!
|
|
|
|
|
I remember hearing something about setting the foreground window and posting NULL messages when you are finished with the menu...
something like this:
pWnd->SetForegroundWindow();
pMenu->TrackPoupMenu(
TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD,
point.x, point.y, pWnd, NULL );
pWnd->PostMessage( WM_NULL );
Hope this helps, or points you in the right direction somehow...
There are 10 kinds of people - those that get binary and those that don't.
|
|
|
|