By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,730 Members | 1,540 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,730 IT Pros & Developers. It's quick & easy.

bitmap regions, combine multiple or seperate for effect?

rollerbladegirl
P: 30
For the following: This is my main question:
*Most of all* should I be doing this making these combined (make multiple regions at the same time) or in separate threads (if I am to have many of them)?



I asked about some bitmap regions in a previous post.

https://bytes.com/topic/c/answers/973517-c-11-seperately-controlled-regions

I do not know if I should have replaced the previous one or added to it.

In a later discussion I was reminded of multi-threading. I am now wondering if in my attempts to display two independent bitmap regions maybe together was incorrect. Maybe I should have considered multi-threading them separately.

(1)
Make a bitmap region, save it somehow, then after that is completed make a second bitmap and save it. Then copy those to the screen (dc?).

or

(2)
This is stretching my capacity as I started in C++ ~6 months ago: Create two threads: Create a thread and make one bitmap custom region in a thread and save it to a global (dc?); Create a second thread and make a second bitmap custom region in that thread and save it to a second global (dc?). Then, when both threads report completed, combine the bitmap custom regions into one single region and put it to the screen (dc?).

That was intense to just write in.

Thoughts?

I kind of have this written. Not fully, but here it is.

NOTE: Problem: It kind of works, but it first shows a square grey window which I do not want but which goes away (I do not want it at all), then it shows a red X then it shows a blue mess, then the red X turns grey.

The now-grey X when I leftmouse click on it becomes forefront and can be moved. The blue mess when I left mouse click on it becomes forefront and can be moved.

Please help me to make the red X stay red.

Please help me to make the initial grey square not show up.

Please help me to make certain that I am cleaning up any memory correctly.

But *most of all* should I be doing this making these combined or in separate threads (if I am to have many of them)?

Thanks.

(I am including it all since I have read multiple times where readers have asked for more information from the poster.)


