473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C++11 Seperately controlled regions

rollerbladegirl
69 64KB
In C++11, using codeblocks 17.12, using GNU GCC Compiler, using UNICODE, on Windows XP Professional 32 bit with service pack 2. How do I make the three separate regions work independently of each other as described in the following? Not Visual Studio. Not ".net". Not C#.

If I have three simple images "a.bmp", "b.bmp", "c.bmp";
and I want them to each be regions with the white part not included;
and I want to be able to move each around on the screen independent of the others;
and I want the blue one to remain in front;
and I want the red one and the green one to be in front of each other when I right-mouse-click on them, but not in front of the blue one; I am trying to do this with Dialog boxes.
then how do I do this?

I have tried a lot of examples and book instructions, and now I want better help.
Jan 2 '20 #1
5 3696
rollerbladegirl
69 64KB
Here is where I am:

Expand|Select|Wrap|Line Numbers
  1. #ifndef IDC_STATIC
  2.     #define IDC_STATIC (-1)
  3. #endif
  4.  
  5. #ifndef _UNICODE
  6.     #define _UNICODE
  7. #endif // _UNICODE
  8.  
  9. #ifndef UNICODE
  10.     #define UNICODE
  11. #endif // UNICODE
  12.  
  13. // Not clear on if I need both _UNICODE and UNICODE .
  14.  
  15. #include "resource.h"
  16.  
  17. #include <windows.h>
  18. //#include <commctrl.h>   // Not clear on if I need this .
  19.  
  20. #define MAX_LOADSTRING 100
  21.  
  22.     // Global Variables:
  23.  
  24.         HINSTANCE InstanceHandleOfMainWindow;    // Instance handle of the main window
  25.  
  26.         TCHAR szTitle[MAX_LOADSTRING];            // The title bar text
  27.             // Why all the extra code for this? Why not just put the title directly into where the window is created?
  28.             // Why not make smaller code without this extra loadstring etc.?
  29.  
  30.         HWND Handle_MainWindow = NULL;          // Handle to main application window
  31.  
  32.         HRGN hRgn = NULL;                       // Handle to region
  33.  
  34.         HDC hdcDest;                            // Dest DC
  35.  
  36.         HDC hdcMem;                             // Memory DC
  37.  
  38.         BITMAP bmpInfo;                         // Buffer to hold bitmap data
  39.  
  40.         BOOL mouseState = 0;                    // Global variable for moving region using mouse
  41.  
  42.         POINT CursPt = {0};                     // Global variable for moving region using mouse
  43.  
  44.         wchar_t WindowClass_for_WinMain[MAX_LOADSTRING] = L"(myWindowClass)";
  45.  
  46.     // Forward declarations of functions included later in this code module:
  47.  
  48.         ATOM                RegisterTheMainWindowClass(HINSTANCE hInstance2);
  49.             // Why rip this out of the WinMain and make a big deal of it? Why not just leave it in winMain?
  50.  
  51.         BOOL                DidTheMainWindowClassRegisterCorrectly(HINSTANCE, int);
  52.  
  53.         LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
  54.  
  55.         LRESULT CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
  56.  
  57.     // Empty function to be used later to create region based on the bitmap.
  58.  
  59.         void createRegion(HWND);
  60.  
  61.     // Empty Function to be used later to paint window regions.
  62.  
  63.         void paintRegion();
  64.  
  65.     // Empty Dialog callback procedure declaration to be used later.
  66.  
  67.         INT_PTR CALLBACK DialogProc( HWND Handle_DialogBox1, UINT uMsg, WPARAM wParam, LPARAM lParam );
  68.  
  69.  
  70. int APIENTRY WinMain(HINSTANCE hInstance1, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  71.  
  72.     {
  73.         MSG msg;
  74.  
  75.         RegisterTheMainWindowClass(hInstance1);
  76.  
  77.         if (!DidTheMainWindowClassRegisterCorrectly (hInstance1, nCmdShow))
  78.             {
  79.                 return FALSE;
  80.             }
  81.  
  82.         // Message loop
  83.         while (GetMessage(&msg, nullptr, 0, 0))
  84.             {
  85.                 DispatchMessage(&msg);
  86.             }
  87.  
  88.         return msg.wParam;
  89.  
  90.     }   //int APIENTRY WinMain(HINSTANCE hInstance1, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  91.  
  92.  
  93. ATOM RegisterTheMainWindowClass(HINSTANCE hInstance3)
  94.  
  95.     // An ATOM is (always?) created when the class is registered.
  96.     // This might be a secure reference to window class in that it is special (?) to the kernel.
  97.     // Maybe (typedef unsigned short ATOM;)
  98.     // ATOM is a 16-bit Windows handle-like primitive.
  99.         // It's value is completely opaque to user-mode. (whatever that means)
  100.         // It is not a pointer or an index.
  101.     // They are indexes into a handle table in kernel mode.
  102.         // They are deliberately opaque because leaking kernel mode
  103.         // pointers to user-mode is a security violation (whatever that means).
  104.     {
  105.         WNDCLASSEX wcex;
  106.  
  107.         wcex.cbSize = sizeof(WNDCLASSEX);
  108.  
  109.         wcex.style            = 0; // CS_HREDRAW | CS_VREDRAW;
  110.             // CS_HREDRAW is for HORIZONTAL;
  111.                 // It redraws the entire window if a movement or size adjustment changes the width of the client area.
  112.             // CS_VREDRAW is for VERTICAL;
  113.                 // It redraws the entire window if a movement or size adjustment changes the height of the client area.
  114.         wcex.lpfnWndProc    = (WNDPROC)WndProc;
  115.         wcex.cbClsExtra        = 0;
  116.         wcex.cbWndExtra        = 0;
  117.         wcex.hInstance        = hInstance3;
  118.         wcex.hIcon            = nullptr;
  119.         wcex.hCursor        = LoadCursor(nullptr, IDC_ARROW);
  120.         wcex.hbrBackground    = (HBRUSH)(COLOR_WINDOW+1);
  121.         wcex.lpszMenuName    = nullptr;
  122.         wcex.lpszClassName    = WindowClass_for_WinMain;
  123.         wcex.hIconSm        = nullptr;
  124.  
  125.         // Return type is ATOM.
  126.         return RegisterClassEx(&wcex);
  127.  
  128.     }   //ATOM RegisterTheMainWindowClass(HINSTANCE hInstance3)
  129.  
  130. BOOL DidTheMainWindowClassRegisterCorrectly(HINSTANCE hInstance4, int nCmdShow)
  131.     {
  132.         InstanceHandleOfMainWindow = hInstance4; // Store the instance handle in a previously created global variable
  133.  
  134.         Handle_MainWindow = CreateWindow(   // Should I use CreateWindowEx ?
  135.             WindowClass_for_WinMain,
  136.             szTitle,
  137.             WS_OVERLAPPEDWINDOW,
  138.             CW_USEDEFAULT,
  139.             0,
  140.             100,
  141.             150,
  142.             NULL,
  143.             NULL,
  144.             hInstance4,
  145.             NULL);
  146.  
  147.         if (!Handle_MainWindow)
  148.             {
  149.                 return FALSE;
  150.             }
  151.  
  152.         // Create a dialog box
  153.         HWND Handle_DialogBox2 = CreateDialog(hInstance4, MAKEINTRESOURCE(IDD_DIALOG1), Handle_MainWindow, (DLGPROC)DialogProc);
  154.  
  155.         // Create a region
  156.         createRegion(Handle_DialogBox2);
  157.  
  158.         // Don't have to show or update the window ?
  159.         // ShowWindow(hWnd, nCmdShow);
  160.         // UpdateWindow(hWnd);
  161.  
  162.         return TRUE;
  163.  
  164.     }   //BOOL DidTheMainWindowClassRegisterCorrectly(HINSTANCE hInstance4, int nCmdShow)
  165.  
  166.  
  167. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  168.     {
  169.         switch (message)
  170.         {
  171.  
  172.             case WM_DESTROY:
  173.                 {
  174.                     DeleteObject(hRgn);
  175.  
  176.                     DeleteDC(hdcMem);       //Delete the memory DC
  177.  
  178.                     DeleteDC(hdcDest);      //delete the dest DC
  179.  
  180.                     PostQuitMessage(0);
  181.                 }
  182.                 return TRUE;
  183.                 break;
  184.  
  185.             default:
  186.                 {
  187.                 }
  188.                 return DefWindowProc(hWnd, message, wParam, lParam);
  189.        }
  190.        return 0;
  191.  
  192.     }   // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  193.  
  194.  
  195. INT_PTR CALLBACK DialogProc(HWND Handle_DialogBox01, UINT uMsg, WPARAM wParam, LPARAM lParam )
  196.             // Dialog callback procedure
  197.             //                                // INT_PTR is a signed integer memsize-type
  198.             //                                //    that can store a pointer regardless of the platform capacity.
  199.             //    HWND Handle_DialogBox01,    // Temporary (internal to this procedure) Handle to a dialog box
  200.             //    UINT uMsg,                  // Message
  201.             //    WPARAM wParam,              // First message parameter
  202.             //    LPARAM lParam               // Second message parameter
  203.     {
  204.  
  205.         switch (uMsg)
  206.         {
  207.  
  208.             case WM_PAINT:
  209.                 {
  210.                     paintRegion();
  211.  
  212.                     ValidateRect(Handle_DialogBox01,nullptr);   // ValidateRect(hwnd,FALSE);
  213.                 }
  214.                 return TRUE;
  215.                 break;
  216.  
  217.             case WM_MOVE:
  218.                 {
  219.                     paintRegion();
  220.                 }
  221.                 return TRUE;
  222.                 break;
  223.  
  224.  
  225.             case WM_LBUTTONDOWN:
  226.                 {
  227.                     mouseState = 1;
  228.                 }
  229.                 return TRUE;
  230.                 break;
  231.  
  232.             case WM_MOUSEMOVE:
  233.                 {
  234.                     if(mouseState)
  235.                         {
  236.                             GetCursorPos(&CursPt);
  237.                             PostMessage(Handle_DialogBox01, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( CursPt.x, CursPt.y));
  238.                             mouseState = 0;
  239.                         }
  240.  
  241.                 }
  242.                 return TRUE;
  243.                 break;
  244.  
  245.             case WM_RBUTTONDOWN:
  246.                 {
  247.                     // Destroy the dialog box
  248.                     EndDialog(Handle_DialogBox01,0);
  249.  
  250.                     // Send message to destroy the main application window and exit
  251.                     SendMessage(Handle_MainWindow,WM_DESTROY,0,0);
  252.                 }
  253.                 return TRUE;
  254.                 break;
  255.  
  256.             default :
  257.                 {
  258.                     break;
  259.                 }
  260.                 return TRUE;
  261.                 break;
  262.         }
  263.         return FALSE;
  264.  
  265.     }   // INT_PTR CALLBACK DialogProc( HWND Handle_DialogBox01, UINT uMsg, WPARAM wParam, LPARAM lParam )
  266.  
  267. void createRegion(HWND FunctionReferenceTo_DialogBox01)
  268.     {
  269.  
  270.         COLORREF crTransparent;
  271.  
  272.         int iX = 0;
  273.         int iY = 0;
  274.  
  275.         int iRet01 = 0;     // Integer For region 1
  276.         int iRet02 = 0;     // Integer For region 2
  277.  
  278.  
  279.         // Get the destination device context
  280.         hdcDest = GetDC(FunctionReferenceTo_DialogBox01);
  281.  
  282.         // Create a memory DC
  283.         hdcMem = CreateCompatibleDC(nullptr);
  284.  
  285.  
  286.         //----------------------------------------------------------------------
  287.         // START   Load the image files
  288.         //----------------------------------------------------------------------
  289.  
  290.             // a.bmp
  291.  
  292.                 wchar_t imageFile_A[] = L"a.bmp";
  293.  
  294.                 // Load the image
  295.                 HANDLE Handle_Bitmap_A = (HBITMAP)LoadImage(GetModuleHandle(nullptr), imageFile_A, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
  296.  
  297.                 if(!Handle_Bitmap_A)
  298.                     {
  299.                         // Handle error here
  300.                         return;
  301.                     }
  302.  
  303.  
  304.             // b.bmp
  305.  
  306.                 wchar_t imageFile_B[] = L"b.bmp";
  307.  
  308.                 // Load the image
  309.                 HANDLE Handle_Bitmap_B = (HBITMAP)LoadImage(GetModuleHandle(nullptr), imageFile_B, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
  310.  
  311.             if(!Handle_Bitmap_B)
  312.                 {
  313.                     // Handle error here
  314.                     return;
  315.                 }
  316.  
  317.         //----------------------------------------------------------------------
  318.         // END     Load the image files
  319.         //----------------------------------------------------------------------
  320.  
  321.  
  322.  
  323.         //----------------------------------------------------------------------
  324.         // START   Create Region from imageFile_A
  325.         //----------------------------------------------------------------------
  326.  
  327.             HRGN TemporaryRegion_for_Bitmap_A;
  328.             HRGN FinalTransparentRegionFromBitmap_A;
  329.  
  330.  
  331.             // Get information about the bitmap..
  332.             GetObject(Handle_Bitmap_A, sizeof(bmpInfo), &bmpInfo);    // Get info about the bitmap
  333.  
  334.             // Select the bitmap into the dc
  335.             //hGdiObj = SelectObject(hdcMem, Handle_Bitmap_A);
  336.             SelectObject(hdcMem, Handle_Bitmap_A);
  337.             // Create a region from a bitmap with transparency colour of white
  338.             // change the pixel values for a different transparency color
  339.             // example - RGB(0,0,0) will mean a transparency color of black.. so the areas
  340.             // of the bitmap not used to create the window will be black
  341.             // COLORREF crTransparent = RGB(255, 255, 255);
  342.             crTransparent = RGB(255, 255, 255);
  343.  
  344.  
  345.             iX = 0;
  346.             iY = 0;
  347.             iRet01 = 0;     // For region 2
  348.  
  349.             FinalTransparentRegionFromBitmap_A = CreateRectRgn(0,0,0,0);
  350.  
  351.             for (iY = 0; iY < bmpInfo.bmHeight; iY++)
  352.                 {
  353.                     do
  354.                         {
  355.                             // Skip over transparent pixels at start of lines.
  356.                             while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) == crTransparent)
  357.                                 {
  358.                                     iX++;
  359.                                 }
  360.  
  361.                             // Remember this pixel
  362.                             int iLeftX = iX;
  363.  
  364.                             // Now find first non transparent pixel
  365.                             while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) != crTransparent)
  366.                                 {
  367.                                     ++iX;
  368.                                 }
  369.  
  370.                             // Create a temp region on this info
  371.                             TemporaryRegion_for_Bitmap_A = CreateRectRgn(iLeftX, iY, iX, iY+1);
  372.  
  373.                             // Combine into main region.
  374.                             // From wingdi.h
  375.                             // WINGDIAPI int WINAPI CombineRgn(HRGN,HRGN,HRGN,int);
  376.                             // Combine Region1 & Region2 & store result in ResultRegion.
  377.                             // CombineRgn(ResultRegion,Region1,Region2,RGN_AND);
  378.                             iRet01 = CombineRgn(FinalTransparentRegionFromBitmap_A, FinalTransparentRegionFromBitmap_A, TemporaryRegion_for_Bitmap_A, RGN_OR);
  379.  
  380.  
  381.  
  382.                         }
  383.  
  384.                     while(iX < bmpInfo.bmWidth);
  385.                         {
  386.                             iX = 0;
  387.                         }
  388.                 }
  389.  
  390.             // Center it on current desktop
  391.             iRet01 = SetWindowRgn(FunctionReferenceTo_DialogBox01, FinalTransparentRegionFromBitmap_A, TRUE);
  392.  
  393.                 if(!iRet01)
  394.                     {
  395.                         return;
  396.                     }
  397.  
  398.                 iX = (GetSystemMetrics(SM_CXSCREEN)) / 3 - (bmpInfo.bmWidth / 3);
  399.  
  400.                 iY = (GetSystemMetrics(SM_CYSCREEN)) / 3 - (bmpInfo.bmHeight / 3);
  401.  
  402.                 iRet01 = SetWindowPos(FunctionReferenceTo_DialogBox01, HWND_TOPMOST, iX, iY, bmpInfo.bmWidth, bmpInfo.bmHeight, 0);
  403.  
  404.         //----------------------------------------------------------------------
  405.         // END     Create Region from imageFile_A
  406.         //----------------------------------------------------------------------
  407.  
  408.  
  409. //----------------------------------------------------------------------------------------------------
  410. //----------------------------------------------------------------------------------------------------
  411. //----------------------------------------------------------------------------------------------------
  412.  
  413.  
  414.         //----------------------------------------------------------------------
  415.         // START   Create Region from imageFile_B
  416.         //----------------------------------------------------------------------
  417.  
  418.             HRGN TemporaryRegion_for_Bitmap_B;
  419.             HRGN FinalTransparentRegionFromBitmap_B;
  420.  
  421.  
  422.             // Get information about the bitmap..
  423.             GetObject(Handle_Bitmap_B, sizeof(bmpInfo), &bmpInfo);    // Get info about the bitmap
  424.  
  425.             // Select the bitmap into the dc
  426.             SelectObject(hdcMem, Handle_Bitmap_B);
  427.  
  428.             // Create a region from a bitmap with transparency colour of white
  429.             // change the pixel values for a different transparency color
  430.             // example - RGB(0,0,0) will mean a transparency color of black.. so the areas
  431.             // of the bitmap not used to create the window will be black
  432.             // COLORREF crTransparent = RGB(255, 255, 255);
  433.             crTransparent = RGB(255, 255, 255);
  434.  
  435.  
  436.             iX = 0;
  437.             iY = 0;
  438.             iRet02 = 0;     // For region 2
  439.  
  440.             FinalTransparentRegionFromBitmap_B = CreateRectRgn(0,0,0,0);
  441.  
  442.             for (iY = 0; iY < bmpInfo.bmHeight; iY++)
  443.                 {
  444.                     do
  445.                         {
  446.                             // Skip over transparent pixels at start of lines.
  447.                             while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) == crTransparent)
  448.                                 {
  449.                                     iX++;
  450.                                 }
  451.  
  452.                             // Remember this pixel
  453.                             int iLeftX = iX;
  454.  
  455.                             // Now find first non transparent pixel
  456.                             while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) != crTransparent)
  457.                                 {
  458.                                     ++iX;
  459.                                 }
  460.  
  461.                             // Create a temp region on this info
  462.                             TemporaryRegion_for_Bitmap_B = CreateRectRgn(iLeftX, iY, iX, iY+1);
  463.  
  464.                             // Combine into main region.
  465.                             // From wingdi.h
  466.                             // WINGDIAPI int WINAPI CombineRgn(HRGN,HRGN,HRGN,int);
  467.                             // Combine Region1 & Region2 & store result in ResultRegion.
  468.                             // CombineRgn(ResultRegion,Region1,Region2,RGN_AND);
  469.                             iRet02 = CombineRgn(FinalTransparentRegionFromBitmap_B, FinalTransparentRegionFromBitmap_B, TemporaryRegion_for_Bitmap_B, RGN_OR);
  470.  
  471.                         }
  472.  
  473.                     while(iX < bmpInfo.bmWidth);
  474.                         {
  475.                             iX = 0;
  476.                         }
  477.                 }
  478.  
  479.             // Center it on current desktop
  480.             iRet02 = SetWindowRgn(FunctionReferenceTo_DialogBox01, FinalTransparentRegionFromBitmap_B, TRUE);
  481.  
  482.                 if(!iRet02)
  483.                     {
  484.                         return;
  485.                     }
  486.  
  487.                 iX = (GetSystemMetrics(SM_CXSCREEN)) / 3 - (bmpInfo.bmWidth / 3);
  488.  
  489.                 iY = (GetSystemMetrics(SM_CYSCREEN)) / 3 - (bmpInfo.bmHeight / 3);
  490.  
  491.                 iRet02 = SetWindowPos(FunctionReferenceTo_DialogBox01, HWND_TOPMOST, iX, iY, bmpInfo.bmWidth, bmpInfo.bmHeight, 0);
  492.  
  493.         //----------------------------------------------------------------------
  494.         // END     Create Region from imageFile_B
  495.         //----------------------------------------------------------------------
  496.  
  497.  
  498.         // Copy the memory dc into the screen dc
  499.         paintRegion();
  500.  
  501.         // Delete the bitmap
  502.         DeleteObject(Handle_Bitmap_A);
  503.         DeleteObject(Handle_Bitmap_B);
  504.  
  505.     }   // void createRegion(HWND FunctionReferenceTo_DialogBox01)
  506.  
  507. void paintRegion()
  508. {
  509.     // Transfer color data from the source device context to the destination device context
  510.     BitBlt(hdcDest, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem, 0, 0, SRCCOPY);
  511. }
