• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Initializing WINDOWPLACEMENT structure

I am using the WINDOWPLACEMENT structure in several different places. I want to be able to initialize the members to NULL.

Can i only do this by accessing each individual member and setting them to NULL. Is there any other way or a better way i can acheive this?
0
suda5181
Asked:
suda5181
  • 3
  • 2
1 Solution
 
jkrCommented:
You could

WINDOWPLACEMENT wp;

ZeroMemory((LPVOID)&wp, sizeof(WINDOWPLACEMENT));
0
 
jkrCommented:
Oops, a little thing is missing:

WINDOWPLACEMENT wp;

ZeroMemory((LPVOID)&wp, sizeof(WINDOWPLACEMENT));

wp.length = sizeof(WINDOWPLACEMENT);
0
 
suda5181Author Commented:
the ZeroMemory function works fine, but when i try to initialize the windowplacememnt structure to NULL from the Constructor of another class, it does not work
it skips the instruction

class class1 : public CDocument
{

public :
bool flag;
WINDOWPLACEMENT wp;
}


class1::class1()
{
            flag =false;
                               
            ZeroMemory((LPVOID)&wp, sizeof(WINDOWPLACEMENT));
            wp.length = sizeof(WINDOWPLACEMENT);
        

}

Am i doing something wrong here ??

thanks
0
 
jkrCommented:
Actually, the above should definitely work. Is this your exact code?
0
 
suda5181Author Commented:
Sorry, its my mistake

thanks for the solution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now