|
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
); wParam
Specifies the type of resizing requested. This parameter can be one of the following values.
SIZE_MAXHIDE
Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXIMIZED
The window has been maximized.
SIZE_MAXSHOW
Message is sent to all pop-up windows when some other window has been restored to its former size.
SIZE_MINIMIZED
The window has been minimized.
SIZE_RESTORED
The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.
lParam
The low-order word of lParam specifies the new width of the client area.
The high-order word of lParam specifies the new height of the client area.
You can use the LOWORD , HIWORD , MAKELPARAM , or MAKEWPARAM macros to assemble the wParam and lParam paramters.
Jeremy L. Falcon
"You do not know the power of the dumb side."
<nobr>
Homepage : Sonork = 100.16311 Maybe my mangling might misguide malicious miscreants momentarily?
|
|
|
|
|
If you are interested, you can simply call SetWindowPos or MoveWindow to change the size of the window as well, and windows will take care of the message sending for you.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I'm writing an application which allows the user to set options in a property sheet with a few property page. The problem I'm having is with data validation. For each of the property pages, I've added some data validation when the user click the 'ok' button, i.e MyPropertyPage::OnOk()
The problem I'm having is that although the data validation is done, i.e
if (m_strName == "")
{
AfxMessageBox("Please enter a name!");
return;
}
when the OnOk() function exits from the return statment of the name check, the property sheet is closed?
I've tried commenting out
// CPropertyPage::OnOK();
to stop it called this method from the parent, but it is still called?
What I want is for the property sheet to stay modal, if the data entered is not valid.
Any help would be much appreciated.
Robert
fargo2k@hotmail.com
|
|
|
|
|
Override the CPropertySheet::OnApply
and set the modified flag
and after test if u want to return
return true else return false.
|
|
|
|
|
I am writing a console program that will go to a database at certian intervals. Basically, I am trying to implement an automated email system for expired records. My question comes when trying to decide between using a Timer or just have the program use Sleep().
So I want the program to check the database every x number of minutes (probally every hour) and see if anything needs to be sent.
My restrictions are that it has to be able to run on win98 and higher.
Any suggestions. Right now I am leaning toward Sleep(), but I am not sure if that is a viable business app solution.
Thanks in advance,
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
If you are depending on executing something every minute, I would not rely on Sleep() since you don't know how long your database queries will take (unless you do some math to calculate the remaining sleep time, but still there are some things to consider). The query time might differ from call to call. If that minute is allowed to be fuzzy, then, a Sleep() might be the way to go.
Consider how you want the program to behave if a database query takes over (or about) a minute.
Consider that timers are system resources, and there might be none available at times.
Hmmm... well, can't think of anything more for the moment.
|
|
|
|
|
I would use a waitable timer. Because it will block your program while you are waiting, but if you expand your program in the future, you will have the ability to wake that thread up before the timer expires. With Sleep, your program will block for the same amount of time and this cannot be changed at runtime.
Here is an example from MSDN of how to use a waitable timer.
#include <windows.h>
#include <stdio.h>
int main()
{
HANDLE hTimer = NULL;
LARGE_INTEGER liDueTime;
liDueTime.QuadPart=-100000000;
hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
if (!hTimer)
{
printf("CreateWaitableTimer failed (%d)\n", GetLastError());
return 1;
}
printf("Waiting for 10 seconds...\n");
if (!SetWaitableTimer(
hTimer, &liDueTime, 0, NULL, NULL, 0))
{
printf("SetWaitableTimer failed (%d)\n", GetLastError());
return 2;
}
if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
printf("WaitForSingleObject failed (%d)\n", GetLastError());
else printf("Timer was signaled.\n");
return 0;
}
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
I need to implement a SMTP server in my appl. Does anyone here have done this? Please, any source codes or ideas would be very useful.
Thank u very much,
Dirso.
|
|
|
|
|
An SMTP server? Or do you mean an SMTP proxy, that pushes the SMTP chat to the real SMTP server? If so, you can use my SMTP proxy class. It's a non-MFC C++ class.
http://www.codeproject.com/useritems/nishcsmtpproxymt.asp
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Hi,
I do need to build a SMTP server. If u have any ideas, please let me know.
Thank u very much,
Dirso.
|
|
|
|
|
If you are willing to consider a commercial source code library, our Dundas TCP/IP library includes everything you'll need to generate an SMTP server (SMTP in, SMTP out, POP3, DNS resolution, account management, relay handling, etc., etc.)
Dundas TCP/IP Products
David
http://www.dundas.com
|
|
|
|
|
A commercial code could be used, but i don't need everything of ur library. If u have a cheaper solution or a trialware, please tell me.
Thank u very much,
Dirso.
|
|
|
|
|
Hi, everyone!
I encounter a problem here with multiple document & multiple view application. I use the MDI frame(with 3 different Document Templates)and I also attach an extra view to the first document class corresponding to the 1st document template (Use AddDocTemplate). Then I want this extra view to render something base on the current active view(actually base on the current active document). Is there anybody know how to implement this?
The dificulty I encounter here is that:
While I make modification on second document(belong to 2rd document template) inside the view class(belong to 2rd document), I call UpdateAllViews(this), then only the views belong to the 2rd document get the Update message and response to it. How to make the extra view which belong to the 1st document to get the update message?
Best Regards,
Wayne King
09 May 2002
|
|
|
|
|
If you notice the UpdateAllViews method is a member of the CDocument class. It will only send the update message to views attached to that instance of the CDocument object. If you want a more global update method, you can do it through the app like this:
void CMyApp::UpdateEverybody()
{
POSITION posTemplate;
POSITION posDocument;
posTemplate = GetFirstDocTemplatePosition();
while(posTemplate)
{
CDocTemplate* pTemplate = GetNextDocTemplate(posTemplate);
if(pTemplate)
{
posDocument = pTemplate->GetFirstDocPosition();
while(posDocument)
{
CDocument *pDoc = theApp.pDefectDocTemplate->GetNextDoc(posDocument);
if(pDoc)
pDoc->UpdateAllViews(NULL);
}
}
}
} In your code you make the call like this:
...
theApp.UpdateEverybody();
... I also like the declare the theApp object as extern so most of my code can see it. Add this one line to your apps header:
class CMyApp : public CWinApp
{
...
};
extern CMyApp theApp; There may be other and better ways to do this, maybe someone else will respond with other answers. This method has worked well for me in the past.
Hope this helps...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Hi, Jonathan Craig!
Thanks for your kind response. After play around with my codes some more,
I realized that the extra view should not belong to any perticular
document. This bring in one more problem here. How to send Update message
to the view without a document?(How to get the pointer of this view?)
I still use AddDocTemplate(pTemplate) & pTemplate->CreateNewFrame(NULL, NULL) to create the view, but pass the pDoc as a NULL pointer.
Any idea and comment are greatly appreciated!
Best Regards,
Wayne King
09 May 2002
|
|
|
|
|
I would just send all the windows a user defined message #define WM_MY_MSG (WM_USER + 1). Using the ON_MESSAGE macro to handle the mesage in the view. You can make this message handler do what every update is doing..
void CMyApp::SendMessageToEverybody(UINT nMsg, WPARM wParam, LPARM lParam)
{
} Hack on...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
I have a Windows explorer type program, that talks to a printer via a serial link. The printer stores many files internally. When I drag a file across from the printer to Windows explorer, I need to somehow get Windows explorer to download this file.
Or I need to get information about where the files were dropped in explorer, so my app can start the download. ActiveSync does such a thing, so it must be possible!
I can handle it when explorer drops files on my app, but not vice versa.
Any help or advice is very welcome!
Thanks in advance,
Alan Dugdall
|
|
|
|
|
Hi All
Has anybody here communicated via VC++ to a chain of hardware devices via the RS232-485 converter?
If so any documentation regarding the comm. to the converter or any weblinks to the resources is greatly appreciated
Thanx in advance
Agnihothra
|
|
|
|
|
Yes and they work just fine. No real documentation required because they are pratically idiot proof. If I remember my specs right, all you usually need to do is support hardware flow control and then the 485 convert does the rest.
That is if I remember my 485 right. I never can remember which one of 485 and 422 is just a simple RX/TX and which has the extra control lines for who wishes to access the wire.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I am new at VC++ but i didnt understand the pointer thing.
Why we use them? Where we need them? Please,someone help me!I want to know ALL REASONS why we use them.Thanks to everyone.
|
|
|
|
|
I think different: why is not everything a pointer?
Pointers give more flexibility & efficiency. In some cases you want the value not the reference, there you (maybe) don't need pointers. But with at least bigger data stuctures you want back your pointers, e.g. copying data from/to stack is not optimal.
|
|
|
|
|
cause data has to be stored somewhere, the pointer has to point somewhere...
|
|
|
|
|
agreed
|
|
|
|
|
Hmm, well, it has many advantages. Of course I can't remember all of them. But here are some.
1. Stack of the program is limited, and it is used for regular variables. Ponters are limited only by amount of memory in the computer, not on the stack.
2. When you have a class for example, which uses for example 100Mb of the memory. Now passing the variable to another function will make a copy of the class and you will have 200Mb of memory usage. Instead of this you can pass a pointer, which holds only 4 bytes. Actually this one is same as ByRef in VB - reference (you have references in C++ too).
Well, can't remember more right now, but sure others will find you enough
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Try reading my article on pointers for an introduction to the subject, and feel free to make comments in the discussion area of the article.
--
Andrew.
|
|
|
|
|