main.cpp
Expand|Select|Wrap|Line Numbers
  1.  
  2. #ifndef IDC_STATIC
  3.     #define IDC_STATIC (-1)
  4. #endif
  5.  
  6. #ifndef _UNICODE
  7.     #define _UNICODE
  8. #endif // _UNICODE
  9.  
  10. #ifndef UNICODE
  11.     #define UNICODE
  12. #endif // UNICODE
  13.  
  14. //#include "JM_Defines_and_Includes.h"
  15.  
  16. //----------
  17.  
  18. #include "windows.h"
  19. #include "resource.h"
  20.  
  21. #define MAX_LOADSTRING 100
  22.  
  23. // Global Variables:
  24.  
  25.     HINSTANCE InstanceHandleOfMainWindow;    // Instance handle of the main window
  26.  
  27.     TCHAR szTitle[MAX_LOADSTRING];            // The title bar text
  28.  
  29.     HWND Handle_MainWindow = NULL;          // Handle to main application window
  30.  
  31.     HRGN hRgn = NULL;                       // Handle to region
  32.  
  33.     HDC hdcDest;                            // Dest DC
  34.  
  35.     HDC hdcMem;                             // Memory DC
  36.  
  37.     BITMAP bmpInfo;                         // Buffer to hold bitmap data
  38.  
  39.     BOOL mouseState = 0;                    // Global variable for moving region using mouse
  40.  
  41.     POINT CursPt = {0};                     // Global variable for moving region using mouse
  42.  
  43.     wchar_t WindowClass_for_WinMain[MAX_LOADSTRING] = L"(myWindowClass)";
  44.  
  45. //    const wchar_t WindowClass_for_WinMain[MAX_LOADSTRING] = L"(myWindowClass)";
  46.  
  47. // Forward declarations of functions included later in this code module:
  48.  
  49.     ATOM                RegisterTheMainWindowClass(HINSTANCE hInstance2);
  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_A(HWND);
  60.     void createRegion_B(HWND);
  61.  
  62. // Empty Function to be used later to paint a region window
  63.  
  64.     void paintRegion();
  65.  
  66. // Empty Dialog callback procedure declaration to be used later
  67.  
  68.     INT_PTR CALLBACK DialogProc( HWND Handle_DialogBox1, UINT uMsg, WPARAM wParam, LPARAM lParam );
  69.  
  70.  
  71. int APIENTRY WinMain(HINSTANCE hInstance1, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  72.  
  73.     {
  74.         MSG msg;
  75.  
  76.         RegisterTheMainWindowClass(hInstance1);
  77.  
  78.         if (!DidTheMainWindowClassRegisterCorrectly (hInstance1, nCmdShow))
  79.             {
  80.                 return FALSE;
  81.             }
  82.  
  83.         // Message loop
  84.         while (GetMessage(&msg, nullptr, 0, 0))
  85.             {
  86.                 DispatchMessage(&msg);
  87.             }
  88.  
  89.         return msg.wParam;
  90.     }
  91.  
  92.  
  93. ATOM RegisterTheMainWindowClass(HINSTANCE hInstance3)
  94.  
  95.     // An ATOM is 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 is value is completely opaque to user-mode.
  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            = 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.  
  129. BOOL DidTheMainWindowClassRegisterCorrectly(HINSTANCE hInstance4, int nCmdShow)
  130.     {
  131.         InstanceHandleOfMainWindow = hInstance4; // Store the instance handle in a previously created global variable
  132.  
  133.         Handle_MainWindow = CreateWindow(
  134.             WindowClass_for_WinMain,
  135.             szTitle,
  136.             WS_OVERLAPPEDWINDOW,
  137.             CW_USEDEFAULT,
  138.             0,
  139.             100,
  140.             150,
  141.             NULL,
  142.             NULL,
  143.             hInstance4,
  144.             NULL);
  145.  
  146.         if (!Handle_MainWindow)
  147.             {
  148.                 return FALSE;
  149.             }
  150.  
  151.         // Create a dialog box
  152.         HWND Handle_DialogBox2 = CreateDialog(hInstance4, MAKEINTRESOURCE(IDD_DIALOG1), Handle_MainWindow, (DLGPROC)DialogProc);
  153.         // Create a region
  154.         createRegion_A(Handle_DialogBox2);
  155.  
  156.         HWND Handle_DialogBox3 = CreateDialog(hInstance4, MAKEINTRESOURCE(IDD_DIALOG1), Handle_MainWindow, (DLGPROC)DialogProc);
  157.         // Create a region
  158.         createRegion_B(Handle_DialogBox3);
  159.  
  160.         // Don't have to show or update the window ?
  161.         // ShowWindow(hWnd, nCmdShow);
  162.         // UpdateWindow(hWnd);
  163.  
  164.         return TRUE;
  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.  
  193.  
  194. INT_PTR CALLBACK DialogProc(            // Dialog callback procedure
  195.                                         // INT_PTR is a signed integer memsize-type
  196.                                         // that can store a pointer regardless of the platform capacity.
  197.             HWND Handle_DialogBox01,    // Temporary (internal to this procedure) Handle to a dialog box
  198.             UINT uMsg,                  // Message
  199.             WPARAM wParam,              // First message parameter
  200.             LPARAM lParam               // Second message parameter
  201.         )
  202.     {
  203.  
  204.         switch (uMsg)
  205.         {
  206.  
  207.             case WM_PAINT:
  208.                 {
  209.                     paintRegion();
  210.  
  211.                     ValidateRect(Handle_DialogBox01,nullptr);   // ValidateRect(hwnd,FALSE);
  212.                 }
  213.                 return TRUE;
  214.                 break;
  215.  
  216.             case WM_MOVE:
  217.                 {
  218. //does not work here.
  219. //RedrawWindow(Handle_MainWindow, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
  220.                     paintRegion();
  221.                 }
  222.                 return TRUE;
  223.                 break;
  224.  
  225.  
  226.             case WM_LBUTTONDOWN:
  227.                 {
  228.                     mouseState = 1;
  229. /*BOOL RedrawWindow(
  230.     HWND       hWnd,
  231.     const RECT *lprcUpdate,
  232.     HRGN       hrgnUpdate,
  233.     UINT       flags
  234.     );
  235. */
  236. //Almost works here but back image is partially greyed out.
  237. RedrawWindow(Handle_MainWindow, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
  238.  
  239.                 }
  240.                 return TRUE;
  241.                 break;
  242.  
  243.             case WM_MOUSEMOVE:
  244.                 {
  245.                     if(mouseState)
  246.                         {
  247.                             GetCursorPos(&CursPt);
  248.                             PostMessage(Handle_DialogBox01, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( CursPt.x, CursPt.y));
  249.                             mouseState = 0;
  250.                         }
  251.  
  252.                 }
  253.                 return TRUE;
  254.                 break;
  255.  
  256.             case WM_RBUTTONDOWN:
  257.                 {
  258.                     // Destroy the dialog box
  259.                     EndDialog(Handle_DialogBox01,0);
  260.  
  261.                     // Send message to destroy the main application window and exit
  262.                     SendMessage(Handle_MainWindow,WM_DESTROY,0,0);
  263.                 }
  264.                 return TRUE;
  265.                 break;
  266.  
  267.             default :
  268.                 {
  269.                     break;
  270.                 }
  271.                 return TRUE;
  272.                 break;
  273.         }
  274.         return FALSE;
  275.     }
  276.  
  277. void createRegion_A(HWND FunctionReferenceTo_DialogBox01)
  278.     {
  279.  
  280.         HGDIOBJ hGdiObj;    // For Selecting a bitmap into the dc
  281.         COLORREF crTransparent;
  282.  
  283.         int iX = 0;
  284.         int iY = 0;
  285.  
  286.         int iRet01 = 0;     // Integer For region 1
  287.  
  288.         // Get the destination device context
  289.         hdcDest = GetDC(FunctionReferenceTo_DialogBox01);
  290.  
  291.         // Create a memory DC
  292.         hdcMem = CreateCompatibleDC(nullptr);
  293.  
  294.         HRGN FinalTransparentRegionFrom_Combined_Bitmaps;
  295.         FinalTransparentRegionFrom_Combined_Bitmaps = CreateRectRgn(0,0,0,0);
  296.  
  297.         //----------------------------------------------------------------------
  298.         // START   Load the image files
  299.         //----------------------------------------------------------------------
  300.  
  301.             // a.bmp
  302.                 wchar_t imageFile_A[] = L"a.bmp";
  303.  
  304.                 // Load the image
  305.                 HANDLE Handle_Bitmap_A = (HBITMAP)LoadImage(GetModuleHandle(nullptr), imageFile_A, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
  306.  
  307.                 if(!Handle_Bitmap_A)
  308.                     {
  309.                         // Handle error here
  310.                         return;
  311.                     }
  312.  
  313.  
  314.         //----------------------------------------------------------------------
  315.         // END     Load the image files
  316.         //----------------------------------------------------------------------
  317.  
  318.  
  319.  
  320.  
  321.         //----------------------------------------------------------------------
  322.         // START   Create Region from imageFile_A
  323.         //----------------------------------------------------------------------
  324.  
  325.             HRGN TemporaryRegion_for_Bitmap_A;
  326.             HRGN FinalTransparentRegionFromBitmap_A;
  327.  
  328.  
  329.             // Get information about the bitmap..
  330.             GetObject(Handle_Bitmap_A, sizeof(bmpInfo), &bmpInfo);    // Get info about the bitmap
  331.  
  332.             // Select the bitmap into the dc
  333.             hGdiObj = SelectObject(hdcMem, Handle_Bitmap_A);
  334.  
  335.             // Create a region from a bitmap with transparency colour of white
  336.             // change the pixel values for a different transparency color
  337.             // example - RGB(0,0,0) will mean a transparency color of black.. so the areas
  338.             // of the bitmap not used to create the window will be black
  339.             // COLORREF crTransparent = RGB(255, 255, 255);
  340.             crTransparent = RGB(255, 255, 255);
  341.  
  342.  
  343.             iX = 0;
  344.             iY = 0;
  345.             iRet01 = 0;
  346.  
  347.             FinalTransparentRegionFromBitmap_A = CreateRectRgn(0,0,0,0);
  348.  
  349.             for (iY = 0; iY < bmpInfo.bmHeight; iY++)
  350.                 {
  351.                     do
  352.                     {
  353.                         // Skip over transparent pixels at start of lines.
  354.                         while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) == crTransparent)
  355.                             {
  356.                                 iX++;
  357.                             }
  358.  
  359.                         // Remember this pixel
  360.                         int iLeftX = iX;
  361.  
  362.                         // Now find first non transparent pixel
  363.                         while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) != crTransparent)
  364.                             {
  365.                                 ++iX;
  366.                             }
  367.  
  368.                         // Create a temp region on this info
  369.                         TemporaryRegion_for_Bitmap_A = CreateRectRgn(iLeftX, iY, iX, iY+1);
  370.  
  371.                         // Combine into main region.
  372.                         // From wingdi.h
  373.                         // WINGDIAPI int WINAPI CombineRgn(HRGN,HRGN,HRGN,int);
  374.                         // Combine Region1 & Region2 & store result in ResultRegion.
  375.                         // CombineRgn(ResultRegion,Region1,Region2,RGN_AND);
  376.                         iRet01 = CombineRgn(FinalTransparentRegionFromBitmap_A, FinalTransparentRegionFromBitmap_A, TemporaryRegion_for_Bitmap_A, RGN_OR);
  377.                     }
  378.  
  379.                     while(iX < bmpInfo.bmWidth);
  380.                     {
  381.                         iX = 0;
  382.                     }
  383.                 }
  384.  
  385.             // Center it on current desktop
  386.             iRet01 = SetWindowRgn(FunctionReferenceTo_DialogBox01, FinalTransparentRegionFromBitmap_A, TRUE);
  387.  
  388.                 if(!iRet01)
  389.                     {
  390.                         return;
  391.                     }
  392.  
  393.                 iX = (GetSystemMetrics(SM_CXSCREEN)) / 3 - (bmpInfo.bmWidth / 3);
  394.  
  395.                 iY = (GetSystemMetrics(SM_CYSCREEN)) / 3 - (bmpInfo.bmHeight / 3);
  396.  
  397.                 iRet01 = SetWindowPos(FunctionReferenceTo_DialogBox01, HWND_TOPMOST, iX, iY, bmpInfo.bmWidth, bmpInfo.bmHeight, 0);
  398.  
  399.         //----------------------------------------------------------------------
  400.         // END     Create Region from imageFile_A
  401.         //----------------------------------------------------------------------
  402.  
  403.  
  404.  
  405.         // Copy the memory dc into the screen dc
  406.         paintRegion();
  407.  
  408.         // Delete the bitmap
  409.         DeleteObject(Handle_Bitmap_A);
  410.  
  411.  
  412.     }   //void createRegion_A(HWND FunctionReferenceTo_DialogBox01)
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  void createRegion_B(HWND FunctionReferenceTo_DialogBox01)
  427.     {
  428.  
  429.         HGDIOBJ hGdiObj;    // For Selecting a bitmap into the dc
  430.         COLORREF crTransparent;
  431.  
  432.         int iX = 0;
  433.         int iY = 0;
  434.  
  435.         int iRet01 = 0;     // Integer For region 1
  436.         int iRet02 = 0;     // Integer For region 2
  437.         int iRet03 = 0;     // Integer For combined (already) transparent regions
  438.  
  439.  
  440.         // Get the destination device context
  441.         hdcDest = GetDC(FunctionReferenceTo_DialogBox01);
  442.  
  443.         // Create a memory DC
  444.         hdcMem = CreateCompatibleDC(nullptr);
  445.  
  446.         HRGN FinalTransparentRegionFrom_Combined_Bitmaps;
  447.         FinalTransparentRegionFrom_Combined_Bitmaps = CreateRectRgn(0,0,0,0);
  448.  
  449.         //----------------------------------------------------------------------
  450.         // START   Load the image files
  451.         //----------------------------------------------------------------------
  452.  
  453.  
  454.             // b.bmp
  455.                 wchar_t imageFile_B[] = L"b.bmp";
  456.  
  457.                 // Load the image
  458.                 HANDLE Handle_Bitmap_B = (HBITMAP)LoadImage(GetModuleHandle(nullptr), imageFile_B, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
  459.  
  460.             if(!Handle_Bitmap_B)
  461.                 {
  462.                     // Handle error here
  463.                     return;
  464.                 }
  465.  
  466.         //----------------------------------------------------------------------
  467.         // END     Load the image files
  468.         //----------------------------------------------------------------------
  469.  
  470.  
  471.  
  472.         //----------------------------------------------------------------------
  473.         // START   Create Region from imageFile_B
  474.         //----------------------------------------------------------------------
  475.  
  476.             HRGN TemporaryRegion_for_Bitmap_B;
  477.             HRGN FinalTransparentRegionFromBitmap_B;
  478.  
  479.  
  480.             // Get information about the bitmap..
  481.             GetObject(Handle_Bitmap_B, sizeof(bmpInfo), &bmpInfo);    // Get info about the bitmap
  482.  
  483.             // Select the bitmap into the dc
  484.             hGdiObj = SelectObject(hdcMem, Handle_Bitmap_B);
  485.  
  486.             // Create a region from a bitmap with transparency colour of white
  487.             // change the pixel values for a different transparency color
  488.             // example - RGB(0,0,0) will mean a transparency color of black.. so the areas
  489.             // of the bitmap not used to create the window will be black
  490.             // COLORREF crTransparent = RGB(255, 255, 255);
  491.             crTransparent = RGB(255, 255, 255);
  492.  
  493.  
  494.             iX = 0;
  495.             iY = 0;
  496.             iRet02 = 0;     // For region 2
  497.  
  498.             FinalTransparentRegionFromBitmap_B = CreateRectRgn(0,0,0,0);
  499.  
  500.             for (iY = 0; iY < bmpInfo.bmHeight; iY++)
  501.                 {
  502.                     do
  503.                     {
  504.                         // Skip over transparent pixels at start of lines.
  505.                         while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) == crTransparent)
  506.                             iX++;
  507.  
  508.                         // Remember this pixel
  509.                         int iLeftX = iX;
  510.  
  511.                         // Now find first non transparent pixel
  512.                         while (iX < bmpInfo.bmWidth && GetPixel(hdcMem, iX, iY) != crTransparent)
  513.                             ++iX;
  514.  
  515.                         // Create a temp region on this info
  516.                         TemporaryRegion_for_Bitmap_B = CreateRectRgn(iLeftX, iY, iX, iY+1);
  517.  
  518.                         // Combine into main region.
  519.                         // From wingdi.h
  520.                         // WINGDIAPI int WINAPI CombineRgn(HRGN,HRGN,HRGN,int);
  521.                         // Combine Region1 & Region2 & store result in ResultRegion.
  522.                         // CombineRgn(ResultRegion,Region1,Region2,RGN_AND);
  523.                         iRet02 = CombineRgn(FinalTransparentRegionFromBitmap_B, FinalTransparentRegionFromBitmap_B, TemporaryRegion_for_Bitmap_B, RGN_OR);
  524.  
  525.  
  526.  
  527.                     }
  528.  
  529.                     while(iX < bmpInfo.bmWidth);
  530.                     {
  531.                         iX = 0;
  532.                     }
  533.                 }
  534.  
  535.  
  536.             // Center it on current desktop
  537.             iRet02 = SetWindowRgn(FunctionReferenceTo_DialogBox01, FinalTransparentRegionFromBitmap_B, TRUE);
  538.  
  539.                 if(!iRet02)
  540.                     {
  541.                         return;
  542.                     }
  543.  
  544.                 iX = (GetSystemMetrics(SM_CXSCREEN)) / 3 - (bmpInfo.bmWidth / 3);
  545.  
  546.                 iY = (GetSystemMetrics(SM_CYSCREEN)) / 3 - (bmpInfo.bmHeight / 3);
  547.  
  548.                 iRet02 = SetWindowPos(FunctionReferenceTo_DialogBox01, HWND_TOPMOST, iX, iY, bmpInfo.bmWidth, bmpInfo.bmHeight, 0);
  549.  
  550.         //----------------------------------------------------------------------
  551.         // END     Create Region from imageFile_B
  552.         //----------------------------------------------------------------------
  553.  
  554.  
  555.  
  556.         // Copy the memory dc into the screen dc
  557.         paintRegion();
  558.  
  559.         // Delete the bitmap
  560.         DeleteObject(Handle_Bitmap_B);
  561.  
  562.  
  563.     }   //void createRegion_B(HWND FunctionReferenceTo_DialogBox01)
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574. void paintRegion()
  575. {
  576.     // Transfer color data from the source device context to the destination device context
  577.     BitBlt(hdcDest, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem, 0, 0, SRCCOPY);
  578.     UpdateWindow(Handle_MainWindow);
  579.     RedrawWindow(Handle_MainWindow, nullptr, nullptr, RDW_UPDATENOW);
  580.  
  581. }
  582.  
  583.  
