answersLogoWhite

0

What is lparam and wparam?

Updated: 12/14/2022
User Avatar

Wiki User

14y ago

Best Answer

Its just to call a WinAPI function or other functios with a value or a pointer.... Well, this is not an answer to a posted question. See discussion.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is lparam and wparam?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the Differentiate between dos based programming and windows programming?

A DOS program's output/input is based souly on the DOS proment, while a win api based program is based within its own window. Code is untested! // DOS Prompt Code c/c++ - With output #include <iostream> // Input Output Stream int main() { std::cout << "Hello World"; // Output Command return 0; } // Win Api Code c/c++ just window #include <windows.h> LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("Opengl"); HWND hwnd; WNDCLASS wndclass; HDC hdc; MSG msg; HGLRC hrc; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR); return 0; } hwnd = CreateWindow (szAppName, TEXT ("OpengGL"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow (hwnd, iCmdShow); UpdateWindow (hwnd); while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: opengl.callDisplayFunc(); return 0; case WM_SIZE: return 0; case WM_KEYDOWN: switch(wParam) { case VK_ESCAPE: SendMessage(hwnd,WM_DESTROY,wParam,lParam); break; } return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }


How do you detect mouse wheel movement in c plus plus?

In Windows, whenever you rotate the mouse wheel, the WM_MOUSEWHEEL macro (value 0x020A) is sent to the form or window that currently has focus. Simply map this message to an appropriate handler in your form. The direction and amount of rotation can be determined by invoking the GET_WHEEL_DELTA_WPARAM macro, passing the message's wParam as the argument. The lParam contains the mouse coordinates. If there is no handler in your form, the message propagates up through the parent forms until a handler is found.


Program to implement mouse coordinate in vc plus plus?

Start by creating a non-empty WIN32 application.In your main source, include the standard I/O library:#includeIn the global variables section of your main source, add the following class declaration and object:struct point{int x;int y;point():x(0),y(0){}TCHAR* get() const{static TCHAR str[MAX_LOADSTRING];_stprintf_s(str, MAX_LOADSTRING, "Mouse: %i,%i", x, y);return(str);}};point mouse_coordinate;In your WndProc callback function, add the following message handler:case WM_MOUSEMOVE:mouse_coordinate.x=LOWORD(lParam);mouse_coordinate.y=HIWORD(lParam);RECT r;GetClientRect(hWnd,&r);InvalidateRect(hWnd,&r,TRUE);break;Finally, modify the WM_PAINT message handler as follows:case WM_PAINT:hdc = BeginPaint(hWnd, &ps);// TODO: Add any drawing code here...TextOut(hdc, 0, 0, mouse_coordinate.get(), _tcsnlen(mouse_coordinate.get(),MAX_LOADSTRING));EndPaint(hWnd, &ps);break;Now run the application. The mouse coordinates will be printed at the top left of the client area.


How get input form keyboard?

Retrieving keyboard input depends partly upon whether you're writing a console or graphical application. If you're writing a console application, you have the following functions available: - sscanf() in the stdio.h header - getchar() in the stdio.h header - getch() in conio.h and curses.h (plus kbhit() if it's available) For Win32 applications, which are event-driven, you'll want to intercept the WM_CHAR event that's passed to your window handler (WndProc). The wParam parameter will contain the character on the keyboard that's pressed. For other APIs, you'll want to check the documentation, or look on the Web for tutorials describing how to get keyboard input using whichever API you're using.


How do you set registry entry as environment variable?

Assuming you are asking how to do this by hand and not from a program, see below. If you want to write a program you'll need to look on MSDN for the various ways of setting and retrieving environment variables.Set your environment variables into the registry using REG.EXE from the command line.Variables for the Current User are stored in HKEY_CURRENT_USER (HKCU) and for All Users in HKEY_LOCAL_MACHINE (HKLM). The registry locations are:HKCU\EnvironmentHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\EnvironmentYou'll need to know the type of data you want to store. Choices are:REG_SZREG_MULTI_SZREG_DWORD_BIG_ENDIANREG_DWORDREG_BINARYREG_DWORD_LITTLE_ENDIANREG_NONEREG_EXPAND_SZSo to create an environment variable named "Fred" with a value of "1234" do this:REG ADD HKCU\Environment /v Fred /d 1234 /t REG_SZ/v is the variable, /d is the data and /t is the type. Use REG_EXPAND_SZ if you want to include existing environment variables (e.g. %system%) and remember to double the %'s (i.e. \d %%system%%\mypath.Retrieve your setting with:REG QUERY HKCU\Environment /v FREDNOTE: This will not update the current environment, neither in the current command window nor in other windows (of any type). ou must logout and login for the changes to be picked up r you'll need to compile the following code-lette which I got from the MSDN reference:#include int main(int argc, char* argv[]){DWORD_PTR dwReturnValue;SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM) "Environment", SMTO_ABORTIFHUNG,5000, &dwReturnValue);return 0;}Type REG at a command prompt for more details.