|
CLASS:
---------------------------------
DEFINITION:
declaration of an object.
EXPLANATION:
Imagine a button, a button has a color, a text and an icon (all those parameters are member variables of the button class).
A button also have a function that is called when the button is pressed (a member function).
SAMPLE:
class cbtn
{
private:
COLORREF m_clrColor;
CString m_csText;
CIcon m_Icon;
void OnClick();
};
Once you have the class declared, you can instantiate (define - create objects of) that class so many times...
DLL:
---------------------------------
DEFINITION:
executable that exports functions and variables to other executables.
EXPLANATION:
You can build dll's or use other dll's that are installed in your computer, those programs can be used from any program that knows how to call their functions or variables...
imagine that you create always a program that (it's just an explanation and the sample will be very stupid) add two numbers and the code to do so is very long (I adviced you that that would be stupid...) then you could consider to place that code in a DLL and call that code from your programs...
FINALLY
---------------------------------
To go to class to learn is interesting if you can't do it, think of reading a good C++ book for learning about classes and another Windows programming book for DLL's...
Hope this helps...
PS:
the samples are just introductory and they have my point of view, they are not the purest and best ones, but they can help you to get the starting point when reading some info regarding this.
NOTE:
my english is not my best.
Hope this helps...
|
|
|
|
|
Ok, This is the same pathetic person who could not get his window app to work. It now works. To whoever told me about the 4 platforms, I think I will go with .NET. I was using MS Visual C++ .NET 2003 and none of my programs would compile. I am wondering why. Even a simple hello world app would not work. Please tell me a bit about .NET since i would like to use that. thanks.
|
|
|
|
|
|
I need to retrieve CColorDlg "Basic colors" palette. The custom colors are placed in CHOOSECOLOR structure - how can I get the basic colors?
Regards,
BB
|
|
|
|
|
It would be nice if I could hide some text in a static control. I experimented a bit, and it looks like anything inserted after a \n is not displayed.
I'm wondering if that's a predictable behaviour, or might it be a function of my particular setup. If it's predictable, and safe, I'll go ahead and use it.
Any thoughts?
|
|
|
|
|
Why not use a hidden static? Though I must say that trying to "hide" something in the GUI sounds like a bad idea...
"was wir auch tun, wohin wir gehen
die illuminaten sind im system
sie kontrollieren überall
und 23 ist ihre zahl!"
23, welle: erdball
|
|
|
|
|
It's not really hidden - your static control is probably only high enough to see the first line. Try expanding it, and you'll probably see the rest.
Dave
|
|
|
|
|
You're right! It's probably reasonably predictable behaviour.
Thanks.
|
|
|
|
|
But it's still not really hidden. If the user has Spy (or something similar) installed, they can trivially retrieve the hidden text. The GetWindowText() API will also return the full text in the control, even if called from another process.
Dave
|
|
|
|
|
The intent was not to hide it as much as it was to encode some additional information in the text that the user wouldn't want to see. It's a long story...
|
|
|
|
|
How to scroll to the line we want?
|
|
|
|
|
What the hell are you talking about ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
My guess scrolling an edit/multiline static to a specific line.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
.oO(how can I put Christian on my ignore list)
|
|
|
|
|
Easy - go to Code Guru.
Did you ask the question ? Or are you just on the same level as the answer, and so the question actually made sense to you ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
|
Christian Graus wrote:
Easy - go to Code Guru.
ROTFLMAO. You are so cruel. Keep it up.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Whatever you are drinking... Can I have some?
"was wir auch tun, wohin wir gehen
die illuminaten sind im system
sie kontrollieren überall
und 23 ist ihre zahl!"
23, welle: erdball
|
|
|
|
|
"The EM_SETCUEBANNER message sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information. For more discussion of this, see the Remarks section.
Syntax:
To send this message, call the SendMessage function as follows.
SendMessage((HWND) hWndControl,(UINT) EM_SETCUEBANNER,(WPARAM) wParam,(LPARAM)lParam);
wParam:
Not used; must be zero.
lParam:
Pointer to a Unicode string that contains the text to display as the textual cue.
Used for:
An edit control that is used to begin a search may display "Enter search here" in gray text as a textual cue. When the user clicks the text, the text goes away and the user can type.
Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Using Windows XP Visual Styles.
Message Information:
Header Declared in Commctrl.h
Minimum operating systems Windows XP "
This was taken from the MSDN website. I am trying to implement this into my program but whenever I try to compile my program I get an error "C2065: 'EM_SETCUEBANNER' : undeclared identifier"
I tried to #include "commctrl.h" but it didnt help.
Im using Visual Studio .Net, Windows XP & a MFC7 Dialog Application.
VS automaticly creates a manifest file so that could not be a problem. When I hover the mouse pointer over the 'EM_SETCUEBANNER' text I get a tooltip that says "EM_SETCUEBANNER (ECM_FIRST + 1)"- so it looks like its defined. Realy hope someone can help.
|
|
|
|
|
Look for the 'EM_SETCUEBANNER' in the header file.
Look above it for a #ifdef or #if defined line.
You must define that 'definition' in your C or C++ files before including the header.
Define it before the header is included by stdafx.h if necessary.
Then I think your problem will go away.
C++/MFC/InstallShield since 1993
|
|
|
|
|
Hey all,
Suppose I have a LAN, and I want to run a server application on a machine INSIDE the LAN, behind the gateway machine.
mIRC is an application that does something like that. Without configuring it in any special way, it is possible to send a file to someone through the DCC protocol (according to that protocol, the machine that SENDS the file is the server, and the receiving end is the client that connects to the server).
So - it works for mIRC, but it doesn't work in my application.
I found the description of the DCC protocol online, and I am implementing a similar protocol:
1. I create the listening socket, and bind it with port 0.
2. I check what port the socket was associated with (Windows decides that for me, because I binded it with port 0)
3. I send the port number to the client
4. The client attempts to connect to my machine using the port number I sent it - and it fails, if my machine is not the gateway. BTW - the IP that the client attempts to connect to is the IP of the gateway.
Do you know how it can be done?
Thanks in advance!
Oz
|
|
|
|
|
obe wrote:
3. I send the port number to the client
4. The client attempts to connect to my machine using the port number I sent it - and it fails, if my machine is not the gateway. BTW - the IP that the client attempts to connect to is the IP of the gateway.
Usually all Peer-2-Peer applications do have problems with SNATed/filtered networks.
a) You need a static forwarding on your gateway (for each client inside LAN, yes not really handy and highly unsecure too)
b) Or your gateway is a Linux box which has an IRC module loaded. Then it translates intranet IP:port to external IP:port on-the-fly and back. This must be specific for each protocl, e.g. for DCC protocol (you also might need to adjust your IRC client settings to make use of it).
If somebody tries to connect to your PC your router/packetfilter/firewall receives an 'incoming connection' from internet. One you did NOT establish. Your router doesn't know to which internal host the data should be routed. How should your router know? The data could be assigned to any host/port combination in intranet or meant for nobody at all. If you make an explicit static forwarding for a port your router will be happy. Otherwise your router says "Don't know it, don't like it, good bye!" and the connection is rejected. So far what happens usually.
The IRC module (or iptable module) will AFAIK assign a few special highports and changes outgoing IP:port combinations inside a IRC DCC data stream to IP_external:port_special. Incoming traffic on a "special" highport is then detected and routed to the corresponding client inside the LAN. Please correct me if I'm wrong and this behaviour has changed meanwhile.
Btw, this problem is not IRC specific... that's why there are modules for known protocols, e.g. IRC and FTP.
Gnutella has a neat solution too, so called "pushs" which use already established connections instead of creating new ones (so avoiding the described 'incoming traffic' problem in handshake). However, if two filtered peers hit each other this "push" solution won't work in the end (and most peers are such refering to Gnutella host statistics).
Solutions... many are possible: e.g. IRC module, "pushs", special proxy or a friendly forwarding man in the middle, etc.
|
|
|
|
|
Thanks for the elaborate reply!
I'm not sure I completely understood what you meant, though.
I understand why this issue is problematic (the router not knowing how to handle an incoming connection to a port that it did not create) - but still - this seems to work on mIRC - without doing special configuration to the gateway, or to the mIRC application.
So I figured that maybe when I bind a socket to 0 on an internal machine, the underlying network components realize that it's an internal machine, and notify the gateway of the port number that is given to the socket at the end, so it can play along.
Do you know of a programmatic and general way to work around this issue? Without knowing what gateway software is being used, and without asking the user to configure anything?
Thank you very much,
Oz
|
|
|
|
|
hmmm I'm suprised!
I didn't know that mIRC works reliable with DCCs (on SNATed/MASQed gateways) without having an IRC module or forwarding rules on the gateway. Are you sure that you not rely on the other side to handle incoming connections (one of two envolved peers has to be able to handle incoming connections *)? Are you sure you have no Linux or BSD as gateway (the IRC module is per default installed on most Unix distributions)?
Honestly, I have no idea how you could forward incoming TCP/IP traffic without special treatment. I did run into the same problems when learning about P2P network programming. That's why I tried to understand & explain what happens on a gateway, and which solutions exist IMHO. I would be very gratefull about any additional solutions!
Well, there is one thing left I did forget to mention. Contrary to IRC most (all) games do use UDP as transportation instead of TCP and many gateways have a so called "lose UDP patch". I don't know any details about the underlying mechanism... but somehow the gateway routes incoming UDP datagramms into the LAN and to the appropriate game client. Anyone with more experience here?
As far as I know IRC protocol uses TCP only, RFC 1459 etc[^]. ATM there is no general way (or simple sockets call) to work around this 'incoming traffic' issue.
Hope it helps, Moak
* = If the other peer handles incoming connections, then the problem is omitted. It doesnt matter who creates the connection, once it is established it can be used. If your opponent can't too, your DCC will fail. Relying on the other is always bad, sometimes it works, sometimes it fails.... well you know what I mean, if you have some unreliable friends. *g*
|
|
|
|