|
The page that you link to is the page for the WNDCLASSEX structure, not the RegisterClass or RegisterClassEx function.
Therefore when it refers to a class name that has been previously registered, it does so only to describe what the structure should contain.
It's not telling you to register a class name more than once.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
No, the Link is Correct. The offending piece of Text is in the explanation about "lpszClassName" in the WNDCLASS(EX) structure. A Good bit down the File!
Regards,
Bram van Kampen
|
|
|
|
|
lpszClassName
Type: LPCTSTR
A pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpszClassName; the high-order word must be zero.
If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the RegisterClassEx function will fail.
As I read this, the lpszClassName member must be either an atom or a string. Only if it is an atom must the atom be one created by a previous call to the RegisterClass() or RegisterClassEx() APIs.
In my experience, most programmers use a string for this member.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Bram van Kampen wrote: Do I totally misunderstand No, but I think the documentation is not as clear as it could be. The structure may be used either for registering a new class, or for querying an existing one (GetClassInfoEx[^]). In the case of RegisterClass the class name should be a string that is not already used for any other class.
|
|
|
|
|
So, the Latest Update to this Help article was written by the Lass or Bloke who wrote 'GetClassInfoEx()', without thinking that the same struct is used by RegisterClass(Ex).
Well, at least not a Fundamental API Change.
Regards,
Bram van Kampen
|
|
|
|
|
I suspect it has always been a bit confusing.
BTW sorry about the duplicate messages, something weird going on at CP tonight.
|
|
|
|
|
Hi everyone I am new to this i donot know how to change font of a editcontrol in MFC.How to do it.
|
|
|
|
|
Assuming you are talking about a CEdit control, you can use the SetFont[^] method.
|
|
|
|
|
yes you are correct any examples for that one...
|
|
|
|
|
Probably plenty if you go and search. However, it is not really too difficult to create a CFont object and use that as shown in the documentation.
|
|
|
|
|
A bit of History
These days it is quite simple. A lot of the complication about fonts arose during the 1990's, the Font Wars. Various companies claimed copyright over their named fonts. That is absolutely No problems if the fonts you use are on the same computer that you write your software on, Your Computer. Difficulties arise however, if you write a document in a set of fonts, try to load and print it on another computer, which may not have a Font installed by the same Name. Microsoft tried to resolve the issue, by trying to get the Closest Comparable Font. and included a structure which contains obscure Font designer Lingo terms, such as 'Internal Kerning'.
That War was won by Microsoft, Fonts can now be downloaded for free.
Things have simplified by now. Just specify Type Name, Style (Straight/Italic/Bold) and a Point Size. That is all that is required these days.
Regards
Bram van Kampen
|
|
|
|
|
steganography source code in c
|
|
|
|
|
Member 11443861 wrote: steganography source code in c What about entering that into the input field of your favorite search engine?
|
|
|
|
|
|
We have a many articles on steganography, here at Code Project.
|
|
|
|
|
Hello all,
I need a little help: I want to create an application that automatize different applications in the sense that my application will be able to press automatically different buttons on another application.
For example: my application will start, let's say, Microsoft Office, will press some buttons in MSOffice, and will close MSOffice.
Could you give me an idea how to do that ? I have no clue... some code in C/C++ would be perfect.
Thank you very much!
<script src="//www.codeproject.com:8011/bar17428.js" type="text/javascript" ></script>
|
|
|
|
|
|
In addition to sending the exact keys directly as Richard described (I think that method is basically replicating what a keyboard would do if I'm not mistaken), there is another way of achieving this. Sending messages to the application's control directly. Windows allows this and it's relatively easy to get the controls' ID's to send messages to them.
Use Spy++[^] to get control IDs and you can also intercept some messages to figure out how yours should be formatted.
Once you have control IDs, you can send messages using the SendMessage()[^] method.
Biggest problem with this method is that it's more of a hack than anything else. The control IDs are not guaranteed to be the same from one version of the software to the next.
|
|
|
|
|
Dear Friends,
Am developing a client server application. Am using MFC MDI. It has multiple class. One class is showing live values so i used Editbox and CListCtrl control. I was create these control in
onCreate() function. It shows live in
onDraw() function
GetDlgItem(IDC_EDITBOX)->SetWindowText(sLiveValues); it is also updating a value but it is getting flicker. If i use
InvalidateRect() function it is not flickering but not update any value. So i need to update live value in any control like EditBox,CListCtrl without flicker. How to avoid flickering. Please help me.
|
|
|
|
|
If I understand you correctly, you are calling SetWindowText() from onDraw(). This is a problem, because SetWindowText() invokes drawing of the control. So your apllication is permanently redrawing its GUI.
I would suggest that you store the values in the receiving function in a thread-safe way (look for CRITICAL_SECTION in the documentation). Then create a timer (look for SetTimer()) and in the timer function again in a thread-safe way copy the data to a local variable and display the copy with SetWindowText(). The OnTimer function could look something like this:
void YourDialog::OnTimer(UINT nIDEvent)
{
if (nIDEvent == YourTimerId)
{
EnterCriticalSection(&yourCriticalSection);
CString values = sLiveValues;
LeaveCriticalSection(&yourCriticalSection);
GetDlgItem(IDC_EDITBOX)->SetWindowText(values);
}
}
You can run the timer in any interval convenient for your users.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Hi,
I have a Dialog based Application. The Dialog may be Maximised. The Dialog is divided in three panes. There is a Dlg Wide reporting Section at the bottom, The Top is vertically divided in two, the LH Pane shows a Tree Control, The LH Pane shows further details of the selected node.
The divisions between the panes must be 'User Draggable'. What MFC control is available (if any) to capture the mouse, and perform the dragging action.
Regards,.
Bram
Bram van Kampen
|
|
|
|
|
|
|
I'm trying to create a set that stores vertices where vertices are defined by this class:
Quote: class Vertex
{
public:
Vertex();
~Vertex();
Vertex(double x_set, double y_set, double z_set, int bezierInd);
double x,y,z;
int bezierIndex;
bool operator<(const Vertex& rhs);
bool operator==(const Vertex& rhs);
bool operator!=(const Vertex& rhs);
};
I don't really know if i need a an allocator, but compile errors tell me I do. Also do I need a custom comparator? I created this one :
Quote: struct vertexCmp {
bool operator()(const Vertex& a, const Vertex& b) const {
return a.bezierIndex < b.bezierIndex;
}
};
and I'm creating a set like this :
set<Vertex, vertexCmp> bezierPoints;
|
|
|
|
|
You don't need a custom allocator for that type (or frankly, any type - effectively).
Custom allocators are a way to speed things up, or to keep data localized (definitely not mutually exclusive goals).
You DO however definitely need custom comparator functions, and you are close to getting it right. Very close. Have you considered making the member comparators const themselves, e.g. "bool operator<(const Vertex& rhs) const;"?.
++luck;
|
|
|
|