![]() ![]() Personally I hate WINAPI and have just been using glut (for OpenGL) to do windowing for me but I do plan on learning some more WINAPI so I can include features that they miss out. In order to get the mouse coords you have to look up what you need from the msdn site and then put it into WindowProcedure function at the bottom of the code I posted. Return DefWindowProc (hwnd, message, wParam, lParam) PostQuitMessage (0) /* send a WM_QUIT to the message queue */ĭefault: /* for messages that we don't deal with */ Y Return CallNextHookEx (WHMOUSELL, nCode, wParam, lParam) End Function Private Sub Form1Load ( ByVal sender As System. Switch (message) /* handle the messages */ Private Function MouseHookProc ( ByVal nCode As Int32, ByVal wParam As IntPtr, ByRef lParam As MSLLHOOKSTRUCT) As Int32 ' Display cursor coordinate on Libel1 and Label2 Label1.Text lParam.pt.X Label2.Text lParam.pt. LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) * This function is called by the Windows function DispatchMessage() */ * The program return-value is 0 - The value that PostQuitMessage() gave */ * Translate virtual-key messages into character messages */ While (GetMessage (&messages, NULL, 0, 0)) It will run until GetMessage() returns 0 */ * Make the window visible on the screen */ HThisInstance, /* Program Instance handler */ HWND_DESKTOP, /* The window is a child-window to desktop */ when it find the skype icon i want it to move from these coordinates, but of insted of moving to an expecific coordinate i want it to move down from these coordinates, (there is multiple images so i cant move to an specific image) - Kinda having trouble telling what i want cuz english isnt my first language, sorry about that. WS_OVERLAPPEDWINDOW, /* default window */ĬW_USEDEFAULT, /* Windows decides the position */ĬW_USEDEFAULT, /* where the window ends up on the screen */ * The class is registered, let's create the program*/Ġ, /* Extended possibilites for variation */ * Register the window class, and if it fails quit the program */ Wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND * Use Windows's default color as the background of the window */ Wincl.cbWndExtra = 0 /* structure or the window instance */ Wincl.cbClsExtra = 0 /* No extra bytes after the window class */ Wincl.hCursor = LoadCursor (NULL, IDC_ARROW) Wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION) Wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION) ![]() Wincl.style = CS_DBLCLKS /* Catch double-clicks */ Wincl.lpfnWndProc = WindowProcedure /* This function is called by windows */ WNDCLASSEX wincl /* Data structure for the windowclass */ MSG messages /* Here messages to the application are saved */ HWND hwnd /* This is the handle for our window */ Int WINAPI WinMain (HINSTANCE hThisInstance, * Make the class name into a global variable */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM) This is the auto generated "starting code" made by Dev-C++ when you selected a win32 GUI project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |