|
How do you do to accomplish an object-oriented desing in a pure Win32 API written application? No, MFC, WTL or any other frameworks.
And don't post dummy questions and ask why I wanna do this etc etc etc...
Thanks!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
I presume what you mean is actually
"How do I encapsulate the HWND in a C++ class and make a proper class hierarchy?"
Otherwise stop read here.
How you design the hierarchy depends on your own ability to design - if you have done it in another area, then you can do here also.
The tricky part encapsulating the HWND and maintaining window procedures is to associate a class instance with a particular physical window, i.e., HWND with this . This can be done in many ways: ATL/WTL uses thunking and MFC a hash map, but it can be as simple as stashing the this pointer in the userdata section of the window with ::SetWindowLong() or setting this as a window property with ::SetProp() or even using a global variable (but that would not get us very far...)
I would, however, recommend WTL.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
|
Is there a such message for a dialog based program like "WM_SHOW" that indicates that the dialog has been shown on the screen ?
I would like perform a certain task just when the dialog has bee n displayed to the user. Cant use OnPaint (and have a "do once" flag) since the task waits for the user to put his finger on a fingerprint scanner. So if he then moves the window or something the program will hang ...
OnCreate, OnInitDialog, OnShowWindow all runs before the dialog is shown ... any ideas ?
Thanks, Daniel
|
|
|
|
|
What about OnActivate or OnFocus? (not 100% sure these are the exact names).
|
|
|
|
|
Hello there, I am Dennis.
I wanna ask you guys if you have any idea or suggestion on how to implement graphics interaction into c++.
What i mean is how do we put in the graphical interaction show a real time interaction within a network. (let say base station and few terminals, I want to show the interaction with base station and terminal. Where if i click the terminal button, it can show status like Qos or how much bytes sent/received. )
The graphical interaction can show how the process is going one.
If anyone have any idea what I am saying, please give me idea. ok? suggestion.I am very appreciated if you give me some ideas. Thanks.
|
|
|
|
|
I beginner programmer,
My problem is that i wont save a file associated at myView with a new name
I have used OnSaveDocument(newName) but a empy file is created how so?
can i take a Cfile associated at myView
My code is
void myView ::OnFileSave()
{
CString nomeFile= GetDocument ()->GetTitle();
CString szFilter = "All Files (*.*)|*.*||";
CFileDialog fd( FALSE, NULL, nomeFile ,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST |OFN_PATHMUSTEXIST |OFN_EXPLORER ,szFilter, AfxGetMainWnd());
if(fd.DoModal()==IDOK)
{
CString pathNomeFile =fd.GetPathName();
myViewerDoc *appoDoc = GetDocument();
appoDoc->OnSaveDocument(fd.GetPathName ());
appoDoc->SetPathName(fd.GetPathName());
}
}
The file in myView already exist and at runtime it is modified maybe
Sorry for my English
|
|
|
|
|
That all looks OK. I suspect that you haven't implemented myViewerDoc::Serialize .
|
|
|
|
|
i have implemented the myViewerDoc::Serialize but in the Carchive object
i haven't the information about the file in the myView and i dont know as attack the record into the new file
|
|
|
|
|
hi,
i wish to change the size of the drawing area(black background in my case) so that can distinguish between this area and the grey background for putting dialog controls, is it possible? i do not want to use splitter windows... any solution will appreciate
|
|
|
|
|
Hi Friends!
I am creating an VC++ application (Microsoft Visual studio Ver 6), OS is Win2K, for getting the mac address from local and remote machine. I am using UuidCreateSequential() for getting the MAC address. As per the msdn and from different sites, I have included rpc.h ,rpcdce.h and added link to the library rpcrt4.lib.
But I get Compilation error as
error C2065: 'UuidCreateSequential' : undeclared identifier
Does any body knows the cause for this?
The above function I am using for creating license key for my software products. Is there any other easy way to create the unique license key?
Thanking in advance.
Best Regards
Smita Duraphe
Keep your hearts free from hate, your mind from worry. Live
simply, expect little, and give much. Fill your life with love. Scatter sunshine. Forget self, think of others. Do as you would be done by.
|
|
|
|
|
You're probably trying to compile using the header files included with Visual C++ 6.0. This function didn't exist then. You'll need to get the current version of the SDK from Platform SDK Update[^]. You may need to update the directories in Tools > Options > Directories once the SDK has installed (I can't remember if this is done automatically).
This API was added in Windows 2000; if you call this function in your code, and try to run your application on Windows NT 4.0, it will not load.
|
|
|
|
|
I need to turn in by December 9th 4 programs and i don't know how to do them,,,they are for my introductary C++ class. they are very small...i am willing to pay if someone writes them for me,,,i need the programs to pass this class!
|
|
|
|
|
Cheap man Cheap, those programs are for you to learn c++ programming.
My God is more powerfull Than Your God.
|
|
|
|
|
What precisely do you need?
Phil
|
|
|
|
|
if they are so small and easy you can probably find them on the internet or, and this is just a crazy thought, actually take the time to do some studying and make them you self. How about that eh?
Er zit een korstje op mijn aars.
|
|
|
|
|
Pardon me for being obtuse, but isn't there a reason you're required to pass this class? Isn't it part of a degree program that (eventually) may lead to a job programming stuff? Or is it merely one of those elective things you're expected to do to round out your experience?
If you don't know how to do the programs by this stage of the term, you don't deserve to pass. When the school hands out a passing grade it is, in effect, issuing a guarantee that you have certain skills, and employers are entitled to depend upon that assumption. By attempting to circumvent actual learning and replace it by cheating, you are hurting not only yourself and your future employers, but are also reducing the credibility of your school.
If you can't do it, withdraw and take the class again, and earn a fair grade. Alternatively, you might consider changing majors to earn a degree in something that really interests you, or that you can grasp. Programming is much like Accounting - it can be boring, but it is also very complex at times. If you don't have the knack for it you really should move on to something that really excites you. It's not for everyone...
I wish you the best of luck, but buying grades is not a good way to acheive your goals. In the long term it will always backfire on you.
"Your village called - They're missing their idiot."
|
|
|
|
|
Roger Wright wrote:
buying grades is not a good way to acheive your goals
Even if he's planning to be a manager?
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
I suppose there may be a few exceptions... Lawyer, politician, used car saleman - the slimeball professions.
"Your village called - They're missing their idiot."
|
|
|
|
|
My old CS teacher always said to class "Some of you should become a cab driver instead".
I know at least 3 who took his advice.
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
Hi, there... I’m now getting a problem:
In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side.
Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent
Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides?
Thanks!
|
|
|
|
|
UDP is a poor choice if this is critical data. There is no way to predict how long it will take for some clients to receive the data because, by definiton, UDP makes no guaranteee that any of them will. It's strictly a "best effort" protocol - fire and forget. You could require a response from each client after each packet, but even that doesn't guarantee that you'll get reliable transport; some of the responses may also get lost. You could also require an acknowledgement from each client and analyze the round trip time to adjust your timer value - it might help. TCP is designed to overcome this problem, though, and would be your best choice.
"Your village called - They're missing their idiot."
|
|
|
|
|
Agree fully with what Roger said. If you find yourself having to re-invent synchronisation and error checking as part of using UDP, then you might as well use TCP - thats what it provides. If, however, you really do need to use UDP then I suggest taking a look at what other people have done. I cant remember anything off the top of my head other than mbone, but I recall their being several projects on Sourceforge relating to broadcasting video and such like. These people will need to have dealt with the same problems as you, so it's worth taking a look.
|
|
|
|
|
Well, big thanks to Roger and Johnny...
Now, I'm searching something useful on SourceForge.net...
|
|
|
|
|