Jan 2 '20 #2
rollerbladegirl
69 64KB
Here are some pictures showing what I am doing:
Attached Images
File Type: bmp a.bmp (29.3 KB, 63 views)
File Type: bmp b.bmp (22.3 KB, 79 views)
File Type: bmp c.bmp (351.6 KB, 86 views)
File Type: bmp working.bmp (351.6 KB, 67 views)
Jan 2 '20 #3
rollerbladegirl
69 64KB
Thank you gits for fixing the code to show indentations, etc. That was nice of you. I shall try to post code correctly formatted for viewing in the future. I copy and pasted this code, but that was not sufficient. You fixed it. Thank you. I shall try to do better next time.


Also. I have been experimenting and got the code to work better in that it shows both of the images, but it greys out one of them. Should I replace the original code with the updated code in my original posting, or post it separately?
Jan 3 '20 #4
rollerbladegirl
69 64KB
So far, to date 1/8/2020, this post has been viewed 224 times. Still no one told me how to do this. I need some help. C++ is new to me. Please someone tell me how to do this. I can create a region. I can create two regions, one at a time. I do not have to do this with dialog boxes if there is another or better/faster way. Help! Please.
Jan 9 '20 #5
In Microsoft Windows:
Do not use dialog boxes.
"I am trying to do this with Dialog boxes."

