|
jana_hus wrote: This post is here because I should be able to ask,
if it bothers you - DO NOT REPLY. Thanks.
Oh look, it's another Salvatore Terress.
|
|
|
|
|
|
Hi,
In my dialog i followed the link below to solve the flicker issue. It worked.
I am continuously capturing and updating an area of dialog.
currently, i do:
Invalidate()
UpdateWindow()
is there a faster way to repaint?. like RedrawWindow(), etc. Are they handled by the wm_paint?.
https://www.codeproject.com/Articles/33/Flicker-Free-Drawing-In-MFC
modified 3-Aug-24 19:20pm.
|
|
|
|
|
2 Things:
1) Please don't repost if your question does not appear immediately: all of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spares. Have a little patience, please!
I've deleted the 3 identical spares ...
2) Don't post this under Quick Answers - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
However, given that the article is 22 years old it's unlikely that anyone is going to know or remember details of how it works!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm using a CIPAddressCtrl which gets filled with a device's IP. The user can edit this IP and I need to make sure none of the fields (octets) are blank if the user wants to update the device with the new IP. If any are blank and the user tries to update (with a click of a button), then there will be an error.
I see there is a SetFieldFocus that can set the focus if an octet is blank, but I'm not sure if it's useful for what I need or how to use it in my case. Is there any work around to achieve this?
Thanks.
|
|
|
|
|
In order to validate the use input, call the GetAddress method and check its return value. See the documentation: CIPAddressCtrl Class | Microsoft Learn[^].
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Tried that already. GetAddress doesn't tell you whether or not an octet is blank. If you do GetAddress and get the four octets and one of them is blank, then it's just a zero. However, it could also mean that the user could have entered zero.
The IPM_GETADDRESS message returns the number of non-blank fields so that'll probably work for me unless anyone has any other ideas.
|
|
|
|
|
DWORD dwIPAddr;
iNonBlankOctets = ::SendMessage(hWnd, IPM_GETADDRESS, 0, (LPARAM)&dwIPAddr);
This worked for me.
|
|
|
|
|
But how would you differentiate between an empty octet and an octet containing 0?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
iNonBlankOctets = ::SendMessage(hWnd, IPM_GETADDRESS, 0, (LPARAM)&dwIPAddr);
Not exactly sure how to tell if specific octets are blank or 0.
In my case, making sure iNonBlankOctets is never less than the total number of octets is sufficient validation so if any octets are blank, then there's an error.
|
|
|
|
|
Member 16326708 wrote: In my case, making sure iNonBlankOctets is never less than the total number of octets... The return value of IPM_GETADDRESS is a DWORD that is broken up into 4 pieces, one for each of the four octets. There is no count.
A possibly better option would be to call GetWindowText() on the CIPAddressCtrl 's control. Getting the string representation of the IP address would allow you to parse and validate the octets. You would still get 0 for empty ones, though.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 6-Aug-24 10:08am.
|
|
|
|
|
|
Tried these...
public class Program {
static async Task Main()
{ }
}
static int Main()
{
No luck , I'm afraid ...
|
|
|
|
|
I'm afraid you will have to learn basic syntax of C++ language. Get a good book and start going through it.
Mircea
|
|
|
|
|
|
That's C# code, not C/C++. You posted this in the wrong forum.
But I see you already posted this elsewhere and received answers to it, so reposting this was redundant.
|
|
|
|
|
Dave Kreskowiak wrote: ...so reposting this was redundant. And completely unnecessary.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello
i am a total newbie in C++ and i am learning by tryning to modify an existing code which uses displays.
In the original code there are 2 displays showing informations to the user
I want to add a third display do i copied the screen2.cpp and screen2.h and renamed them to screen3.cpp and screen3.h
Inside the screen3 code i replace all mentions of screen2 by screen3
and i added the screen 3 in the screens.cpp script
// User screens
MMIRegisterScreen(SCREENID_1, Screen1Enter, Screen1Create, Screen1Update, Screen1Exit);
MMIRegisterScreen(SCREENID_2, Screen2Enter, Screen2Create, Screen2Update, Screen2Exit);
MMIRegisterScreen(SCREENID_3, Screen3Enter, Screen3Create, Screen3Update, Screen3Exit);
My problem is that when i debug i end up with 4 error messages as the Screen3Enter, Screen3Create , Screen3Update and Screen3Exit are not declared
This is strange as in the screen3.cpp the functions here above are declared the same way they are declared for the other screen i copied from
void Screen3Enter(void)
{
}
void Screen3Create(void)
{
Thanks for your suggestions
modified 25-Jul-24 6:38am.
|
|
|
|
|
No one here can guess what this code is doing, or what it is supposed to do. And trying to learn C++ by modifying someone else's code is not a great idea.
|
|
|
|
|
OK thanks but i have no time to learn from scratch
I have an existing code doing more or less what i expect on the displays and am trying to make it look how i want.
|
|
|
|
|
Carbonkevlar13 wrote: i have no time to learn from scratch Then you are going to need a lot of luck, and will probably get very frustrated. Looking at the few lines of code you did show suggests that it is a Windows GUI application, so that is another subject you will need to learn.
|
|
|
|
|
You have to find where
Screen2Enter, Screen2Create, Screen2Update, Screen2Exit are declared (and where they are defined) and do something similar to what you've already done: make the brand new
Screen3Enter, Screen3Create, Screen3Update, Screen3Exit copying and renaming. Unfortunately the process could go on deeper and deeper.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Thanks
the functions are defined in the script of the screen
I am wondering if they should be declared somewhere else ?
void Screen3Enter(void)
{
}
void Screen3Create(void)
{
// Setup default keys
ScreensSetupDefaultKeys();
|
|
|
|
|
In C++ there is no script. There are, instead, header files (*.h ) and source files (usually *.cpp or *.cc ). You should put the function declarations, e.g.
void Screen3Enter(); in header files, while the function definitions, e.g.
void Screen3Enter()
{
} should be written in source files.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Thanks
i already have these declarations inside screens3.cpp
void Screen3Enter(void)
void Screen3Create(void)
void Screen3Update(void)
void Screen3Exit(void)
when i am inside screens3.cpp there is a "No issues found" message at the bottom of the screen
but when i launch the simulation i have these 4 error messages
C2065 'Screen3Enter' undeclared identifier from the screens.cpp source referring to the following line
MMIRegisterScreen(SCREENID_3, Screen3Enter, Screen3Create, Screen3Update, Screen3Exit);
Thanks for trying to help me
|
|
|
|