Greetings, I'm having an issue, I want to set my form to display at the very top right hand side corner of a screen, I've achieved this in vb.net using this code

Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - Width, 0)

Does anyone know how I can do this in VC++?

Your statement does not set a form location. It just creates a point structure. To set a form position in C++ you can do

SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

hwnd is the window handle returned when you created the window with CreateWindow or CreateWindow Ex. Or you can get the handle from an existing window via the title with

hWnd = FindWindow(NULL, "Window Title");

Now getting error C2065 'width' undeclared identifier

And 'x' undeclared identifier as well as y

The solution should be obvious. If the error message says something is undeclared then declare it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.