If you use standard dialog boxes then you are adding another window handle to your program. That allows Microsoft to add bloat to your program. Try to avoid adding any and all "additional" window handles to your program if you can. Sometimes it is necessary, but work at not having them.

You are working with images, therefore stay with images and use mouse tracking to detect when your mouse is over each of the images.

Since you are using regions then you might already have somewhere in your code the x and y positions of the entire pixel layout of each of your images. Your current front image's pixels would be subtracted from any and all images behind it. Your most rearward image would have all forward image pixels subtracted from it. Track you mouse position. Detect when the mouse is over a specific image. If a click occurs then respond as though it were a click on that image.

Start with creating two buffers.
  1. Initialize the back most buffer.
  2. Place all of your images on that buffer from back most image to front most image.
  3. Initialize the front most buffer.
  4. Do your image manipulation in the back most buffer.
  5. Copy that buffer to the front buffer.
  6. Copy that buffer to the screen.
You now have your image manipulation in buffers and not directly to the screen. Thus, less chance for screen flickering.

You now have two buffers that you can work with. The back most buffer you are currently using. The front most buffer is already set up, but not being actively used, and ready for testing later use. With the extra buffer you have an expansion option already built in. Example: you might want to do some testing of image effects and you do not want to damage your existing code, so do the testing in the front buffer where you can delete the entire test however complicated and intricate it is without it being tightly integrated into your current (back-most buffered) code.