------------------------------

resource.h

Expand|Select|Wrap|Line Numbers
  1.  
  2. #ifndef IDC_STATIC
  3.     #define IDC_STATIC (-1)
  4. #endif
  5.  
  6. #ifndef _UNICODE
  7.     #define _UNICODE
  8. #endif // _UNICODE
  9.  
  10. #ifndef UNICODE
  11.     #define UNICODE
  12. #endif // UNICODE
  13.  
  14.  
  15. #define IDD_DIALOG1                     101
  16.  
  17.  
------------------------------

resource.rc

Expand|Select|Wrap|Line Numbers
  1.  
  2. #ifndef IDC_STATIC
  3.     #define IDC_STATIC (-1)
  4. #endif
  5.  
  6. #ifndef _UNICODE
  7.     #define _UNICODE
  8. #endif // _UNICODE
  9.  
  10. #ifndef UNICODE
  11.     #define UNICODE
  12. #endif // UNICODE
  13.  
  14.  
  15. #include <windows.h>
  16. #include <commctrl.h>
  17. //#include <richedit.h>
  18. #include "resource.h"
  19.  
  20.  
  21. LANGUAGE 0, SUBLANG_NEUTRAL
  22. 1                  RT_MANIFEST    ".\\manifest.xml"
  23.  
  24.  
  25. //----------
  26.  
  27. IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95
  28.  
  29. STYLE DS_SYSMODAL | WS_POPUP | WS_VISIBLE
  30. //CAPTION "Hello"  //Any setting of this Dialog's Caption (including blank "") seems to makes this dialog not be shaped correctly.
  31. {
  32. }
  33.  
  34.  
------------------------------

manifest.xml

(Put in your own codeblocks public key token at the xxxxxxxxxx area.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  3.   <dependency>
  4.     <dependentAssembly>
  5.       <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="xxxxxxxxxx" language="*"/>    </dependentAssembly>
  6.   </dependency>
  7.   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  8.     <security>
  9.       <requestedPrivileges>
  10.         <requestedExecutionLevel
  11.           level="asInvoker"
  12.           uiAccess="false"/>
  13.       </requestedPrivileges>
  14.     </security>
  15.   </trustInfo>
  16. </assembly>
  17.  
  18.  

------------------------------


Here is what I get:

[attach]a.bmp[/attach]
[attach]b.bmp[/attach]
[attach]c.bmp[/attach]
[attach]d.bmp[/attach]
[attach]e.bmp[/attach]

The attach stuff does not seem to work in the preview mode. I hope it shows up in on the page.
Attached Images
File Type: bmp d.bmp (278.0 KB, 15 views)
File Type: bmp e.bmp (417.8 KB, 12 views)
2 Weeks Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

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