Maybe, if someone has the time they might give you the code to do this, or maybe if later I have the time I might strip some out of one of my programs. But, this is how it can be done.

I see that you are using XP sp2. Since you are knowledgeable about the security of why to not use beyond that, then I expect that you might know at least some of the security of why to avoid using a lot of un-necessary Windows handles.

Going through the process again so that you understand what I am saying:

Buffers;

Images to buffers;

Mouse to pixel location detection;

Respond with rebuilding the back most buffer with images in the order that you want back most to front most.

Then copy back buffer to front buffer.

The next two things should be in one thread with no delays in between them. Not in two separate threads!
  • Re-analyze your mouse positioning. You are doing this part again BEFORE PLACING THE FRONT BUFFER TO THE SCREEN: Configure your tracking for the mouse position for the new image setup positions. No responses yet. Just set up the tracking for the new image placement.
  • Then copy the front buffer to the screen.

The user sees the screen.
Apr 16 '20 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

198
by: Michael N. Christoff | last post by:
Java, the software developed by Sun Microsystems in the mid-1990s as a universal operating system for Internet applications, gave NASA a low-cost and easy-to-use option for running Spirit, the...
2
by: Iain | last post by:
I'm part way through a project which will create Data Access classes for SQL Server database more or less automatically from the table definitions in the DB itself. I sort of get the CodeDom...
6
by: C# Learner | last post by:
1) How often do you put regions into your code? a) very often b) occasionally c) infrequently d) never 2) If you didn't answer (d), what do you use regions for? a) hiding ugly code
4
by: Simon | last post by:
Just starting on C# and would like to know what suggestions there are for the order in which declarations, event handlers, properties, private code, nested classes, etc, etc appear in your files....
0
by: G B | last post by:
Hi guys I was wondering whether generating Regions is possible using the CodeDom. I am writing a tool that generates some code and I could not find a way to group code into regions. Has...
7
by: gaidar | last post by:
Hi, everybody, I'm just wondering if someone really need stuff like this: http://msdn2.microsoft.com/library/ms123401.aspx. If you answer yes than explain, please. Thanks! Gaidar
3
by: steve | last post by:
Hello, I am having a problem with an index controlled partitioned table. I was altering a table using SQL. I was trying to add a partition to a table to change it from index controlled to...
6
by: Ikke | last post by:
Hi everybody, Can somebody tell me how to disable regions in Visual Studio 2005? I've already told VS not to collapse code to regions in the settings, but each time I open a new (existing)...
8
by: Spleenwort | last post by:
With regard to XML comments in c#. I think that #regions should be self-documenting relative to XML comments or that a <region> tag should be defined and auto-inserted when you type #region...
0
by: Mike | last post by:
I've a datagrid containing user's information which onselect displays a detailsview control in edit mode I've set-up two template fields to map to (country) and (region) these are dropdownlists...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.